Video auto-wishlist: store the show poster too (last field the manual add had)
Field-by-field against the working manual 'add to wishlist', the automation now matches it on every column EXCEPT the show poster: the get-modal stores poster_url = '/api/video/poster/show/<library_id>', the automation stored None — so the wishlist orb fell back to the show's initials and read as 'not matched'. Carry the same proxy path. With library_id (last commit) + poster_url (this) + the tmdb_season stills/overviews, an auto-added row is now identical to a manual one.
This commit is contained in:
parent
94e06f2d50
commit
c35f56bffa
2 changed files with 20 additions and 9 deletions
|
|
@ -28,14 +28,22 @@ def _default_fetch_airing(today: str) -> List[Dict[str, Any]]:
|
|||
|
||||
|
||||
def _default_add_episodes(show_tmdb_id: Any, show_title: Any, episodes: List[Dict[str, Any]],
|
||||
library_id: Any = None) -> int:
|
||||
library_id: Any = None, poster_url: Any = None) -> int:
|
||||
from api.video import get_video_db
|
||||
from core.video.sources import resolve_video_server
|
||||
return get_video_db().add_episodes_to_wishlist(
|
||||
show_tmdb_id, show_title, episodes, library_id=library_id,
|
||||
show_tmdb_id, show_title, episodes, poster_url=poster_url, library_id=library_id,
|
||||
server_source=resolve_video_server())
|
||||
|
||||
|
||||
def _show_poster_url(library_id: Any) -> Optional[str]:
|
||||
"""The SAME poster a manual add stores for a library show — the show poster proxy
|
||||
path the wishlist orb renders directly. Mirrors the get-modal's
|
||||
pUrl = '/api/video/poster/show/<library_id>'. Without it the orb falls back to the
|
||||
show's initials, reading as 'not matched'."""
|
||||
return ('/api/video/poster/show/%s' % library_id) if library_id is not None else None
|
||||
|
||||
|
||||
def _default_season_meta(tmdb_id: Any, season_number: Any):
|
||||
"""The SAME TMDB season fetch the show modal uses for a manual add — so auto-added
|
||||
episodes carry identical stills / overviews / season posters, not the patchy values
|
||||
|
|
@ -114,7 +122,8 @@ def auto_video_add_airing_episodes(
|
|||
|
||||
added = 0
|
||||
for (tid, title), grp in by_show.items():
|
||||
added += int(add_episodes(tid, title, grp['eps'], grp['library_id']) or 0)
|
||||
added += int(add_episodes(tid, title, grp['eps'], grp['library_id'],
|
||||
_show_poster_url(grp['library_id'])) or 0)
|
||||
shows = len(by_show)
|
||||
|
||||
deps.update_progress(
|
||||
|
|
|
|||
|
|
@ -29,8 +29,8 @@ def test_adds_unowned_airings_grouped_by_show():
|
|||
]
|
||||
added = []
|
||||
|
||||
def add(tid, title, eps, library_id=None):
|
||||
added.append((tid, title, len(eps), library_id))
|
||||
def add(tid, title, eps, library_id=None, poster_url=None):
|
||||
added.append((tid, title, len(eps), library_id, poster_url))
|
||||
return len(eps)
|
||||
|
||||
res = auto_video_add_airing_episodes(
|
||||
|
|
@ -41,8 +41,10 @@ def test_adds_unowned_airings_grouped_by_show():
|
|||
assert res["status"] == "completed"
|
||||
assert res["episodes_added"] == 3 # 2 of Widows Bay + 1 of Another Show
|
||||
assert res["shows"] == 2
|
||||
# the show's library_id (show_id) is carried so the wishlist can match the show
|
||||
assert (1, "Widows Bay", 2, 100) in added and (2, "Another Show", 1, 200) in added
|
||||
# the show's library_id (show_id) + poster proxy are carried so the wishlist
|
||||
# matches the show and the orb renders the show poster (like a manual add)
|
||||
assert (1, "Widows Bay", 2, 100, "/api/video/poster/show/100") in added
|
||||
assert (2, "Another Show", 1, 200, "/api/video/poster/show/200") in added
|
||||
|
||||
|
||||
def test_uses_tmdb_season_metadata_like_a_manual_add():
|
||||
|
|
@ -60,7 +62,7 @@ def test_uses_tmdb_season_metadata_like_a_manual_add():
|
|||
|
||||
captured = {}
|
||||
|
||||
def add(tid, title, eps, library_id=None):
|
||||
def add(tid, title, eps, library_id=None, poster_url=None):
|
||||
captured["eps"] = eps
|
||||
return len(eps)
|
||||
|
||||
|
|
@ -79,7 +81,7 @@ def test_falls_back_to_db_values_when_tmdb_unavailable():
|
|||
"has_file": False, "overview": "db synopsis", "still_url": "/library/metadata/9/thumb/1"}]
|
||||
captured = {}
|
||||
|
||||
def add(tid, title, eps, library_id=None):
|
||||
def add(tid, title, eps, library_id=None, poster_url=None):
|
||||
captured["eps"] = eps
|
||||
return len(eps)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue