Counters: a total padded wider than its index is none; report diff on shared ranges
- "Very Best Of The Who [01/010]", "[02/020]", "[07/070]": a posting tool's
total of index×10, so every track had a total of its own and was a
release of its own. A total zero-padded wider than its index is no
counter ("[001/010]" still is).
- corpus_sweep.py report compares builds over the ranges both replayed (the
corpus grows between builds).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1a5035d988
commit
8e07478659
4 files changed
+53
-12
No files matched your search
+10
-2
@@ -193,10 +193,18 @@ export function imageSet(stem: string): string {
|
||||
return /(?<!\d)0*[1-9]\d{4,}/.test(set) ? '' : set
|
||||
}
|
||||
|
||||
/**
|
||||
* A total a posting tool wrote wrong: zero-padded wider than the index ("[01/010]", "[02/020]", "[07/070]": each
|
||||
* track of an album had a total of its own, so a release of its own; LOG.md 2026-10-12 (15)).
|
||||
*/
|
||||
function brokenTotal(index: string, total: string): boolean {
|
||||
return total.length > 1 && total.startsWith('0') && total.length > index.length
|
||||
}
|
||||
|
||||
export function counterTotal(subject: string): number | undefined {
|
||||
const s = subject.replace(/"[^"]*"/g, ' ')
|
||||
const plain = /\[(\d+)\/(\d+)\]|\((\d+)\/(\d+)\)/.exec(s)
|
||||
if (plain) return Number(plain[2] ?? plain[4])
|
||||
if (plain) return brokenTotal(plain[1] ?? plain[3], plain[2] ?? plain[4]) ? undefined : Number(plain[2] ?? plain[4])
|
||||
// Dates are no counters ("Avira AntiVir Rescue System 08-29-2011.rar", "… 27-02-2011", "18-08-2012"):
|
||||
// read as "8 of 29", such a release showed a wrong file total and counted as incomplete.
|
||||
const undated = s.replace(DATES, ' ')
|
||||
@@ -263,7 +271,7 @@ export function releaseIdentity(input: ReleaseInput): ReleaseIdentity | null {
|
||||
const poster = randomPoster(input.poster) ? '' : input.poster
|
||||
const counter = /\[(\d+)\/(\d+)\]/.exec(input.subject)
|
||||
// The post rule's key takes the [i/M] total (as when the catalog started); the release's file total any counter's.
|
||||
const postTotal = counter ? Number.parseInt(counter[2], 10) : undefined
|
||||
const postTotal = counter && !brokenTotal(counter[1], counter[2]) ? Number.parseInt(counter[2], 10) : undefined
|
||||
const stem = fileStem(input.name)
|
||||
|
||||
if (input.weak) {
|
||||
|
||||
Reference in new issue
Block a user