dev: bump to 0.1.87.0-dev Trakt-Untermenue, Weiterschauen-Fixes, Scrobbling zuverlässig
This commit is contained in:
@@ -65,6 +65,8 @@ class TraktItem:
|
||||
episode_thumb: str = "" # Screenshot-URL (extended=images)
|
||||
show_poster: str = "" # Serien-Poster-URL (extended=images)
|
||||
show_fanart: str = "" # Serien-Fanart-URL (extended=images)
|
||||
# Staffel → höchste gesehene Episodennummer (für Staffelwechsel-Erkennung)
|
||||
seasons_watched: dict = field(default_factory=dict)
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
@@ -387,19 +389,26 @@ class TraktClient:
|
||||
seasons = entry.get("seasons") or []
|
||||
last_season = 0
|
||||
last_episode = 0
|
||||
seasons_watched: dict[int, int] = {}
|
||||
for s in seasons:
|
||||
snum = int((s.get("number") or 0))
|
||||
if snum == 0: # Specials überspringen
|
||||
continue
|
||||
max_ep = 0
|
||||
for ep in (s.get("episodes") or []):
|
||||
enum = int((ep.get("number") or 0))
|
||||
if enum > max_ep:
|
||||
max_ep = enum
|
||||
if snum > last_season or (snum == last_season and enum > last_episode):
|
||||
last_season = snum
|
||||
last_episode = enum
|
||||
if max_ep > 0:
|
||||
seasons_watched[snum] = max_ep
|
||||
if title:
|
||||
result.append(TraktItem(
|
||||
title=title, year=year, media_type="episode",
|
||||
ids=ids, season=last_season, episode=last_episode,
|
||||
seasons_watched=seasons_watched,
|
||||
))
|
||||
self._do_log(f"get_watched_shows: {len(result)} Serien")
|
||||
return result
|
||||
@@ -461,6 +470,21 @@ class TraktClient:
|
||||
ids = show.get("ids") or {}
|
||||
return str(ids.get("slug") or ids.get("trakt") or "")
|
||||
|
||||
def search_show_ids(self, query: str) -> "tuple[int, str]":
|
||||
"""GET /search/show?query=... – gibt (tmdb_id, imdb_id) des ersten Treffers zurück.
|
||||
Fallback wenn TMDB keine IDs liefert.
|
||||
"""
|
||||
from urllib.parse import urlencode
|
||||
path = f"/search/show?{urlencode({'query': query, 'limit': 1})}"
|
||||
status, payload = self._get(path)
|
||||
if status != 200 or not isinstance(payload, list) or not payload:
|
||||
return 0, ""
|
||||
show = (payload[0] or {}).get("show") or {}
|
||||
ids = show.get("ids") or {}
|
||||
tmdb_id = int(ids.get("tmdb") or 0)
|
||||
imdb_id = str(ids.get("imdb") or "")
|
||||
return tmdb_id, imdb_id
|
||||
|
||||
def lookup_tv_season(
|
||||
self,
|
||||
show_id_or_slug: "str | int",
|
||||
|
||||
Reference in New Issue
Block a user