From 9eecd6d2c4f9ec2fde43b0601127c15473ec8aec Mon Sep 17 00:00:00 2001 From: BoulderBadgeDad Date: Sun, 14 Jun 2026 10:20:27 -0700 Subject: [PATCH] video Library: fix singular/plural kind bug (no posters + 'eps' on movies) load() passed the plural API kind (movies/shows) to the card renderer + poster URL, which expect the singular (movie/show). Result: movie cards fell into the 'shows' branch (bogus '0/0 eps') and poster URLs were /api/video/poster/movies/.. -> 404 -> no images on either tab. Now apiKind (plural) is used for the query and cardKind (singular) for cards + poster proxy. --- tests/test_video_side_shell.py | 2 ++ webui/static/video/video-library.js | 11 ++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/test_video_side_shell.py b/tests/test_video_side_shell.py index 70a530f2..c18ec8f8 100644 --- a/tests/test_video_side_shell.py +++ b/tests/test_video_side_shell.py @@ -158,6 +158,8 @@ def test_video_library_module_referenced_and_isolated(): assert stripped.startswith("/*") or stripped.startswith("(function") assert "(function" in _LIB_JS and "})();" in _LIB_JS assert "soulsync:video-page-shown" in _LIB_JS # decoupled via the event + # Cards/poster URLs use the SINGULAR kind (movie/show); the API uses plural. + assert "cardKind" in _LIB_JS and "apiKind" in _LIB_JS assert "addEventListener" in _LIB_JS assert "window." not in _LIB_JS diff --git a/webui/static/video/video-library.js b/webui/static/video/video-library.js index a7a20994..db1e3659 100644 --- a/webui/static/video/video-library.js +++ b/webui/static/video/video-library.js @@ -118,20 +118,21 @@ function load() { state.loaded = true; showLoading(true); - var kind = state.tab === 'movies' ? 'movies' : 'shows'; + var apiKind = state.tab === 'movies' ? 'movies' : 'shows'; // query param (plural) + var cardKind = state.tab === 'movies' ? 'movie' : 'show'; // card + poster URL (singular) var params = new URLSearchParams({ - kind: kind, search: state.search, letter: state.letter, sort: state.sort, + kind: apiKind, search: state.search, letter: state.letter, sort: state.sort, status: state.status, page: state.page, limit: state.limit }); fetch(LIBRARY_URL + '?' + params.toString(), { headers: { 'Accept': 'application/json' } }) .then(function (r) { return r.ok ? r.json() : null; }) .then(function (d) { showLoading(false); - if (!d || d.error) { renderItems([], kind); updatePagination(null); setCount(0); return; } - renderItems(d.items || [], kind); + if (!d || d.error) { renderItems([], cardKind); updatePagination(null); setCount(0); return; } + renderItems(d.items || [], cardKind); updatePagination(d.pagination); setCount(d.pagination ? d.pagination.total_count : 0); }) - .catch(function () { showLoading(false); renderItems([], kind); updatePagination(null); setCount(0); }); + .catch(function () { showLoading(false); renderItems([], cardKind); updatePagination(null); setCount(0); }); } function reload() { state.page = 1; load(); }