feat(media): the operator's map gives a folder the id its name cannot reach #106

Merged
dank merged 1 commits from feat/media-tvdb-id-map into main 2026-10-31 13:15:38 -07:00
Owner

Tvdb titles a record in the show's own language and keeps the English name in
aliases the name search never reads. The planner's rule — a name counts only
when tvdb spells it the same — therefore cannot resolve the anime class at all:

  • ブラッククローバー (331753, 2017) holds no alias, so no spelling of "Black
    Clover" reaches it;
  • the bare alias One Piece belongs to 392276, the 2023 live action, not to
    the 1999 record (81797) that the 1,072-file pack here is;
  • Fairy Tail (2009-2014) matched 410031, FAIRY TAIL 100 NEN QUEST (2024);
  • Ken Il Guerriero HOKUTO NO KEN matched 465216, the 2026 remake;
  • Black Clover 001 matched 378762, Mugyutto! Black Clover (2019).

The map

scripts/media-shows.py now reads scripts/media-shows-tvdb-ids.tsv by default:
folder <TAB> tvdb id <TAB> note, one line per pack folder.

  • It outranks a provider id — a box set's provider id is the server's own
    guess at a folder name — and a disagreement is written to the exceptions.
  • It merges the release folders that are one show (two folders, one id, one
    destination folder), which is also what makes their duplicate episodes meet.
  • Every folder it named, every row with no folder on the array, every provider
    disagreement and every id tvdb never answered is listed in the exceptions.
  • It is read fail-closed: an id that is not a number, or one folder named
    twice, stops the plan — a typo there renames a 1,268-file pack to the wrong show.
  • Only folders the search cannot reach belong in it. The EXACT/PUNCT class stays
    out so a live lookup is never hidden behind a number nobody re-checks.

17 rows, 16 records, 3,507 files. Each id was read from tvdb's own
/series/<id>/extended today; the note column states what the record says and
which neighbouring record a name search would have picked instead, so every row
is checkable without re-searching.

The sheet

