try to add images
Build and Push Docker Images / build-and-push (push) Successful in 24s

This commit is contained in:
2026-02-11 19:22:10 +01:00
parent 5bb5985af8
commit 6cd421ed69
+15 -1
View File
@@ -78,6 +78,8 @@ TMDB_CACHE_TTL_SEC = 24 * 3600
TMDB_RATE_LIMIT_REQUESTS = 40 TMDB_RATE_LIMIT_REQUESTS = 40
TMDB_RATE_LIMIT_WINDOW_SEC = 10.0 TMDB_RATE_LIMIT_WINDOW_SEC = 10.0
TMDB_CACHE_DIR = DATA_ROOT / "tmdb_cache" TMDB_CACHE_DIR = DATA_ROOT / "tmdb_cache"
TMDB_IMAGE_BASE = "https://image.tmdb.org/t/p"
TMDB_IMAGE_STILL_SIZE = "w500" # episode still width for EPG icon
_tmdb_series_cache: dict[str, tuple[int, str, float]] = {} # programme_name -> (series_id, series_name_nl, ts) _tmdb_series_cache: dict[str, tuple[int, str, float]] = {} # programme_name -> (series_id, series_name_nl, ts)
_tmdb_series_details_cache: dict[int, tuple[dict, float]] = {} # series_id -> ({genres, country}, ts) _tmdb_series_details_cache: dict[int, tuple[dict, float]] = {} # series_id -> ({genres, country}, ts)
_tmdb_episode_cache: dict[tuple[int, int, int], tuple[dict, float]] = {} # (series_id, s, e) -> (meta, ts) _tmdb_episode_cache: dict[tuple[int, int, int], tuple[dict, float]] = {} # (series_id, s, e) -> (meta, ts)
@@ -470,7 +472,10 @@ def _tmdb_get_episode(series_id: int, season: int, episode: int) -> dict | None:
name = (data.get("name") or "").strip() name = (data.get("name") or "").strip()
overview = (data.get("overview") or "").strip() overview = (data.get("overview") or "").strip()
air_date = (data.get("air_date") or "").strip() # YYYY-MM-DD air_date = (data.get("air_date") or "").strip() # YYYY-MM-DD
meta = {"name": name, "overview": overview, "air_date": air_date} still_path = (data.get("still_path") or "").strip()
if still_path and not still_path.startswith("/"):
still_path = "/" + still_path
meta = {"name": name, "overview": overview, "air_date": air_date, "still_path": still_path or None}
_tmdb_episode_cache[key_tuple] = (meta, now) _tmdb_episode_cache[key_tuple] = (meta, now)
_tmdb_write_disk_cache("episode", key, meta) _tmdb_write_disk_cache("episode", key, meta)
return meta return meta
@@ -547,6 +552,12 @@ def get_episode_metadata(programme_name: str, path: Path) -> dict | None:
air_date = ep.get("air_date") or "" air_date = ep.get("air_date") or ""
date_str = _air_date_to_xmltv_date(air_date) or "20090101" # fallback if missing date_str = _air_date_to_xmltv_date(air_date) or "20090101" # fallback if missing
still_path = ep.get("still_path") or ""
if still_path and still_path.startswith("/"):
icon_url = f"{TMDB_IMAGE_BASE}/{TMDB_IMAGE_STILL_SIZE}{still_path}"
else:
icon_url = None
details = _tmdb_get_series_details(series_id) details = _tmdb_get_series_details(series_id)
genres = (details.get("genres") or []) if details else [] genres = (details.get("genres") or []) if details else []
country = (details.get("country") or "") if details else "" country = (details.get("country") or "") if details else ""
@@ -565,6 +576,7 @@ def get_episode_metadata(programme_name: str, path: Path) -> dict | None:
"sub_title": sub_title, "sub_title": sub_title,
"desc": overview, "desc": overview,
"lang": TMDB_LANGUAGE, "lang": TMDB_LANGUAGE,
"icon": icon_url,
"directors": directors, "directors": directors,
"actors": actors, "actors": actors,
"producers": producers, "producers": producers,
@@ -641,6 +653,8 @@ def build_epg_xml() -> str:
ET.SubElement(prog, "sub-title", lang=lang).text = meta["sub_title"] ET.SubElement(prog, "sub-title", lang=lang).text = meta["sub_title"]
if meta.get("desc"): if meta.get("desc"):
ET.SubElement(prog, "desc", lang=lang).text = meta["desc"] ET.SubElement(prog, "desc", lang=lang).text = meta["desc"]
if meta.get("icon"):
ET.SubElement(prog, "icon", attrib={"src": meta["icon"]})
directors = meta.get("directors") or [] directors = meta.get("directors") or []
actors = meta.get("actors") or [] actors = meta.get("actors") or []
producers = meta.get("producers") or [] producers = meta.get("producers") or []