Prober: an inspection per candidate; no inner name that is the release's name
A release can have several candidates of a kind (two RAR sets): keyed by
(release, kind) both landed in one upsert ("ON CONFLICT DO UPDATE
command cannot affect row a second time"), and the batch was lost.
release_inspections is keyed by candidate now; the first run's results
are cleared and probed again. A random-named file's yEnc name is often
its random name: an inner name equal to the release's name is dropped.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8bd6d6aa5f
commit
738402aefa
4 files changed
+53
-22
No files matched your search
+10
-7
@@ -68,12 +68,15 @@ export function inspect(body: Buffer): Inspection {
|
||||
}
|
||||
|
||||
/**
|
||||
* A release's best inner name from its inspections: the largest named entry
|
||||
* of its archive, else the largest file of its par2 set that isn't
|
||||
* packaging, else a lone file's yEnc name. Null when none says more.
|
||||
* A release's best inner name from its inspections (by probe kind): the
|
||||
* largest named entry of an archive, else the largest file of a par2 set
|
||||
* that isn't packaging, else a lone file's yEnc name. Null when none says
|
||||
* more than the release's own name.
|
||||
*/
|
||||
export function innerName(inspections: Partial<Record<string, Inspection>>): string | null {
|
||||
const content = (i?: Inspection) => i?.names?.find((n) => !PACKAGING.test(n))
|
||||
const pick = content(inspections.archive) ?? content(inspections.par2) ?? (inspections.lone?.yencName || undefined)
|
||||
return pick ? pick.replace(/^.*[\\/]/, '').slice(0, 255) : null
|
||||
export function innerName(inspections: { kind: string; result: Inspection }[], releaseName = ''): string | null {
|
||||
const of = (kind: string) => inspections.filter((i) => i.kind === kind).map((i) => i.result)
|
||||
const content = (kind: string) => of(kind).flatMap((i) => i.names ?? []).find((n) => !PACKAGING.test(n))
|
||||
const pick = content('archive') ?? content('par2') ?? of('lone').find((i) => i.yencName)?.yencName
|
||||
const name = pick?.replace(/^.*[\\/]/, '').slice(0, 255)
|
||||
return name && name.toLowerCase() !== releaseName.toLowerCase() ? name : null
|
||||
}
|
||||
Reference in new issue
Block a user