feat(media): the folder carries its tvdb id; specials and year-seasons resolve #105

Merged
dank merged 2 commits from feat/shows-ids-and-specials into main 2026-10-31 12:56:35 -07:00
Owner

Three defects in the TVShows planner, all three visible in the pass that is already applied on the array, plus the rule that keeps a tvdb title from being confidently wrong.

What changes

  • The series folder carries its tvdb id. <Series> (<year>) [tvdbid-NNNN]/Season NN/<Series> (<year>) - SxxEyy - <Title>.ext. Jellyfin's Tvdb agent and Plex's scanner both read the bracketed id, so a show whose title is ambiguous resolves by number instead of by whoever opens the folder guessing which one it is. The id rides the FOLDER only: a file name gets 180 characters and the episode title needs the room.
  • Season 00 is a legal season. 1,412 files parked in the last plan because their provider row said season 0; specials live in Season 00 by Jellyfin's own contract.
  • A season that is a YEAR is the date matcher, not a season. Jellyfin files specials by airdate and writes the year into the season column, so 1,033 files parked. Such a row is now renumbered by the title tvdb states for the series' id, read backwards off its own episode list. A title tvdb gives to two episodes names no episode, and that file parks with the reason it always carried.
  • A season tvdb's own episode list contradicts gets no title. The anime numbering hazard: a pack numbered by its release group books S05E01 in a season tvdb does not hold, or books more episodes there than tvdb lists — the slot its number points at is a different episode. The file still renames; the title does not ride, and the series is listed under seasons whose numbering tvdb contradicts in the exceptions file.

Evidence

  • tests/media_shows.bats: six tests, five red before the change (the ambiguous-title case is the guard that the recovery must never guess). Fixture needed one new helper: file PATH SIZE, which registers a mid-test file in the enum census the planner reads — at alone leaves it invisible.
  • :bats tests/media_shows.bats 32/32, including the re-plan idempotence test (id-bearing folders re-plan to themselves); full ./tests/run.sh 766/766.
  • Docs: serverAppConfigs-docs/Dankserver/Media Relayout.md carries the new shape, the year-as-season law and the contradiction law.

Follow-ups, not in this PR

  • The TVShows plan must be regenerated to pick the ids up: it needs fresh census TSVs and the --tvdb credential, and ~/.config/secrets/tvdb does not exist on dankserver (only on the workstation). Until it is there, folders keep the names the previous pass gave them and no id is attached.
  • The 179 unresolved folders (9,931 files) still wait on the TVDB id map from #102; the planner now has somewhere to put the answer.


cwd: /home/blank/.omp/wt/wt-20261030-163847-6d1fc1f · session: 01a18f2e-18b1-7573-bcd5-ac99636f8bcb
(build worktree: /home/blank/.omp/wt/shows-ids, branch feat/shows-ids-and-specials)

Three defects in the TVShows planner, all three visible in the pass that is already applied on the array, plus the rule that keeps a tvdb title from being confidently wrong. ## What changes - **The series folder carries its tvdb id.** `<Series> (<year>) [tvdbid-NNNN]/Season NN/<Series> (<year>) - SxxEyy - <Title>.ext`. Jellyfin's Tvdb agent and Plex's scanner both read the bracketed id, so a show whose title is ambiguous resolves by number instead of by whoever opens the folder guessing which one it is. The id rides the FOLDER only: a file name gets 180 characters and the episode title needs the room. - **`Season 00` is a legal season.** 1,412 files parked in the last plan because their provider row said `season 0`; specials live in Season 00 by Jellyfin's own contract. - **A season that is a YEAR is the date matcher, not a season.** Jellyfin files specials by airdate and writes the year into the season column, so 1,033 files parked. Such a row is now renumbered by the title tvdb states for the series' id, read backwards off its own episode list. A title tvdb gives to two episodes names no episode, and that file parks with the reason it always carried. - **A season tvdb's own episode list contradicts gets no title.** The anime numbering hazard: a pack numbered by its release group books `S05E01` in a season tvdb does not hold, or books more episodes there than tvdb lists — the slot its number points at is a different episode. The file still renames; the title does not ride, and the series is listed under *seasons whose numbering tvdb contradicts* in the exceptions file. ## Evidence - `tests/media_shows.bats`: six tests, five red before the change (the ambiguous-title case is the guard that the recovery must never guess). Fixture needed one new helper: `file PATH SIZE`, which registers a mid-test file in the enum census the planner reads — `at` alone leaves it invisible. - `:bats tests/media_shows.bats` 32/32, including the re-plan idempotence test (id-bearing folders re-plan to themselves); full `./tests/run.sh` 766/766. - Docs: `serverAppConfigs-docs/Dankserver/Media Relayout.md` carries the new shape, the year-as-season law and the contradiction law. ## Follow-ups, not in this PR - The TVShows plan must be regenerated to pick the ids up: it needs fresh census TSVs and the `--tvdb` credential, and `~/.config/secrets/tvdb` does not exist on dankserver (only on the workstation). Until it is there, folders keep the names the previous pass gave them and no id is attached. - The 179 unresolved folders (9,931 files) still wait on the TVDB id map from #102; the planner now has somewhere to put the answer. --- --- cwd: `/home/blank/.omp/wt/wt-20261030-163847-6d1fc1f` · session: `01a18f2e-18b1-7573-bcd5-ac99636f8bcb` (build worktree: `/home/blank/.omp/wt/shows-ids`, branch `feat/shows-ids-and-specials`)
dank added 1 commit 2026-10-31 12:27:37 -07:00
Three defects in the TVShows planner, all three visible in the applied plan:

- A series folder named a show by words alone. Jellyfin's Tvdb agent and
  Plex's scanner both read `[tvdbid-NNNN]`, so the resolved id now rides the
  series folder — and only the folder: a file name gets 180 characters and
  the episode title needs the room.
- 1,412 files parked because their provider row said `season 0`. Season 0 is
  a legal season; Jellyfin's contract is `Season 00` for specials.
- 1,033 files parked because Jellyfin's date matcher writes the AIRDATE YEAR
  into the season column. Such a row is now renumbered by the title tvdb
  states for the series' id, read backwards off its own episode list. A
  title tvdb gives to two episodes names no episode, and that file parks
  with the reason it always carried.

A season tvdb's own episode list CONTRADICTS — a release pack books more
episodes there than the authority holds, the anime numbering hazard — keeps
its rename and loses the tvdb title, because the slot its number points at
is a different episode. Those series are listed in the exceptions file,
which is where the operator reads them.

Tests: six through the fixture (five red before the change; the ambiguous
title is a guard that the recovery must never guess). Full bats suite green.
dank added 1 commit 2026-10-31 12:40:50 -07:00
Tvdb's default episode query answers at most 500 rows and states no total.
One Piece (1999), Crayon Shin-chan (1992) and Detective Conan (1996) each
answer exactly 500 while holding over a thousand, so the contradiction rule
added in the previous commit read every long-running show as contradicted:
the pack books more episodes than "the authority holds", and the rule that
exists to stop a wrong anime title would have stripped the right one from
every file of the season.

A capped list now records that it is capped (`tvdb:capped:<id>`, so a warm
cache answers the same question a cold one did) and contradicts nothing;
titles for the episodes the page does hold still ride.

Test: a 500-row page with a 501-episode pack keeps ` - Episode 1` and lists
no contradiction. Red before the change, proved in a copy of the tree with
the cap raised past the fixture.
dank merged commit 576c3421b8 into main 2026-10-31 12:56:35 -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#105