Identity: per-file hex ids, dated stems, season packs under a bare counter
Test and deploy / test (push) Successful in 59s
Test and deploy / edge (push) Successful in 1m51s
Test and deploy / deploy (push) Successful in 1m26s

From the corpus sweep (695 ranges):
- A bracketed hex id per file ("[PRiVATE] Rosewood.S02E08… [1f1793f68d5321]
  [newzNZB] [01/22]") goes from the subject: nEwZ[NZB]'s 32,101 single files.
- A stem that starts with a date is specific enough for the poster-tag rule
  ("09-30-2008_CTC.r00" under "#sterntuary - Coast To Coast Radio Show":
  still one release of 25,188 files, the stem being too short to "describe").
- Episodes under a bare counter ("[01/36] "Pokemon - S02E01 - Pallet Party
  Panic.mkv"") are one release per show, season and counter total.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Daan MeijerandClaude Opus 5.5 committed 2026-10-12 12:10:40 +02:00
1 parent 1cb6a4554f
commit 1866e38c25
3 files changed
+72 -12

No files matched your search

+16 -2
View File
@@ -128,6 +128,9 @@ function hash(...parts: (string | number | undefined)[]) {
return digest('sha1', parts.map((p) => p ?? '').join('\n'))
}
const DATE_LED = /^\d{1,2}[-._]\d{1,2}[-._](?:19|20)\d{2}(?!\d)/
const VIDEO = /\.(mkv|mp4|avi|m4v|ts|wmv|mov)$/i
const EPISODE = /^(.+?)[ ._-]+S(\d{1,2})E\d{1,3}/i
const HASHED = /^[0-9a-f]{8,}(?:_[0-9a-f]{6,}){2,}(?:-[0-9a-z]+)?$/i
const SCENE_TRACK = /^\d{1,3}[-_ .]+(.+?)(?:_-_| - |-)/
const VOLUME_NUMBER = /^(.*[^\d. ])[. ](\d{1,5})\.?$/
@@ -302,6 +305,8 @@ export function releaseIdentity(input: ReleaseInput): ReleaseIdentity | null {
.replace(/"/g, ' ')
// A file's size in brackets after its counter ("[26/32] - [4929] "…part24.rar"": each file a release; Kingdn).
.replace(/(\[\d+\/\d+\])\s*-\s*\[\d+\]/g, '$1')
// A per-file hex id in brackets ("[PRiVATE] Rosewood.S02E08… [1f1793f68d5321] [newzNZB] [01/22]": 32,101 single files).
.replace(/\[[0-9a-f]{8,}\]/gi, ' ')
const remainder = subjectRemainder(named)
// Counted without the file name, as quoted names are: "shyla-shy-09-0195.jpg hardcore …" is no "9 of 195"
// (each of 866 images was a release of its own; LOG.md 2026-10-12 (5)).
@@ -319,11 +324,13 @@ export function releaseIdentity(input: ReleaseInput): ReleaseIdentity | null {
// lessons were releases of their own; LOG.md 2026-10-11 (7)). Uploads hours apart are apart anyway.
// Also after a disc code ("SC8367-12 - Wynette, Tammy - Singing My Song", karaoke discs).
// Not a date ("09-30-2008_BAK_JRS.r00": a daily show's 32,621 files were one release under the poster's tag).
const numbered = /^(?:[A-Z]{1,5}\d{2,6}[-_ ])?\d{1,3}[ ._-]/.test(stem) && !/^\d{1,2}[-._]\d{1,2}[-._](?:19|20)\d{2}(?!\d)/.test(stem)
const dated = DATE_LED.test(stem)
const numbered = /^(?:[A-Z]{1,5}\d{2,6}[-_ ])?\d{1,3}[ ._-]/.test(stem) && !dated
// A hashed stem under text without a counter is the upload, the text a tag ("Seit 1753 Tagen - usenet4ever.info -
// "055631a1_b6c820bc_a856086c_85112a5-u4e.part01.rar"": a day's uploads were one release; LOG.md 2026-10-12 (11)).
const hashed = fileTotal === undefined && HASHED.test(stem)
const tag = hashed || (!image && !numbered && !AUDIO.test(input.name) && describes(stem) && !looksRandom(stem) && isPosterTag(remainder, stem))
// A dated stem says which upload it is, short as it is ("09-30-2008_CTC.r00" under "#sterntuary - Coast To Coast Radio Show").
const tag = hashed || (!image && !numbered && !AUDIO.test(input.name) && (describes(stem) || dated) && !looksRandom(stem) && isPosterTag(remainder, stem))
// An image set without a counter: the image's name up to its last number, without numbers
// ("Kitchen Hottie 1 set233-76-lg" → "Kitchen Hottie set", "bm_jessica_blb_h087" → "bm jessica blb h").
const prefix = image ? stem.replace(/\d+\D*$/, '').replace(/\d+/g, ' ').replace(/[\s._-]+/g, ' ').trim() : ''
@@ -362,6 +369,13 @@ export function releaseIdentity(input: ReleaseInput): ReleaseIdentity | null {
const tracks = stem.replace(/\d+\D*$/, '').replace(/\d+/g, ' ').replace(/[\s._-]+/g, ' ').trim()
if (tracks) return { key: hash('stem', poster, tracks), name: tracks, fileTotal, source: 'stem' }
}
// A season's episodes under a bare counter ("[01/36] "Pokemon - S02E01 - Pallet Party Panic.mkv""): one release per
// show, season and counter total (each episode was a release of its own).
const episode = postTotal && VIDEO.test(input.name) ? EPISODE.exec(stem) : null
if (episode) {
const season = `${episode[1].trim()} S${episode[2].padStart(2, '0')}`
return { key: hash('stem', poster, season.toLowerCase(), postTotal), name: season, fileTotal, source: 'stem' }
}
// The [i/M] total is informational, not part of the key: posters often
// upload the par2 index without a counter, and it belongs to the same post.
// A numbered volume as the extension, within the counter's total ("(????) [0659/2195] - "DN.VPL PCK.1508"",