feat(plex): TV-show metadata sync + series filters (Phase 1 of series view)
Give TV shows the same filterable metadata as movies so the TV grid can be filtered/sorted, not just library+sort. Backend: migration 0052 adds rating/content_rating/studio/originally_available_at/genres/directors/cast_names/ people_text to plex_shows (+ GIN/indexes, people_text folded into search_vector); _sync_shows populates them cheaply from the show section listing (no per-item calls). /browse show-branch gains the movie filter set (minus duration) plus an aggregate per-user watch-state (a show rolls up its episodes: all watched=watched, any progress=in_progress, none=new) with year/rating/release sorts; /facets returns show facets. Frontend: PlexSidebar renders the metadata filters + watch-state for TV libraries (duration stays movie-only); show cards show a watched/in-progress badge. i18n plex.inProgress (en/hu/de). Needs a Plex re-sync to populate the new columns.
This commit is contained in:
parent
f0bab315ad
commit
569d31235d
9 changed files with 266 additions and 52 deletions
|
|
@ -230,6 +230,16 @@ def _sync_shows(db: Session, plex: PlexClient, lib: PlexLibrary, stats: dict) ->
|
|||
sh.art_key = meta.get("art")
|
||||
sh.child_count = meta.get("childCount")
|
||||
sh.added_at = _epoch(meta.get("addedAt"))
|
||||
# Filterable / orderable metadata — same cheap section-listing tags as movies.
|
||||
sh.rating = _rating(meta)
|
||||
sh.content_rating = (meta.get("contentRating") or None)
|
||||
sh.studio = (meta.get("studio") or None) and str(meta.get("studio"))[:255]
|
||||
sh.originally_available_at = _date(meta.get("originallyAvailableAt"))
|
||||
sh.genres = _tags(meta, "Genre")
|
||||
sh.directors = _tags(meta, "Director")
|
||||
sh.cast_names = _tags(meta, "Role", limit=20)
|
||||
people = list(dict.fromkeys((sh.directors or []) + (sh.cast_names or [])))
|
||||
sh.people_text = " ".join(people) or None
|
||||
stats["shows"] += 1
|
||||
db.flush()
|
||||
show_id = {rk: sh.id for rk, sh in shows.items()}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue