The code cited its plan instead of saying why: `E28 review J4`, `(R6 S3b)`, `S1 justified…`,
`deep-review round 5`. That plan lives in the private ops repo, so for every reader of this one the
citation was noise, and a sentence whose subject was the plan step ("round 2 showed…") hid its
lesson behind an id. Each one is gone and the "why" kept: a bare citation is deleted, a sentence
carrying a lesson is reworded around it ("a later attempt showed…").
Measured (`scripts/audit_metrics.py`, product code): 652 lines in 270 files carried an epic code by
the definition the next commit holds (507 / 241 by the old, two-digit-only one) -> 0. Across all
code, tests, scripts and configs: ~1100 epic-code lines plus ~320 sprint/round ids.
Behaviour unchanged, checked mechanically: every changed .py file has the same AST once docstrings
are blanked; css/sh/toml/yml/json files are identical once comments are stripped; the only
non-comment changes in TS/JS are test titles, one description string in a contract table, and five
ESLint messages, whose text is all the gates snapshot diff holds. Not touched: Markdown (docs and
the changelog keep their history), Alembic migrations, TV episode notation (`S2 · E5`), DESIGN.md
ids (`C1`, `B4`, `S3h`), tracker ids (`SEC-16`, `DX-17`).
One stale claim fixed on the way: test_hls_reaper's docstring said the player checkpoints "every
10 s whether or not it is playing", which plex/stream.py calls wrong; it now says what the code does.
101 lines
3.5 KiB
Python
101 lines
3.5 KiB
Python
"""One Hungarian word per Plex genre.
|
|
|
|
Plex's Hungarian agent returns a MIXED vocabulary: some genres come back translated ("Dráma",
|
|
"Vígjáték"), others stay English ("Action", "Adventure", "Biography"), and a title with no HU twin has
|
|
only its English genres. The HU genre list therefore offered "Drama" beside "Dráma" and a dozen English
|
|
words. This map sends every genre word we have met — English (Plex EN agent, TMDB, IMDb) or Plex's
|
|
Hungarian — to the ONE word a Hungarian reader sees. The overlay sync writes it into `genres_hu`, and a
|
|
genre filter is read through it too, so a saved filter still holding "Action" keeps matching "Akció".
|
|
|
|
A word not in the map passes through unchanged: an unknown genre stays visible (in whatever language
|
|
Plex gave it) rather than disappearing.
|
|
"""
|
|
|
|
from collections.abc import Iterable
|
|
|
|
# Keys are matched case-insensitively (see `_BY_KEY`). The Hungarian values double as keys mapping to
|
|
# themselves, so running a list through twice changes nothing.
|
|
_HU: dict[str, str] = {
|
|
"Action": "Akció",
|
|
"Action & Adventure": "Akció és kaland",
|
|
"Adventure": "Kaland",
|
|
"Animation": "Animációs",
|
|
"Anime": "Anime",
|
|
"Biography": "Életrajzi",
|
|
"Children": "Gyerek",
|
|
"Comedy": "Vígjáték",
|
|
"Crime": "Bűnügyi",
|
|
"Documentary": "Dokumentum",
|
|
"Drama": "Dráma",
|
|
"Family": "Családi",
|
|
"Fantasy": "Fantasy",
|
|
"Film-Noir": "Film noir",
|
|
"Food": "Gasztronómia",
|
|
"Game Show": "Vetélkedő",
|
|
"Game-Show": "Vetélkedő",
|
|
"History": "Történelmi",
|
|
"Home and Garden": "Otthon és kert",
|
|
"Horror": "Horror",
|
|
"Indie": "Független",
|
|
"Kids": "Gyerek",
|
|
"Martial Arts": "Harcművészet",
|
|
"Mini-Series": "Minisorozat",
|
|
"Music": "Zenei",
|
|
"Musical": "Musical",
|
|
"Mystery": "Rejtély",
|
|
"News": "Hírek",
|
|
"Reality": "Valóságshow",
|
|
"Reality-TV": "Valóságshow",
|
|
"Romance": "Romantikus",
|
|
"Sci-Fi": "Sci-Fi",
|
|
"Sci-Fi & Fantasy": "Sci-Fi és fantasy",
|
|
"Science Fiction": "Sci-Fi",
|
|
"Short": "Rövidfilm",
|
|
"Soap": "Szappanopera",
|
|
"Sport": "Sport",
|
|
"Suspense": "Feszültség",
|
|
"Talk": "Talkshow",
|
|
"Talk Show": "Talkshow",
|
|
"Thriller": "Thriller",
|
|
"Travel": "Utazás",
|
|
"TV Movie": "TV film",
|
|
"War": "Háborús",
|
|
"War & Politics": "Háború és politika",
|
|
"Western": "Western",
|
|
# Plex's own Hungarian words, pinned to themselves (and to the spelling above where they differ).
|
|
"Akció": "Akció",
|
|
"Animációs": "Animációs",
|
|
"Bűnügyi": "Bűnügyi",
|
|
"Családi": "Családi",
|
|
"Dokumentum": "Dokumentum",
|
|
"Dokumentumfilm": "Dokumentum",
|
|
"Dráma": "Dráma",
|
|
"Életrajzi": "Életrajzi",
|
|
"Háborús": "Háborús",
|
|
"Kaland": "Kaland",
|
|
"Rejtély": "Rejtély",
|
|
"Romantikus": "Romantikus",
|
|
"Történelmi": "Történelmi",
|
|
"TV film": "TV film",
|
|
"Vígjáték": "Vígjáték",
|
|
"Zene": "Zenei",
|
|
"Zenei": "Zenei",
|
|
}
|
|
_BY_KEY = {k.casefold(): v for k, v in _HU.items()}
|
|
|
|
|
|
def hu_genre(word: str) -> str:
|
|
"""The Hungarian word for one genre; an unknown word comes back unchanged."""
|
|
return _BY_KEY.get(word.strip().casefold(), word)
|
|
|
|
|
|
def hu_genres(words: Iterable[str] | None) -> list[str] | None:
|
|
"""A genre list in Hungarian, in its first-seen order, each word once ("Drama" + "Dráma" → one
|
|
"Dráma"). None or empty stays None, like the listing's own `_tags`."""
|
|
out: list[str] = []
|
|
for w in words or ():
|
|
hu = hu_genre(w)
|
|
if hu not in out:
|
|
out.append(hu)
|
|
return out or None
|