Image sets: keyed by set without words around them; px, ImageVenue, spaced repeats
Test and deploy / test (push) Successful in 46s
Test and deploy / edge (push) Successful in 2m4s
Test and deploy / deploy (push) Successful in 2m17s

- An image whose subject has no words ("##[ "diana-040-001.jpg" (01/68)")
  is keyed by its set, not its name without numbers: a poster's 263 diana
  sets were one release of 17,808 images.
- imageSet strips "-2048px" and ImageVenue's "_123_244lo", and reads a
  spaced suffix ("she has sensual legs 172 _ 172") as one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Daan MeijerandClaude Opus 5.5 committed 2026-10-12 05:45:53 +02:00
1 parent 108d798d97
commit 18a146e130
3 files changed
+51 -14

No files matched your search

+14 -7
View File
@@ -152,9 +152,13 @@ const DATES = /\b(?:(?:19|20)\d{2}[-._ ](?:0?[1-9]|1[0-2])[-._ ]\d{1,2}|\d{1,2}[
const TIMESTAMP = /[-_. ]?(?:19|20)\d{2}[-._ ](?:0?[1-9]|1[0-2])[-._ ]\d{1,2}(?:[-._ ]\d{1,2})*$/
export function imageSet(stem: string): string {
// Suffixes that number no image: a copy's ("sexypattycake_0903040445[1]"), a resolution ("092_081_2000x1500"),
// a constant one ("KP0027_197_00").
const plain = stem.replace(/\s*[[(]\d+[\])]$/, '').replace(/[_-]\d{3,4}x\d{3,4}$/i, '').replace(/[_-]0+$/, '')
// Suffixes that number no image: a copy's ("sexypattycake_0903040445[1]"), a resolution ("092_081_2000x1500",
// "01079-106-2048px"), ImageVenue's ("…_17_123_244lo"), a constant one ("KP0027_197_00").
const plain = stem
.replace(/\s*[[(]\d+[\])]$/, '')
.replace(/[_-]\d{3,4}(?:x\d{3,4}|px)$/i, '')
.replace(/_123_\d+lo$/i, '')
.replace(/[_-]0+$/, '')
// A counter in the name counts the images: the set is the text before it ("Set 008 10of63 new0464",
// "202/430 princess-079-058", "( 098 /500) 002 148"; each image was a release of its own).
const counted = /(\d+)\s*of\s*\d+|[[(]?\s*\d+\s*\/\s*\d+\s*[\])]?/i.exec(plain)
@@ -162,16 +166,17 @@ export function imageSet(stem: string): string {
// A camera's timestamp ("kurozo-2006-7-26-15-21"): the date and the time after it number no set.
let s = plain.replace(TIMESTAMP, '')
while (true) {
const m = /[_-](\d+)$/.exec(s)
// Also spaced ("she has sensual legs 172 _ 172").
const m = /\s*([_-])\s*(\d+)$/.exec(s)
if (!m) break
const before = s.slice(0, m.index)
const previous = /(\d+)\D*$/.exec(before)
if (!previous) break
const n = m[1]
const n = m[2]
// A repeat: the same number, or the end of the one before ("kate054001_1_1": 054001 ends in 1).
const repeat = Number(n) === Number(previous[1]) || previous[1].endsWith(n)
// A renumbering right after the number ("kate108lg029_28" once an image is skipped): both count the images.
const renumbered = m[0][0] === '_' && !n.startsWith('0') && previous.index + previous[1].length === before.length
const renumbered = m[1] === '_' && !n.startsWith('0') && previous.index + previous[1].length === before.length
if (repeat || renumbered || /^(?:19|20)\d\d$/.test(n) || n.length >= 4) s = before
else break
}
@@ -309,7 +314,9 @@ export function releaseIdentity(input: ReleaseInput): ReleaseIdentity | null {
return { key: hash('post', poster, remainder, postTotal), name: remainder, fileTotal, source: 'post' }
}
// 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' }
// Keyed by its set when its name has one ("##[ "diana-040-001.jpg" (01/68)": all of a poster's 263 diana sets were
// one release of 17,808 images; LOG.md 2026-10-12 (7)).
if (image) return { key: hash('stem', poster, imageSet(stem) || 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)) {