From 8002f9322068d2d60b399f8e78a4c6bb5fe52faa Mon Sep 17 00:00:00 2001 From: BoulderBadgeDad Date: Sun, 14 Jun 2026 21:02:35 -0700 Subject: [PATCH] video: include season id in show_detail (fix /poster/season/undefined 404) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit show_detail's season payload omitted the season id, so the frontend built /api/video/poster/season/undefined and 404'd — season posters never showed even once cached. Add the id; harden seasonArt to fall back to the show poster if id is ever missing. Test pins that seasons carry an int id. --- database/video_database.py | 1 + tests/test_video_database.py | 1 + webui/static/video/video-detail.js | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/database/video_database.py b/database/video_database.py index 785b00fa..03c14725 100644 --- a/database/video_database.py +++ b/database/video_database.py @@ -848,6 +848,7 @@ class VideoDatabase: owned = sum(1 for e in ep_list if e["owned"]) meta = season_meta.get(num) out_seasons.append({ + "id": meta["id"] if meta else None, # needed for the season poster proxy "season_number": num, "title": (meta["title"] if meta else None) or ( "Specials" if num == 0 else "Season %d" % num), diff --git a/tests/test_video_database.py b/tests/test_video_database.py index e5d774cc..9b974e07 100644 --- a/tests/test_video_database.py +++ b/tests/test_video_database.py @@ -265,6 +265,7 @@ def test_show_detail_builds_season_episode_tree_with_rollups(db): assert d["seasons"][0]["title"] == "Specials" s1 = d["seasons"][1] assert s1["title"] == "Season One" + assert isinstance(s1["id"], int) # season id present for the poster proxy assert (s1["episode_total"], s1["episode_owned"]) == (2, 1) assert s1["episodes"][0]["owned"] is True and s1["episodes"][1]["owned"] is False diff --git a/webui/static/video/video-detail.js b/webui/static/video/video-detail.js index fdddbba7..95d8b87f 100644 --- a/webui/static/video/video-detail.js +++ b/webui/static/video/video-detail.js @@ -58,7 +58,7 @@ return null; } function seasonArt(s) { - return s.has_poster ? '/api/video/poster/season/' + s.id + return (s.has_poster && s.id != null) ? '/api/video/poster/season/' + s.id : (data && data.has_poster ? '/api/video/poster/show/' + data.id : ''); } function pct(s) { return s.episode_total ? Math.round(s.episode_owned / s.episode_total * 100) : 0; }