Add TMDB master toggle and filter upcoming episodes
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<addon id="plugin.video.viewit" name="ViewIt" version="0.1.46" provider-name="ViewIt">
|
||||
<addon id="plugin.video.viewit" name="ViewIt" version="0.1.47" provider-name="ViewIt">
|
||||
<requires>
|
||||
<import addon="xbmc.python" version="3.0.0" />
|
||||
<import addon="script.module.requests" />
|
||||
|
||||
@@ -113,6 +113,10 @@ def _tmdb_prefetch_concurrency() -> int:
|
||||
return max(1, min(20, value))
|
||||
|
||||
|
||||
def _tmdb_enabled() -> bool:
|
||||
return _get_setting_bool("tmdb_enabled", default=True)
|
||||
|
||||
|
||||
def _log(message: str, level: int = xbmc.LOGINFO) -> None:
|
||||
xbmc.log(f"[ViewIt] {message}", level)
|
||||
|
||||
@@ -548,6 +552,8 @@ def _tmdb_file_log(message: str) -> None:
|
||||
|
||||
|
||||
def _tmdb_labels_and_art(title: str) -> tuple[dict[str, str], dict[str, str], list[TmdbCastMember]]:
|
||||
if not _tmdb_enabled():
|
||||
return {}, {}, []
|
||||
title_key = (title or "").strip().casefold()
|
||||
language = _get_setting_string("tmdb_language").strip() or "de-DE"
|
||||
show_plot = _get_setting_bool("tmdb_show_plot", default=True)
|
||||
@@ -686,10 +692,14 @@ async def _tmdb_labels_and_art_bulk_async(
|
||||
def _tmdb_labels_and_art_bulk(
|
||||
titles: list[str],
|
||||
) -> dict[str, tuple[dict[str, str], dict[str, str], list[TmdbCastMember]]]:
|
||||
if not _tmdb_enabled():
|
||||
return {}
|
||||
return _run_async(_tmdb_labels_and_art_bulk_async(titles))
|
||||
|
||||
|
||||
def _tmdb_episode_labels_and_art(*, title: str, season_label: str, episode_label: str) -> tuple[dict[str, str], dict[str, str]]:
|
||||
if not _tmdb_enabled():
|
||||
return {"title": episode_label}, {}
|
||||
title_key = (title or "").strip().casefold()
|
||||
tmdb_id = _TMDB_ID_CACHE.get(title_key)
|
||||
if not tmdb_id:
|
||||
@@ -748,6 +758,8 @@ def _tmdb_episode_labels_and_art(*, title: str, season_label: str, episode_label
|
||||
|
||||
|
||||
def _tmdb_episode_cast(*, title: str, season_label: str, episode_label: str) -> list[TmdbCastMember]:
|
||||
if not _tmdb_enabled():
|
||||
return []
|
||||
show_episode_cast = _get_setting_bool("tmdb_show_episode_cast", default=False)
|
||||
if not show_episode_cast:
|
||||
return []
|
||||
|
||||
@@ -175,6 +175,23 @@ def _is_episode_tba(title: str, original_title: str) -> bool:
|
||||
return any(marker in combined for marker in markers)
|
||||
|
||||
|
||||
def _row_is_upcoming(row: BeautifulSoupT) -> bool:
|
||||
classes = row.get("class") or []
|
||||
if isinstance(classes, str):
|
||||
classes = classes.split()
|
||||
if "upcoming" in classes:
|
||||
return True
|
||||
badge = row.select_one(".badge-upcoming")
|
||||
if badge and (badge.get_text(" ", strip=True) or "").strip():
|
||||
return True
|
||||
watch_cell = row.select_one(".episode-watch-cell")
|
||||
if watch_cell:
|
||||
text = watch_cell.get_text(" ", strip=True).casefold()
|
||||
if "tba" in text:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def _get_setting_bool(setting_id: str, *, default: bool = False) -> bool:
|
||||
return get_setting_bool(ADDON_ID, setting_id, default=default)
|
||||
|
||||
@@ -409,6 +426,8 @@ def _extract_episodes(soup: BeautifulSoupT) -> List[EpisodeInfo]:
|
||||
# Neues Layout (Stand: 2026-01): Episoden-Tabelle mit Zeilen und onclick-URL.
|
||||
rows = soup.select("table.episode-table tbody tr.episode-row")
|
||||
for index, row in enumerate(rows):
|
||||
if _row_is_upcoming(row):
|
||||
continue
|
||||
onclick = (row.get("onclick") or "").strip()
|
||||
url = ""
|
||||
if onclick:
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
<setting id="einschalten_base_url" type="text" label="Domain (BASE_URL)" default="https://einschalten.in" />
|
||||
</category>
|
||||
<category label="TMDB">
|
||||
<setting id="tmdb_enabled" type="bool" label="TMDB aktivieren" default="true" />
|
||||
<setting id="tmdb_api_key" type="text" label="TMDB API Key" default="" />
|
||||
<setting id="tmdb_language" type="text" label="TMDB Sprache (z.B. de-DE)" default="de-DE" />
|
||||
<setting id="tmdb_prefetch_concurrency" type="number" label="TMDB: Parallelität (Prefetch, 1-20)" default="6" />
|
||||
|
||||
Reference in New Issue
Block a user