Add edit dialogs, library organizer, and TMDb pool migration

This commit is contained in:
2026-09-08 07:37:40 +02:00
parent 39712d7283
commit 79c9e34a5d
10 changed files with 1371 additions and 110 deletions
+99 -13
View File
@@ -169,33 +169,119 @@ movie table, and one-click Filmotéka generation.
Curator is being refocused from a ČSFD-tagging tool into a **Jellyfin-first
library manager**. Agreed shape:
- **Pool = the single Jellyfin library** (merged; no separate output library).
Files are named `Title (rok) [tmdbid-N].ext` — the form Jellyfin matches on.
Libraries (Filmy/Kids/Dokumenty/Anime/Seriály) are physical partitions.
- **Pool = the Jellyfin library set.** Files are named `Title (rok) [tmdbid-N].ext`
— the form Jellyfin matches on. Libraries are physical top-level pool folders,
each with a **kind** (`libraries` setting; managed in *Pool → Knihovny…*):
- `movie` — single-file movies, TMDb naming (done)
- `series` — series/season/episode tree, mirrored 1:1 (done)
- `mixed` — movies **and** series in one folder (Jellyfin "Mixed" type;
supported-but-discouraged by Jellyfin, but low-risk here thanks to the strict
structure, and fully reversible — see decisions). **Scanning TBD (phase 9).**
- `homevideo` — files with no TMDb (Jellyfin "Home videos" type). **TBD (ph. 8).**
- **Target library layout (the user's plan):** `Hlavní` (mixed, incl. kids),
`Dokumenty` (mixed, mostly no-TMDb YT series), `Anime` (series), `Chajda`
(homevideo). Kids are **not** a separate folder — see decisions.
- **Naming convention:**
- Movie: `{CZ název} (rok) [tmdbid-N].ext` — the exact Jellyfin form.
- Series: `{název série} (rok) [tmdbid]/Season NN/S{ss}E{ee} - {filename}.ext`
(season 0 → `Specials`); the episode keeps its original filename after the
`SxxEyy` code. Episode numbers are recognised from the filename; editable in
the series GUI.
- **CZ title source:** TMDb (cs-CZ) **primarily** — reliable when matched by
`tmdbid` (yearless title search picks the wrong film, hence the earlier
"weird names"); **ČSFD as fallback/override** (a ČSFD link at import, or when
TMDb has no cs title); last fallback = the original filename. The filename is
always editable in the GUI.
- **Metadata is Jellyfin's job**: Jellyfin fetches from TMDb and (configured to)
writes `.nfo` + artwork into the folders → survives a Jellyfin reinstall.
Curator only resolves a **TMDb id → title + year** for naming (`tmdb.py`);
ČSFD is dropped (it exposes no TMDb/IMDb id anyway — verified).
Curator resolves a **TMDb id → title + year** for naming (`tmdb.py`). ČSFD is
kept **only** as an optional CZ-title source for the filename (not for tags/
matching — it exposes no TMDb/IMDb id, verified).
- **Import:** mandatory **TMDb id** (matching + CZ title), optional **ČSFD link**
(CZ-title source/override); filename hand-editable before/after import.
- **miniDLNA**: keep a genre-split **hardlink tree** for a dumb DLNA browser,
but drive it from the **NFO** Jellyfin wrote (repurposing `HardlinkManager` +
`naming.py`), not from ČSFD tags.
- **Jellyfin API** (thin, hybrid): trigger scans, verify, manage collections;
key + URL in `.env`. NFO on disk stays authoritative.
Phasing: (1) TMDb identity + tmdbid naming + import rework [done]; (2) movie
libraries as physical partitions + import-into / move-between [done]; (3) Jellyfin
API — scan + verify + status [done]; (4) miniDLNA genre tree from NFO + ČSFD
removed [done]; (5) series model — SxxEyy layout, import, rename [done];
(6) migrate the existing 589 movies (title+year → TMDb search). Note: libraries hold **flat** files for now
(`pool/<Library>/Title (rok) [tmdbid].ext`); per-movie folders are a later
refinement.
### Decisions (locked)
- **Kids = Jellyfin parental rating, not a folder** (variant B). Kids content
stays in the normal libraries; a child Jellyfin account gets a max-rating limit
with **"block unrated" ON**. Ratings come from TMDb via Jellyfin. Caveat: Czech
certifications are sparse — set the library metadata country to one with fuller
ratings (US) and fix odd cases in Jellyfin (Identify + lock).
- **Mixed libraries are OK and reversible.** Jellyfin discourages them (unreliable
metadata) but our disciplined structure (series = `Season/SxxEyy`, movie =
single file + `[tmdbid]`) gives the scanner clear signals. Because metadata is
**NFO on disk** + **tmdbid in the name**, switching mixed↔separate later is just
moving folders (Jellyfin re-reads NFO, no re-fetch, no loss).
- **Home videos** (Chajda) use Jellyfin's **"Home videos"** content type — no
online lookup, just serves the files.
- **Always match by tmdbid, not by yearless title.** TMDb cs-CZ titles are good
when the right film is matched (lookup by id, or search with a year); a bare
title search trips on remakes/same-name films (verified: Home Alone → 2021
reboot, Vejška → 2006). Import supplies the id; migration searches with a year.
### Phasing
(1) TMDb identity + tmdbid naming + import rework [done]; (2) movie libraries as
physical partitions + import-into / move-between [done]; (3) Jellyfin API — scan +
verify + status [done]; (4) miniDLNA genre tree from NFO + ČSFD removed [done];
(5) series model — SxxEyy layout, import, rename [done]; (6) migrate the existing
pool — title+year → TMDb search → tmdbid [done]; (7) consolidated edit dialogs +
library organizer (unified `libraries` model with kinds) [done].
Remaining: **(8) import without TMDb/year** (homevideo, no-TMDb docs);
**(9) mixed-library scanning + generation** (movies + series in one folder).
Note: libraries hold **flat** files for now (`pool/<Library>/Title (rok)
[tmdbid].ext`); per-movie folders are a later refinement.
## Tasks
# (no open tasks — see Done)
### Phase 8 — import without TMDb / without year (homevideo, no-TMDb docs)
- Relax the import dialog: allow a row with **no year and no tmdbid** (currently
a 4-digit year is mandatory). Pool name then falls back to `Title.ext`
(movies) / `Series/Season NN/SxxEyy.ext` (series), no `[tmdbid]`.
- Drive this by **library kind**: `homevideo` (and no-TMDb rows in `mixed`)
skip the TMDb requirement; `movie` keeps requiring a year (as today).
- `homevideo` library scanning: load its files as items (flat), no TMDb naming,
no genre tags. Consider a dedicated import path or a per-import "bez TMDb" toggle.
- Tests: import with no year/id lands correctly; homevideo library loads.
### Phase 9 — mixed-library scanning + generation
- Scan a `mixed` library by structure: a top-level **single video file = movie**;
a subfolder containing `Season NN/` (or `SxxEyy` files) = **series**. Reuse
`series.scan_series` for the series part and the flat movie scan for the rest.
- `load_pool_movies` / `load_series` become **kind-aware** (iterate `libraries`,
dispatch by kind); today they read `movie_libraries` / `copyasis_folders`.
- miniDLNA generation + NFO refresh must cover mixed libraries too.
- The library filter / table should surface mixed libraries once loadable.
- Tests: a mixed folder with both a movie and a series loads/generates correctly.
### Later / optional
- **ČSFD CZ-title fetch (deferred).** Live test showed TMDb cs-CZ titles are good
when matched by tmdbid, so ČSFD title-fetch was **not** rebuilt (would need the
Anubis PoW solver removed in phase 4). If TMDb gets a title wrong, edit the
filename in the GUI. The ČSFD **link** is already stored per movie
(`File.csfd_url`, set at import / in the edit dialog) as a pointer for later —
revisit fetching only if TMDb proves insufficient in practice.
- Per-movie folders (`pool/<Lib>/Title (rok) [tmdbid]/…`) instead of flat files.
- Collections / BoxSets (Bond, Marvel) via Jellyfin API or `<set>` in NFO.
- Optional common umbrella folder above libraries (`pool/Média/<Lib>`) — needs
path-aware `library_of` (currently single-segment).
## Done
- Jellyfin pivot phases 1–7 (see Phasing): TMDb identity, tmdbid naming, movie
libraries + move, Jellyfin API (scan/verify), NFO-driven miniDLNA + ČSFD
removed, series model (SxxEyy), pool→TMDb migration, consolidated edit dialogs
- Library organizer (`libraries` unified model with kinds movie/series/mixed/
homevideo; *Pool → Knihovny…*); `movie_libraries`/`copyasis_folders` derived
- Pool naming convention `Title (YYYY).ext` (`naming.py`): year required at
import (per-row Rok field, blue = ČSFD-suggested, red = pool collision), plus
"Přejmenovat dle ČSFD (rok)" to bring older files up to the convention