scripts/media-shows-tvdb.py (promoted out of /tmp, so the next run is
reproducible) reads a plan's mkdir rows, asks tvdb about every destination
folder carrying no [tvdbid-, and grades each answer by how much was guessed to
reach it: EXACT / PUNCT / NEAR / NONE, plus MAPPED for a folder the
operator already decided. Acceptance is unchanged from the passes it replaces —
bare-form equality plus the year-span guard — and NEAR prints the best hit for
a human while nothing applies it. That gate is what rejected the three picks
above. The sheet is for Frank; the planner only ever reads the approved map.

Not in this PR

No file moves. The dry run against the array happens after the map rows are
approved — Frank chose: regenerate, read the exceptions, apply nothing.

Tests

Seven for the map's behaviour — rename to the record it names; two release folders
becoming one series; precedence over a provider id and the line naming the
disagreement; an id tvdb never answered; a row whose folder is gone; a malformed id
refusing the run; a folder named twice refusing the run — plus one that the shipped
map parses and never stops a plan. ./tests/run.sh green, and
scripts/media-shows-tvdb.py smoke-run against a fixture plan with live tvdb
answers (MAPPED / PUNCT / NEAR / NONE each observed; the [tvdbid-] folder and the
review pile excluded).


cwd: /home/blank/.omp/wt/tvdb-map · session: 6d1fc1f

Tvdb titles a record in the show's own language and keeps the English name in *aliases* the name search never reads. The planner's rule — a name counts only when tvdb spells it the same — therefore cannot resolve the anime class at all: - `ブラッククローバー` (331753, 2017) holds **no alias**, so no spelling of "Black Clover" reaches it; - the bare alias `One Piece` belongs to **392276**, the 2023 live action, not to the 1999 record (81797) that the 1,072-file pack here is; - `Fairy Tail (2009-2014)` matched **410031**, *FAIRY TAIL 100 NEN QUEST* (2024); - `Ken Il Guerriero HOKUTO NO KEN` matched **465216**, the **2026** remake; - `Black Clover 001` matched **378762**, *Mugyutto! Black Clover* (2019). ## The map `scripts/media-shows.py` now reads `scripts/media-shows-tvdb-ids.tsv` by default: `folder <TAB> tvdb id <TAB> note`, one line per pack folder. - It **outranks a provider id** — a box set's provider id is the server's own guess at a folder name — and a disagreement is written to the exceptions. - It **merges** the release folders that are one show (two folders, one id, one destination folder), which is also what makes their duplicate episodes meet. - Every folder it named, every row with no folder on the array, every provider disagreement and every id tvdb never answered is **listed in the exceptions**. - It is read **fail-closed**: an id that is not a number, or one folder named twice, stops the plan — a typo there renames a 1,268-file pack to the wrong show. - Only folders the search *cannot* reach belong in it. The EXACT/PUNCT class stays out so a live lookup is never hidden behind a number nobody re-checks. 17 rows, 16 records, 3,507 files. Each id was read from tvdb's own `/series/<id>/extended` today; the note column states what the record says and which neighbouring record a name search would have picked instead, so every row is checkable without re-searching. ## The sheet `scripts/media-shows-tvdb.py` (promoted out of `/tmp`, so the next run is reproducible) reads a plan's `mkdir` rows, asks tvdb about every destination folder carrying no `[tvdbid-`, and grades each answer by how much was guessed to reach it: `EXACT` / `PUNCT` / `NEAR` / `NONE`, plus `MAPPED` for a folder the operator already decided. Acceptance is unchanged from the passes it replaces — bare-form equality plus the year-span guard — and `NEAR` prints the best hit for a human while nothing applies it. That gate is what rejected the three picks above. The sheet is for Frank; the planner only ever reads the approved map. ## Not in this PR No file moves. The dry run against the array happens after the map rows are approved — Frank chose: regenerate, read the exceptions, apply nothing. ## Tests Seven for the map's behaviour — rename to the record it names; two release folders becoming one series; precedence over a provider id and the line naming the disagreement; an id tvdb never answered; a row whose folder is gone; a malformed id refusing the run; a folder named twice refusing the run — plus one that the shipped map parses and never stops a plan. `./tests/run.sh` green, and `scripts/media-shows-tvdb.py` smoke-run against a fixture plan with live tvdb answers (MAPPED / PUNCT / NEAR / NONE each observed; the `[tvdbid-]` folder and the review pile excluded). --- cwd: /home/blank/.omp/wt/tvdb-map · session: 6d1fc1f
dank added 1 commit 2026-10-31 13:10:41 -07:00
Tvdb titles a record in the show's own language and keeps the English name in
aliases the name search never reads, so the rule that accepts only tvdb's own
spelling of a query can never resolve them: ブラッククローバー (331753) holds no
alias at all, and the bare alias "One Piece" belongs to 392276, the 2023 live
action, not to the 1999 record (81797) that 1,072-file pack is. Seventeen pack
folders on the array — 3,507 files — are in that class.

media-shows.py now reads scripts/media-shows-tvdb-ids.tsv by default: one line
per pack folder, folder <TAB> tvdb id <TAB> note, every id read from tvdb's own
record. The map outranks a provider id, because a box set's provider id is the
server's own guess at a folder name, and it merges the release folders that are
one show. Everything it touched goes to the exceptions: every folder it named,
every row that matched no folder, every disagreement with a provider id, every id
tvdb never answered. The file is read fail-closed — an id that is not a number,
or one folder named twice, stops the plan, because a typo there renames a pack of
1,268 files to the wrong show.

scripts/media-shows-tvdb.py is the sheet the map was built from, promoted out of
/tmp so the next run is reproducible: it reads a plan's mkdir rows, asks tvdb
about every destination folder carrying no [tvdbid-], and grades the answer
EXACT / PUNCT / NEAR / NONE by how much was guessed to reach it. Acceptance is
unchanged from the passes it replaces — bare-form equality plus the year-span
guard — and that gate is what rejected three confident picks: Fairy Tail's 2024
sequel (410031), the 2026 Hokuto no Ken remake (465216) and Mugyutto! Black
Clover (378762) offered for Black Clover. The sheet is for the operator; the map
is what the planner reads, and only after he approves the rows.

Tests: seven for the map's behaviour — rename to the record it names, two release
folders becoming one series, precedence over a provider id and the line stating
the disagreement, an id tvdb never answered, a row whose folder is gone, a
malformed id refusing the run, a folder named twice refusing the run — plus one
that the shipped file parses and never stops a plan.
dank merged commit 9c25b1cccb into main 2026-10-31 13:15:38 -07:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: dank/serverAppConfigs#106