More single-file splits from the re-index
Test and deploy / test (push) Successful in 54s
Test and deploy / edge (push) Successful in 1m56s
Test and deploy / deploy (push) Successful in 1m49s

Releases of one file whose counter announces many (910k of 3M after the
sixth reset's first minutes), by cause:
- An unquoted name with double spaces ("lara_bath  15of19 larabath_2.5.jpg",
  "Luisa:     (068 of 160)"): the subject is collapsed, the name wasn't,
  so it stayed in the remainder; it's taken out collapsed too.
- Audiobook and album tracks keyed by their own name ("RP - File 268 of
  295 - \"… Seeing A Large Cat - D11.16-22.mp3\"", "CANDYD :: \"Candy
  Dulfer - Candy Store - 11 - everytime.mp3\""): by the name without its
  numbers, as image sets.
- A size without a unit before the closing yEnc ("…mp3\" - 8123 yEnc").
- Random posters with separators ("SOFZRw1-OTEd@…", "…_OOW@…").
Both implementations; tests; fixtures identical (models: 267 -> 172).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Daan MeijerandClaude Opus 5.5 committed 2026-10-11 23:15:31 +02:00
1 parent 8d400822bd
commit 625ea23171
3 files changed
+106 -5

No files matched your search

+17 -2
View File
@@ -77,6 +77,8 @@ export function subjectRemainder(subject: string): string {
// File sizes ("76.88 MB", "335555 Bytes", "336573 byt" cut off, "[347K]") differ per file.
.replace(/\b\d+(?:[.,]\d+)?\s*(?:[kmgt]i?b|bytes?|byt)\b/gi, ' ')
.replace(/\[\s*\d+(?:[.,]\d+)?\s*[kmgt]\s*\]/gi, ' ')
// A size without a unit right before the closing yEnc ("…mp3" - 8123 yEnc").
.replace(/\b\d+(\s+yEnc\s*)$/i, '$1')
// File sizes follow "yEnc" at the end; other numbers (years, post ids) stay.
.replace(/\byEnc\b(\s+\d+)?\s*$/i, ' ')
.replace(/\byEnc\b/gi, ' ')
@@ -195,7 +197,8 @@ export function randomPoster(from: string): boolean {
const close = open === -1 ? -1 : from.indexOf('>', open + 1)
const address = close !== -1 ? from.slice(open + 1, close) : from.trim().split(' ')[0]
const at = address.indexOf('@')
return looksRandom(at === -1 ? address : address.slice(0, at))
// Separators don't make a token less random ("SOFZRw1-OTEd", "vMgGYlZB9ZcTNk8WxYFGV_OOW").
return looksRandom((at === -1 ? address : address.slice(0, at)).replace(/[-_.]/g, ''))
}
export function releaseIdentity(input: ReleaseInput): ReleaseIdentity | null {
@@ -216,7 +219,13 @@ export function releaseIdentity(input: ReleaseInput): ReleaseIdentity | null {
// Text outside the quotes that names the release, e.g. "Some.Release [01/45] - "x.rar"". A name that isn't
// quoted (unquotedName: "DVDFab 8.2.0.5.rar (006/332)", "[keira_s04_0037_l.jpg" yEnc] (2/2)") is taken out
// as the quotes would have been: otherwise every file of a set would name a release of its own.
const remainder = subjectRemainder(input.subject.includes(`"${input.name}"`) ? input.subject : input.subject.replace(input.name, ' ').replace(/"/g, ' '))
// The subject here has its spaces collapsed; the name may not ("lara_bath 15of19 larabath_2.5.jpg").
const collapsed = input.name.replace(/\s+/g, ' ').trim()
const remainder = subjectRemainder(
input.subject.includes(`"${input.name}"`)
? input.subject
: (input.subject.includes(input.name) ? input.subject.replace(input.name, ' ') : input.subject.replace(collapsed, ' ')).replace(/"/g, ' ')
)
// A document or comic is a release of its own (collections post hundreds under one subject).
if (DOCUMENT.test(input.name)) return { key: hash('stem', poster, stem), name: stem.replace(DOCUMENT, '') || stem, fileTotal, source: 'stem' }
const image = IMAGE.test(input.name)
@@ -252,6 +261,12 @@ export function releaseIdentity(input: ReleaseInput): ReleaseIdentity | null {
}
// An image without words around it: its set by its name (keyed as a stem, so "x.jpg" joins "x.part01.rar").
if (image) return { key: hash('stem', poster, prefix || stem), name: prefix || stem, fileTotal, source: 'stem' }
// An audiobook's or album's tracks without a name around them: by their name without its numbers, as an
// image set ("… Seeing A Large Cat - D11.16-22.mp3", "Candy Dulfer - Candy Store - 11 - everytime.mp3").
if (AUDIO.test(input.name)) {
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' }
}
// 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.
return { key: hash('stem', poster, stem), name: stem, fileTotal, source: 'stem' }