feat(plex): a title opens its page, the picture plays; an episode links up
A card title lit like a link but played the item. Now the picture plays and the title opens the page of what it names: a movie's or an episode's info page, a show's page, and for an episode standing as its show (Recently watched) the show. Every poster and episode card carries it (grid, rails, person, collection, season, related, Home), a card with no page keeps a plain title, and the season page gains the menu's Details row too. The episode page had no way up: the detail now serves the show's and the season's rating keys, and on the page the show title opens the show and "S1·E25" the season (Back returns to where the page was).
This commit is contained in:
@@ -504,6 +504,7 @@ def item_detail(
|
||||
|
||||
prev_id, next_id = _episode_nav(db, it)
|
||||
show = db.get(PlexShow, it.show_id) if it.kind == "episode" and it.show_id else None
|
||||
season = db.get(PlexSeason, it.season_id) if show and it.season_id else None
|
||||
return {
|
||||
"id": it.rating_key,
|
||||
"kind": it.kind,
|
||||
@@ -537,6 +538,9 @@ def item_detail(
|
||||
"status": st.status if st else "new",
|
||||
"position_seconds": st.position_seconds if st else 0,
|
||||
"show_title": ((show.title_hu or show.title if hu else show.title) if show else None),
|
||||
# The episode page links up to its show and its season (their rating keys = the view keys).
|
||||
"show_id": show.rating_key if show else None,
|
||||
"season_id": season.rating_key if season else None,
|
||||
"season_number": it.season_number,
|
||||
"episode_number": it.episode_number,
|
||||
"prev_id": prev_id,
|
||||
|
||||
@@ -19,7 +19,7 @@ import app.state as state
|
||||
from app.auth import current_user
|
||||
from app.db import get_db
|
||||
from app.main import app
|
||||
from app.models import PlexItem, PlexLibrary, PlexShow, User
|
||||
from app.models import PlexItem, PlexLibrary, PlexSeason, PlexShow, User
|
||||
from app.plex import detail
|
||||
from app.plex.sync import _apply_facet_fields, _enrich_people_batch
|
||||
|
||||
@@ -276,8 +276,16 @@ def test_item_detail_episode_serves_rich_from_live(db, monkeypatch, override_dep
|
||||
show = PlexShow(rating_key="s1", library_id=lib.id, title="A Show")
|
||||
db.add(show)
|
||||
db.flush()
|
||||
season = PlexSeason(rating_key="se1", show_id=show.id, season_number=1)
|
||||
db.add(season)
|
||||
db.flush()
|
||||
ep = PlexItem(
|
||||
rating_key="e1", library_id=lib.id, kind="episode", title="Pilot", show_id=show.id
|
||||
rating_key="e1",
|
||||
library_id=lib.id,
|
||||
kind="episode",
|
||||
title="Pilot",
|
||||
show_id=show.id,
|
||||
season_id=season.id,
|
||||
)
|
||||
db.add(ep)
|
||||
db.commit()
|
||||
@@ -289,6 +297,8 @@ def test_item_detail_episode_serves_rich_from_live(db, monkeypatch, override_dep
|
||||
assert resp.status_code == 200, resp.text
|
||||
body = resp.json()
|
||||
assert body["imdb_id"] == "tt0068646" # from the live meta, not the (NULL) row
|
||||
# The page's links up to the show and the season.
|
||||
assert (body["show_id"], body["season_id"]) == ("s1", "se1")
|
||||
assert [c["name"] for c in body["cast"]] == ["Marlon Brando", "Al Pacino"]
|
||||
db.refresh(ep)
|
||||
assert ep.full_cast is None # episodes are not persisted/enriched
|
||||
|
||||
Reference in New Issue
Block a user