Compare commits
9 Commits
v0.1.82.5-
...
v0.1.87.0-
| Author | SHA1 | Date | |
|---|---|---|---|
| e8fa00ff7b | |||
| ab05040335 | |||
| b0706befdb | |||
| 30bafd269c | |||
| 82c90110e4 | |||
| e5d93e3af6 | |||
| 938f6c0e3d | |||
| 4e9ae348b9 | |||
| 979ad4f8f5 |
@@ -1,3 +1,39 @@
|
|||||||
|
## 0.1.86.5-dev - 2026-04-03
|
||||||
|
|
||||||
|
- dev: bump to 0.1.86.0-dev Globale Suche konfigurierbar, Changelog-Dialog beim ersten Start
|
||||||
|
|
||||||
|
## 0.1.86.0-dev - 2026-04-02
|
||||||
|
|
||||||
|
- dev: bump to 0.1.85.5-dev Settings-Menü benutzerfreundlicher gestaltet
|
||||||
|
|
||||||
|
## 0.1.85.5-dev - 2026-04-02
|
||||||
|
|
||||||
|
- dev: bump to 0.1.85.0-dev settings.xml und default.py auf 0.1.84.5-Stand zurueckgesetzt, serienstream_plugin.py aktuell behalten
|
||||||
|
|
||||||
|
## 0.1.85.0-dev - 2026-04-01
|
||||||
|
|
||||||
|
- dev: bump to 0.1.84.5-dev settings.xml auf Kodi 19+ Format (version=1) migriert, Level-Filter fuer Expert/Advanced korrigiert
|
||||||
|
|
||||||
|
## 0.1.84.5-dev - 2026-03-31
|
||||||
|
|
||||||
|
- dev: bump to 0.1.84.0-dev SerienStream Sammlungen mit Poster/Plot, Session-Cache für Sammlungs-URLs
|
||||||
|
|
||||||
|
## 0.1.84.0-dev - 2026-03-16
|
||||||
|
|
||||||
|
- dev: bump to 0.1.83.5-dev Trakt Weiterschauen via watched/shows, Specials überspringen
|
||||||
|
|
||||||
|
## 0.1.83.5-dev - 2026-03-15
|
||||||
|
|
||||||
|
- dev: SerienStream Suche via /suche?term=, Staffel 0 als Filme, Katalog-Suche entfernt
|
||||||
|
|
||||||
|
## 0.1.83.0-dev - 2026-03-15
|
||||||
|
|
||||||
|
- dev: Trakt Performance, Suchfilter Phrase-Match, Debug-Settings Expert-Level
|
||||||
|
|
||||||
|
## 0.1.82.5-dev - 2026-03-15
|
||||||
|
|
||||||
|
- dev: Update-Versionsvergleich numerisch korrigiert
|
||||||
|
|
||||||
## 0.1.82.0-dev - 2026-03-14
|
## 0.1.82.0-dev - 2026-03-14
|
||||||
|
|
||||||
- dev: HDFilme Plot in Rubrik Neuste anzeigen
|
- dev: HDFilme Plot in Rubrik Neuste anzeigen
|
||||||
|
|||||||
39
addon/CHANGELOG-USER.md
Normal file
39
addon/CHANGELOG-USER.md
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
## 0.1.86.5
|
||||||
|
|
||||||
|
**Trakt**
|
||||||
|
- Alle Trakt-Funktionen sind jetzt unter einem eigenen Untermenüpunkt „Trakt" gebündelt
|
||||||
|
- Weiterschauen erkennt Staffelwechsel korrekt (z.B. S02E12 → S03E01 statt S02E13)
|
||||||
|
- Scrobbling zuverlässiger: Episoden werden nicht mehr fälschlicherweise als gesehen markiert wenn die Streamlänge unbekannt ist
|
||||||
|
- Trakt-IDs werden jetzt auch gefunden wenn TMDB die Serie nicht kennt
|
||||||
|
|
||||||
|
**Globale Suche**
|
||||||
|
- Jedes Such-Plugin in den Einstellungen unter „Globale Suche" einzeln aktivierbar
|
||||||
|
- YouTube optional als Suchquelle wählbar
|
||||||
|
- Suchergebnisse zeigen den Anbieter in eckigen Klammern an, z.B. „Breaking Bad [Serienstream]"
|
||||||
|
|
||||||
|
**Neu beim Start**
|
||||||
|
- Nach einem Update wird automatisch ein Changelog-Dialog mit den Neuigkeiten angezeigt
|
||||||
|
|
||||||
|
## 0.1.86.0
|
||||||
|
|
||||||
|
**Globale Suche verbessert**
|
||||||
|
- Jedes Such-Plugin kann in den Einstellungen unter „Globale Suche" einzeln aktiviert oder deaktiviert werden
|
||||||
|
- YouTube ist nun ebenfalls als optionale Suchquelle wählbar
|
||||||
|
- Suchergebnisse zeigen jetzt den Anbieter in eckigen Klammern an, z.B. „Breaking Bad [Serienstream]"
|
||||||
|
|
||||||
|
**Einstellungsmenü übersichtlicher**
|
||||||
|
- Neue Kategorie „Globale Suche" mit Checkboxen für alle Anbieter
|
||||||
|
- Trakt-Verbindungsstatus direkt in den Einstellungen sichtbar
|
||||||
|
- Bevorzugter Hoster als Auswahlliste, nur aktiv wenn Autoplay eingeschaltet ist
|
||||||
|
|
||||||
|
## 0.1.84.0
|
||||||
|
|
||||||
|
**Trakt Weiterschauen**
|
||||||
|
- Serien, die du bereits angeschaut hast, werden über Trakt als „Weiterschauen"-Liste angezeigt
|
||||||
|
- Specials (Staffel 0) werden dabei automatisch übersprungen
|
||||||
|
|
||||||
|
## 0.1.82.0
|
||||||
|
|
||||||
|
**SerienStream Sammlungen**
|
||||||
|
- Sammlungen auf SerienStream sind jetzt durchsuchbar
|
||||||
|
- Die Liste wird alphabetisch sortiert und Sonderzeichen in Titeln werden bereinigt
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version='1.0' encoding='utf-8'?>
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
<addon id="plugin.video.viewit" name="ViewIt" version="0.1.82.5-dev" provider-name="ViewIt">
|
<addon id="plugin.video.viewit" name="ViewIt" version="0.1.87.0-dev" provider-name="ViewIt">
|
||||||
<requires>
|
<requires>
|
||||||
<import addon="xbmc.python" version="3.0.0" />
|
<import addon="xbmc.python" version="3.0.0" />
|
||||||
<import addon="script.module.requests" />
|
<import addon="script.module.requests" />
|
||||||
|
|||||||
@@ -65,6 +65,8 @@ class TraktItem:
|
|||||||
episode_thumb: str = "" # Screenshot-URL (extended=images)
|
episode_thumb: str = "" # Screenshot-URL (extended=images)
|
||||||
show_poster: str = "" # Serien-Poster-URL (extended=images)
|
show_poster: str = "" # Serien-Poster-URL (extended=images)
|
||||||
show_fanart: str = "" # Serien-Fanart-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)
|
@dataclass(frozen=True)
|
||||||
@@ -370,6 +372,47 @@ class TraktClient:
|
|||||||
return []
|
return []
|
||||||
return self._parse_history_items(payload)
|
return self._parse_history_items(payload)
|
||||||
|
|
||||||
|
def get_watched_shows(self, token: str) -> list[TraktItem]:
|
||||||
|
"""GET /users/me/watched/shows – alle Serien mit zuletzt gesehener Episode."""
|
||||||
|
status, payload = self._get("/users/me/watched/shows", token=token)
|
||||||
|
if status != 200 or not isinstance(payload, list):
|
||||||
|
self._do_log(f"get_watched_shows: status={status}")
|
||||||
|
return []
|
||||||
|
result: list[TraktItem] = []
|
||||||
|
for entry in payload:
|
||||||
|
if not isinstance(entry, dict):
|
||||||
|
continue
|
||||||
|
show = entry.get("show") or {}
|
||||||
|
ids = self._parse_ids((show.get("ids") or {}))
|
||||||
|
title = str(show.get("title", "") or "")
|
||||||
|
year = int(show.get("year", 0) or 0)
|
||||||
|
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
|
||||||
|
|
||||||
# -------------------------------------------------------------------
|
# -------------------------------------------------------------------
|
||||||
# Calendar
|
# Calendar
|
||||||
# -------------------------------------------------------------------
|
# -------------------------------------------------------------------
|
||||||
@@ -427,6 +470,21 @@ class TraktClient:
|
|||||||
ids = show.get("ids") or {}
|
ids = show.get("ids") or {}
|
||||||
return str(ids.get("slug") or ids.get("trakt") 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(
|
def lookup_tv_season(
|
||||||
self,
|
self,
|
||||||
show_id_or_slug: "str | int",
|
show_id_or_slug: "str | int",
|
||||||
|
|||||||
381
addon/default.py
381
addon/default.py
@@ -132,6 +132,8 @@ _TMDB_SEASON_CACHE: dict[tuple[int, int, str, str], dict[int, tuple[dict[str, st
|
|||||||
_TMDB_SEASON_SUMMARY_CACHE: dict[tuple[int, int, str, str], tuple[dict[str, str], dict[str, str]]] = {}
|
_TMDB_SEASON_SUMMARY_CACHE: dict[tuple[int, int, str, str], tuple[dict[str, str], dict[str, str]]] = {}
|
||||||
_TMDB_EPISODE_CAST_CACHE: dict[tuple[int, int, int, str], list[TmdbCastMember]] = {}
|
_TMDB_EPISODE_CAST_CACHE: dict[tuple[int, int, int, str], list[TmdbCastMember]] = {}
|
||||||
_TRAKT_SEASON_META_CACHE: dict = {}
|
_TRAKT_SEASON_META_CACHE: dict = {}
|
||||||
|
_TRAKT_SEASON_META_CACHE_TS: float = 0.0
|
||||||
|
_TRAKT_SEASON_META_CACHE_TTL: int = 1800 # 30 Minuten
|
||||||
_TMDB_LOG_PATH: str | None = None
|
_TMDB_LOG_PATH: str | None = None
|
||||||
_GENRE_TITLES_CACHE: dict[tuple[str, str], list[str]] = {}
|
_GENRE_TITLES_CACHE: dict[tuple[str, str], list[str]] = {}
|
||||||
_ADDON_INSTANCE = None
|
_ADDON_INSTANCE = None
|
||||||
@@ -602,6 +604,20 @@ def _get_setting_int(setting_id: str, *, default: int = 0) -> int:
|
|||||||
return default
|
return default
|
||||||
|
|
||||||
|
|
||||||
|
_PREFERRED_HOSTERS_LIST = [
|
||||||
|
"voe", "streamtape", "doodstream", "vidoza", "mixdrop", "supervideo", "dropload",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def _get_preferred_hoster() -> str:
|
||||||
|
"""Liest preferred_hoster (enum-Index) und gibt den Hosternamen zurueck."""
|
||||||
|
raw = _get_setting_string("preferred_hoster").strip()
|
||||||
|
try:
|
||||||
|
return _PREFERRED_HOSTERS_LIST[int(raw)]
|
||||||
|
except (ValueError, IndexError):
|
||||||
|
return raw # Fallback: Textwert direkt verwenden
|
||||||
|
|
||||||
|
|
||||||
def _metadata_policy(
|
def _metadata_policy(
|
||||||
plugin_name: str,
|
plugin_name: str,
|
||||||
plugin: BasisPlugin,
|
plugin: BasisPlugin,
|
||||||
@@ -1050,6 +1066,12 @@ def _trakt_episode_labels_and_art(
|
|||||||
Lädt Staffel-Episodendaten per Batch (extended=full,images) und optionale
|
Lädt Staffel-Episodendaten per Batch (extended=full,images) und optionale
|
||||||
deutsche Übersetzung per Episode (Translations-Endpunkt).
|
deutsche Übersetzung per Episode (Translations-Endpunkt).
|
||||||
"""
|
"""
|
||||||
|
global _TRAKT_SEASON_META_CACHE_TS
|
||||||
|
now = time.time()
|
||||||
|
if now - _TRAKT_SEASON_META_CACHE_TS > _TRAKT_SEASON_META_CACHE_TTL:
|
||||||
|
_TRAKT_SEASON_META_CACHE.clear()
|
||||||
|
_TRAKT_SEASON_META_CACHE_TS = now
|
||||||
|
|
||||||
client = _trakt_get_client()
|
client = _trakt_get_client()
|
||||||
if not client:
|
if not client:
|
||||||
return {"title": episode_label}, {}
|
return {"title": episode_label}, {}
|
||||||
@@ -1535,6 +1557,11 @@ def _install_addon_version(info_url: str, version: str) -> bool:
|
|||||||
return _install_addon_version_manual(info_url, version)
|
return _install_addon_version_manual(info_url, version)
|
||||||
|
|
||||||
|
|
||||||
|
def _sync_trakt_status_setting() -> None:
|
||||||
|
connected = bool(_trakt_load_token())
|
||||||
|
_get_addon().setSetting("trakt_status", "Verbunden" if connected else "Nicht verbunden")
|
||||||
|
|
||||||
|
|
||||||
def _sync_update_channel_status_settings() -> None:
|
def _sync_update_channel_status_settings() -> None:
|
||||||
channel = _selected_update_channel()
|
channel = _selected_update_channel()
|
||||||
selected_info_url = _resolve_update_info_url()
|
selected_info_url = _resolve_update_info_url()
|
||||||
@@ -1826,18 +1853,25 @@ def _show_root_menu() -> None:
|
|||||||
|
|
||||||
# Trakt-Menue (nur wenn aktiviert)
|
# Trakt-Menue (nur wenn aktiviert)
|
||||||
if _get_setting_bool("trakt_enabled", default=False):
|
if _get_setting_bool("trakt_enabled", default=False):
|
||||||
if _trakt_load_token():
|
_add_directory_item(handle, "Trakt", "trakt_menu", is_folder=True)
|
||||||
_add_directory_item(handle, "Weiterschauen", "trakt_continue", is_folder=True)
|
|
||||||
_add_directory_item(handle, "Trakt Upcoming", "trakt_upcoming", is_folder=True)
|
|
||||||
_add_directory_item(handle, "Trakt Watchlist", "trakt_watchlist", is_folder=True)
|
|
||||||
_add_directory_item(handle, "Trakt History", "trakt_history", {"page": "1"}, is_folder=True)
|
|
||||||
else:
|
|
||||||
_add_directory_item(handle, "Trakt autorisieren", "trakt_auth", is_folder=True)
|
|
||||||
|
|
||||||
_add_directory_item(handle, "Einstellungen", "settings")
|
_add_directory_item(handle, "Einstellungen", "settings")
|
||||||
xbmcplugin.endOfDirectory(handle)
|
xbmcplugin.endOfDirectory(handle)
|
||||||
|
|
||||||
|
|
||||||
|
def _show_trakt_menu() -> None:
|
||||||
|
handle = _get_handle()
|
||||||
|
xbmcplugin.setPluginCategory(handle, "Trakt")
|
||||||
|
if _trakt_load_token():
|
||||||
|
_add_directory_item(handle, "Weiterschauen", "trakt_continue", is_folder=True)
|
||||||
|
_add_directory_item(handle, "Trakt Upcoming", "trakt_upcoming", is_folder=True)
|
||||||
|
_add_directory_item(handle, "Trakt Watchlist", "trakt_watchlist", is_folder=True)
|
||||||
|
_add_directory_item(handle, "Trakt History", "trakt_history", {"page": "1"}, is_folder=True)
|
||||||
|
else:
|
||||||
|
_add_directory_item(handle, "Trakt autorisieren", "trakt_auth", is_folder=True)
|
||||||
|
xbmcplugin.endOfDirectory(handle)
|
||||||
|
|
||||||
|
|
||||||
def _show_plugin_menu(plugin_name: str) -> None:
|
def _show_plugin_menu(plugin_name: str) -> None:
|
||||||
handle = _get_handle()
|
handle = _get_handle()
|
||||||
plugin_name = (plugin_name or "").strip()
|
plugin_name = (plugin_name or "").strip()
|
||||||
@@ -1938,6 +1972,8 @@ def _show_plugin_search_results(plugin_name: str, query: str) -> None:
|
|||||||
pass
|
pass
|
||||||
raise
|
raise
|
||||||
results = _clean_search_titles([str(t).strip() for t in (results or []) if t and str(t).strip()])
|
results = _clean_search_titles([str(t).strip() for t in (results or []) if t and str(t).strip()])
|
||||||
|
from search_utils import matches_query as _mq
|
||||||
|
results = [r for r in results if _mq(query, title=r)]
|
||||||
results.sort(key=lambda value: value.casefold())
|
results.sort(key=lambda value: value.casefold())
|
||||||
|
|
||||||
use_source, show_tmdb, prefer_source = _metadata_policy(
|
use_source, show_tmdb, prefer_source = _metadata_policy(
|
||||||
@@ -2093,8 +2129,17 @@ def _run_async(coro):
|
|||||||
"""Fuehrt eine Coroutine aus, auch wenn Kodi bereits einen Event-Loop hat."""
|
"""Fuehrt eine Coroutine aus, auch wenn Kodi bereits einen Event-Loop hat."""
|
||||||
_ensure_windows_selector_policy()
|
_ensure_windows_selector_policy()
|
||||||
|
|
||||||
def _run_with_asyncio_run():
|
def _run_without_asyncio_run():
|
||||||
return asyncio.run(coro)
|
# asyncio.run() wuerde cancel_all_tasks() aufrufen, was auf Android TV
|
||||||
|
# wegen eines kaputten _weakrefset.py-Builds zu NameError: 'len' fuehrt.
|
||||||
|
loop = asyncio.new_event_loop()
|
||||||
|
try:
|
||||||
|
return loop.run_until_complete(coro)
|
||||||
|
finally:
|
||||||
|
try:
|
||||||
|
loop.close()
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
running_loop = asyncio.get_running_loop()
|
running_loop = asyncio.get_running_loop()
|
||||||
@@ -2107,7 +2152,7 @@ def _run_async(coro):
|
|||||||
|
|
||||||
def _worker() -> None:
|
def _worker() -> None:
|
||||||
try:
|
try:
|
||||||
result_box["value"] = _run_with_asyncio_run()
|
result_box["value"] = _run_without_asyncio_run()
|
||||||
except BaseException as exc: # pragma: no cover - defensive
|
except BaseException as exc: # pragma: no cover - defensive
|
||||||
error_box["error"] = exc
|
error_box["error"] = exc
|
||||||
|
|
||||||
@@ -2118,7 +2163,7 @@ def _run_async(coro):
|
|||||||
raise error_box["error"]
|
raise error_box["error"]
|
||||||
return result_box.get("value")
|
return result_box.get("value")
|
||||||
|
|
||||||
return _run_with_asyncio_run()
|
return _run_without_asyncio_run()
|
||||||
|
|
||||||
|
|
||||||
def _series_url_params(plugin: BasisPlugin, title: str) -> dict[str, str]:
|
def _series_url_params(plugin: BasisPlugin, title: str) -> dict[str, str]:
|
||||||
@@ -2159,6 +2204,29 @@ def _clean_search_titles(values: list[str]) -> list[str]:
|
|||||||
return cleaned
|
return cleaned
|
||||||
|
|
||||||
|
|
||||||
|
_SEARCH_PLUGIN_SETTING_IDS: dict[str, str] = {
|
||||||
|
"Serienstream": "search_plugin_serienstream",
|
||||||
|
"Aniworld": "search_plugin_aniworld",
|
||||||
|
"Topstreamfilm": "search_plugin_topstreamfilm",
|
||||||
|
"Filmpalast": "search_plugin_filmpalast",
|
||||||
|
"Moflix": "search_plugin_moflix",
|
||||||
|
"KKiste": "search_plugin_kkiste",
|
||||||
|
"HDFilme": "search_plugin_hdfilme",
|
||||||
|
"Einschalten": "search_plugin_einschalten",
|
||||||
|
"Doku-Streams": "search_plugin_doku_streams",
|
||||||
|
"NetzkKino": "search_plugin_netzkino",
|
||||||
|
"YouTube": "search_plugin_youtube",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def _plugin_search_enabled(plugin_name: str) -> bool:
|
||||||
|
"""Gibt True zurück wenn das Plugin in der globalen Suche aktiv ist."""
|
||||||
|
setting_id = _SEARCH_PLUGIN_SETTING_IDS.get(plugin_name)
|
||||||
|
if setting_id is None:
|
||||||
|
return True # unbekannte Plugins standardmäßig einschließen
|
||||||
|
return _get_setting_bool(setting_id, default=True)
|
||||||
|
|
||||||
|
|
||||||
def _show_search() -> None:
|
def _show_search() -> None:
|
||||||
_log("Suche gestartet.")
|
_log("Suche gestartet.")
|
||||||
dialog = xbmcgui.Dialog()
|
dialog = xbmcgui.Dialog()
|
||||||
@@ -2183,7 +2251,7 @@ def _show_search_results(query: str) -> None:
|
|||||||
# grouped: casefold-key → Liste der Plugin-Einträge für diesen Titel
|
# grouped: casefold-key → Liste der Plugin-Einträge für diesen Titel
|
||||||
grouped: dict[str, list[dict[str, object]]] = {}
|
grouped: dict[str, list[dict[str, object]]] = {}
|
||||||
canceled = False
|
canceled = False
|
||||||
plugin_entries = list(plugins.items())
|
plugin_entries = [(n, p) for n, p in plugins.items() if _plugin_search_enabled(n)]
|
||||||
total_plugins = max(1, len(plugin_entries))
|
total_plugins = max(1, len(plugin_entries))
|
||||||
with _progress_dialog("Suche laeuft", "Suche startet...") as progress:
|
with _progress_dialog("Suche laeuft", "Suche startet...") as progress:
|
||||||
for plugin_index, (plugin_name, plugin) in enumerate(plugin_entries, start=1):
|
for plugin_index, (plugin_name, plugin) in enumerate(plugin_entries, start=1):
|
||||||
@@ -2208,6 +2276,8 @@ def _show_search_results(query: str) -> None:
|
|||||||
_log(f"Suche fehlgeschlagen ({plugin_name}): {exc}", xbmc.LOGWARNING)
|
_log(f"Suche fehlgeschlagen ({plugin_name}): {exc}", xbmc.LOGWARNING)
|
||||||
continue
|
continue
|
||||||
results = _clean_search_titles([str(t).strip() for t in (results or []) if t and str(t).strip()])
|
results = _clean_search_titles([str(t).strip() for t in (results or []) if t and str(t).strip()])
|
||||||
|
from search_utils import matches_query as _mq
|
||||||
|
results = [r for r in results if _mq(query, title=r)]
|
||||||
_log(f"Treffer ({plugin_name}): {len(results)}", xbmc.LOGDEBUG)
|
_log(f"Treffer ({plugin_name}): {len(results)}", xbmc.LOGDEBUG)
|
||||||
use_source, show_tmdb, prefer_source = _metadata_policy(
|
use_source, show_tmdb, prefer_source = _metadata_policy(
|
||||||
plugin_name, plugin, allow_tmdb=_tmdb_enabled()
|
plugin_name, plugin, allow_tmdb=_tmdb_enabled()
|
||||||
@@ -2286,7 +2356,7 @@ def _show_search_results(query: str) -> None:
|
|||||||
# Nur ein Plugin → direkt zur Staffel-Ansicht
|
# Nur ein Plugin → direkt zur Staffel-Ansicht
|
||||||
direct_play = bool(first["direct_play"])
|
direct_play = bool(first["direct_play"])
|
||||||
list_items.append({
|
list_items.append({
|
||||||
"label": first["label_base"],
|
"label": f"{first['label_base']} [{first['plugin_name']}]",
|
||||||
"action": "play_movie" if direct_play else "seasons",
|
"action": "play_movie" if direct_play else "seasons",
|
||||||
"params": {"plugin": first["plugin_name"], "title": canonical_title, **dict(first["extra_params"])},
|
"params": {"plugin": first["plugin_name"], "title": canonical_title, **dict(first["extra_params"])},
|
||||||
"is_folder": not direct_play,
|
"is_folder": not direct_play,
|
||||||
@@ -2297,8 +2367,9 @@ def _show_search_results(query: str) -> None:
|
|||||||
else:
|
else:
|
||||||
# Mehrere Plugins → Zwischenstufe "Quelle wählen"
|
# Mehrere Plugins → Zwischenstufe "Quelle wählen"
|
||||||
plugin_list = ",".join(str(e["plugin_name"]) for e in entries)
|
plugin_list = ",".join(str(e["plugin_name"]) for e in entries)
|
||||||
|
provider_label = ", ".join(str(e["plugin_name"]) for e in entries)
|
||||||
list_items.append({
|
list_items.append({
|
||||||
"label": first["label_base"],
|
"label": f"{first['label_base']} [{provider_label}]",
|
||||||
"action": "choose_source",
|
"action": "choose_source",
|
||||||
"params": {"title": canonical_title, "plugins": plugin_list},
|
"params": {"title": canonical_title, "plugins": plugin_list},
|
||||||
"is_folder": True,
|
"is_folder": True,
|
||||||
@@ -4248,8 +4319,10 @@ def _trakt_scrobble_start_async(media: dict[str, object]) -> None:
|
|||||||
threading.Thread(target=_do, daemon=True).start()
|
threading.Thread(target=_do, daemon=True).start()
|
||||||
|
|
||||||
|
|
||||||
def _trakt_scrobble_stop_async(media: dict[str, object], progress: float = 100.0) -> None:
|
def _trakt_scrobble_stop_async(media: dict[str, object], progress: float = 100.0) -> threading.Thread:
|
||||||
"""Sendet scrobble/stop an die Trakt-API in einem Hintergrund-Thread."""
|
"""Sendet scrobble/stop an die Trakt-API in einem Hintergrund-Thread.
|
||||||
|
Gibt den Thread zurück damit der Aufrufer bei Bedarf darauf warten kann.
|
||||||
|
"""
|
||||||
def _do() -> None:
|
def _do() -> None:
|
||||||
try:
|
try:
|
||||||
from core.trakt import TraktClient
|
from core.trakt import TraktClient
|
||||||
@@ -4270,7 +4343,9 @@ def _trakt_scrobble_stop_async(media: dict[str, object], progress: float = 100.0
|
|||||||
progress=progress,
|
progress=progress,
|
||||||
)
|
)
|
||||||
_log(f"Trakt scrobble/stop: {media.get('title')} progress={progress:.0f}%", xbmc.LOGDEBUG)
|
_log(f"Trakt scrobble/stop: {media.get('title')} progress={progress:.0f}%", xbmc.LOGDEBUG)
|
||||||
threading.Thread(target=_do, daemon=True).start()
|
t = threading.Thread(target=_do, daemon=True)
|
||||||
|
t.start()
|
||||||
|
return t
|
||||||
|
|
||||||
|
|
||||||
def _trakt_monitor_playback(media: dict[str, object]) -> None:
|
def _trakt_monitor_playback(media: dict[str, object]) -> None:
|
||||||
@@ -4312,9 +4387,18 @@ def _trakt_monitor_playback(media: dict[str, object]) -> None:
|
|||||||
if monitor.abortRequested():
|
if monitor.abortRequested():
|
||||||
return
|
return
|
||||||
|
|
||||||
progress = min(100.0, (last_pos / total_time * 100.0)) if total_time > 0 else 100.0
|
if total_time > 0:
|
||||||
|
progress = min(100.0, last_pos / total_time * 100.0)
|
||||||
|
elif last_pos > 0:
|
||||||
|
# Keine Gesamtlaufzeit bekannt – kein Scrobble um falsche 100%-Markierung zu vermeiden
|
||||||
|
_log("Trakt monitor: total_time unbekannt, kein Scrobble.", xbmc.LOGDEBUG)
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
_log("Trakt monitor: keine Positionsdaten, kein Scrobble.", xbmc.LOGDEBUG)
|
||||||
|
return
|
||||||
_log(f"Trakt monitor: Wiedergabe beendet, progress={progress:.0f}%", xbmc.LOGDEBUG)
|
_log(f"Trakt monitor: Wiedergabe beendet, progress={progress:.0f}%", xbmc.LOGDEBUG)
|
||||||
_trakt_scrobble_stop_async(media, progress=progress)
|
stop_thread = _trakt_scrobble_stop_async(media, progress=progress)
|
||||||
|
stop_thread.join(timeout=10)
|
||||||
|
|
||||||
|
|
||||||
def _track_playback_and_update_state_async(key: str) -> None:
|
def _track_playback_and_update_state_async(key: str) -> None:
|
||||||
@@ -4375,7 +4459,7 @@ def _play_episode(
|
|||||||
selected_hoster: str | None = None
|
selected_hoster: str | None = None
|
||||||
forced_hoster = (forced_hoster or "").strip()
|
forced_hoster = (forced_hoster or "").strip()
|
||||||
autoplay = _get_setting_bool("autoplay_enabled", default=False)
|
autoplay = _get_setting_bool("autoplay_enabled", default=False)
|
||||||
preferred = _get_setting_string("preferred_hoster").strip()
|
preferred = _get_preferred_hoster()
|
||||||
if available_hosters:
|
if available_hosters:
|
||||||
if forced_hoster:
|
if forced_hoster:
|
||||||
for hoster in available_hosters:
|
for hoster in available_hosters:
|
||||||
@@ -4410,13 +4494,15 @@ def _play_episode(
|
|||||||
preferred_setter([selected_hoster])
|
preferred_setter([selected_hoster])
|
||||||
|
|
||||||
try:
|
try:
|
||||||
link = plugin.stream_link_for(title, season, episode)
|
with _busy_dialog("Stream wird gesucht..."):
|
||||||
|
link = plugin.stream_link_for(title, season, episode)
|
||||||
if not link:
|
if not link:
|
||||||
_log("Kein Stream gefunden.", xbmc.LOGWARNING)
|
_log("Kein Stream gefunden.", xbmc.LOGWARNING)
|
||||||
xbmcgui.Dialog().notification("Wiedergabe", "Kein Stream gefunden.", xbmcgui.NOTIFICATION_INFO, 3000)
|
xbmcgui.Dialog().notification("Wiedergabe", "Kein Stream gefunden.", xbmcgui.NOTIFICATION_INFO, 3000)
|
||||||
return
|
return
|
||||||
_log(f"Stream-Link: {link}", xbmc.LOGDEBUG)
|
_log(f"Stream-Link: {link}", xbmc.LOGDEBUG)
|
||||||
final_link = _resolve_stream_with_retry(plugin, link)
|
with _busy_dialog("Stream wird aufgelöst..."):
|
||||||
|
final_link = _resolve_stream_with_retry(plugin, link)
|
||||||
if not final_link:
|
if not final_link:
|
||||||
return
|
return
|
||||||
finally:
|
finally:
|
||||||
@@ -4441,6 +4527,15 @@ def _play_episode(
|
|||||||
if _tmdb_id:
|
if _tmdb_id:
|
||||||
_imdb_id = _fetch_and_cache_imdb_id(title_key, _tmdb_id, _kind)
|
_imdb_id = _fetch_and_cache_imdb_id(title_key, _tmdb_id, _kind)
|
||||||
_set_trakt_ids_property(title, _tmdb_id, _imdb_id)
|
_set_trakt_ids_property(title, _tmdb_id, _imdb_id)
|
||||||
|
if not _tmdb_id and not _imdb_id and _get_setting_bool("trakt_enabled", default=False):
|
||||||
|
# Fallback: Trakt-Titelsuche wenn TMDB keine IDs liefert
|
||||||
|
try:
|
||||||
|
_trakt_client = _trakt_get_client()
|
||||||
|
if _trakt_client:
|
||||||
|
_tmdb_id, _imdb_id = _trakt_client.search_show_ids(title)
|
||||||
|
_log(f"Trakt ID-Fallback fuer '{title}': tmdb={_tmdb_id} imdb={_imdb_id}", xbmc.LOGDEBUG)
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
trakt_media: dict[str, object] = {
|
trakt_media: dict[str, object] = {
|
||||||
"title": title, "tmdb_id": _tmdb_id, "imdb_id": _imdb_id, "kind": _kind,
|
"title": title, "tmdb_id": _tmdb_id, "imdb_id": _imdb_id, "kind": _kind,
|
||||||
"season": season_number or 0, "episode": episode_number or 0,
|
"season": season_number or 0, "episode": episode_number or 0,
|
||||||
@@ -4492,7 +4587,7 @@ def _play_episode_url(
|
|||||||
|
|
||||||
selected_hoster: str | None = None
|
selected_hoster: str | None = None
|
||||||
autoplay = _get_setting_bool("autoplay_enabled", default=False)
|
autoplay = _get_setting_bool("autoplay_enabled", default=False)
|
||||||
preferred = _get_setting_string("preferred_hoster").strip()
|
preferred = _get_preferred_hoster()
|
||||||
if available_hosters:
|
if available_hosters:
|
||||||
if autoplay and preferred:
|
if autoplay and preferred:
|
||||||
pref_lower = preferred.casefold()
|
pref_lower = preferred.casefold()
|
||||||
@@ -4750,13 +4845,33 @@ def _show_collection_titles_page(plugin_name: str, collection: str, page: int =
|
|||||||
xbmcplugin.endOfDirectory(handle)
|
xbmcplugin.endOfDirectory(handle)
|
||||||
return
|
return
|
||||||
titles = [str(t).strip() for t in titles if t and str(t).strip()]
|
titles = [str(t).strip() for t in titles if t and str(t).strip()]
|
||||||
direct_play = bool(plugin_name.casefold() == "einschalten"
|
|
||||||
and _get_setting_bool("einschalten_enable_playback", default=False))
|
|
||||||
for title in titles:
|
|
||||||
_add_directory_item(handle, title, "play_movie" if direct_play else "seasons",
|
|
||||||
{"plugin": plugin_name, "title": title, **_series_url_params(plugin, title)},
|
|
||||||
is_folder=not direct_play)
|
|
||||||
if titles:
|
if titles:
|
||||||
|
use_source, show_tmdb, prefer_source = _metadata_policy(
|
||||||
|
plugin_name, plugin, allow_tmdb=_tmdb_list_enabled()
|
||||||
|
)
|
||||||
|
plugin_meta = _collect_plugin_metadata(plugin, titles) if use_source else {}
|
||||||
|
show_plot = _get_setting_bool("tmdb_show_plot", default=True)
|
||||||
|
show_art = _get_setting_bool("tmdb_show_art", default=True)
|
||||||
|
tmdb_prefetched: dict[str, tuple[dict[str, str], dict[str, str], list[TmdbCastMember]]] = {}
|
||||||
|
tmdb_titles = list(titles) if show_tmdb else []
|
||||||
|
if show_tmdb and prefer_source and use_source:
|
||||||
|
tmdb_titles = [
|
||||||
|
t for t in titles
|
||||||
|
if _needs_tmdb((plugin_meta.get(t) or ({},))[0], (plugin_meta.get(t) or ({}, {}))[1],
|
||||||
|
want_plot=show_plot, want_art=show_art)
|
||||||
|
]
|
||||||
|
if show_tmdb and tmdb_titles:
|
||||||
|
with _busy_dialog(f"{collection} wird geladen..."):
|
||||||
|
tmdb_prefetched = _tmdb_labels_and_art_bulk(tmdb_titles)
|
||||||
|
for title in titles:
|
||||||
|
tmdb_info, tmdb_art, tmdb_cast = tmdb_prefetched.get(title, ({}, {}, [])) if show_tmdb else ({}, {}, [])
|
||||||
|
meta = plugin_meta.get(title)
|
||||||
|
info_labels, art, cast = _merge_metadata(title, tmdb_info, tmdb_art, tmdb_cast, meta)
|
||||||
|
info_labels = dict(info_labels or {})
|
||||||
|
info_labels.setdefault("mediatype", "tvshow")
|
||||||
|
_add_directory_item(handle, title, "seasons",
|
||||||
|
{"plugin": plugin_name, "title": title, **_series_url_params(plugin, title)},
|
||||||
|
is_folder=True, info_labels=info_labels, art=art, cast=cast)
|
||||||
_add_directory_item(handle, "Naechste Seite", "collection_titles_page",
|
_add_directory_item(handle, "Naechste Seite", "collection_titles_page",
|
||||||
{"plugin": plugin_name, "collection": collection, "page": str(page + 1)}, is_folder=True)
|
{"plugin": plugin_name, "collection": collection, "page": str(page + 1)}, is_folder=True)
|
||||||
xbmcplugin.endOfDirectory(handle)
|
xbmcplugin.endOfDirectory(handle)
|
||||||
@@ -4811,11 +4926,33 @@ def _show_tag_titles_page(plugin_name: str, tag: str, page: int = 1) -> None:
|
|||||||
xbmcplugin.endOfDirectory(handle)
|
xbmcplugin.endOfDirectory(handle)
|
||||||
return
|
return
|
||||||
titles = [str(t).strip() for t in titles if t and str(t).strip()]
|
titles = [str(t).strip() for t in titles if t and str(t).strip()]
|
||||||
for title in titles:
|
|
||||||
_add_directory_item(handle, title, "seasons",
|
|
||||||
{"plugin": plugin_name, "title": title, **_series_url_params(plugin, title)},
|
|
||||||
is_folder=True)
|
|
||||||
if titles:
|
if titles:
|
||||||
|
use_source, show_tmdb, prefer_source = _metadata_policy(
|
||||||
|
plugin_name, plugin, allow_tmdb=_tmdb_list_enabled()
|
||||||
|
)
|
||||||
|
plugin_meta = _collect_plugin_metadata(plugin, titles) if use_source else {}
|
||||||
|
show_plot = _get_setting_bool("tmdb_show_plot", default=True)
|
||||||
|
show_art = _get_setting_bool("tmdb_show_art", default=True)
|
||||||
|
tmdb_prefetched: dict[str, tuple[dict[str, str], dict[str, str], list[TmdbCastMember]]] = {}
|
||||||
|
tmdb_titles = list(titles) if show_tmdb else []
|
||||||
|
if show_tmdb and prefer_source and use_source:
|
||||||
|
tmdb_titles = [
|
||||||
|
t for t in titles
|
||||||
|
if _needs_tmdb((plugin_meta.get(t) or ({},))[0], (plugin_meta.get(t) or ({}, {}))[1],
|
||||||
|
want_plot=show_plot, want_art=show_art)
|
||||||
|
]
|
||||||
|
if show_tmdb and tmdb_titles:
|
||||||
|
with _busy_dialog("Schlagwort-Liste wird geladen..."):
|
||||||
|
tmdb_prefetched = _tmdb_labels_and_art_bulk(tmdb_titles)
|
||||||
|
for title in titles:
|
||||||
|
tmdb_info, tmdb_art, tmdb_cast = tmdb_prefetched.get(title, ({}, {}, [])) if show_tmdb else ({}, {}, [])
|
||||||
|
meta = plugin_meta.get(title)
|
||||||
|
info_labels, art, cast = _merge_metadata(title, tmdb_info, tmdb_art, tmdb_cast, meta)
|
||||||
|
info_labels = dict(info_labels or {})
|
||||||
|
info_labels.setdefault("mediatype", "tvshow")
|
||||||
|
_add_directory_item(handle, title, "seasons",
|
||||||
|
{"plugin": plugin_name, "title": title, **_series_url_params(plugin, title)},
|
||||||
|
is_folder=True, info_labels=info_labels, art=art, cast=cast)
|
||||||
_add_directory_item(handle, "Naechste Seite", "tag_titles_page",
|
_add_directory_item(handle, "Naechste Seite", "tag_titles_page",
|
||||||
{"plugin": plugin_name, "tag": tag, "page": str(page + 1)}, is_folder=True)
|
{"plugin": plugin_name, "tag": tag, "page": str(page + 1)}, is_folder=True)
|
||||||
xbmcplugin.endOfDirectory(handle)
|
xbmcplugin.endOfDirectory(handle)
|
||||||
@@ -4910,10 +5047,11 @@ def _show_trakt_watchlist(media_type: str = "") -> None:
|
|||||||
|
|
||||||
_set_content(handle, "tvshows")
|
_set_content(handle, "tvshows")
|
||||||
items = client.get_watchlist(token, media_type=media_type)
|
items = client.get_watchlist(token, media_type=media_type)
|
||||||
|
tmdb_prefetched = _tmdb_labels_and_art_bulk([i.title for i in items]) if _tmdb_enabled() else {}
|
||||||
for item in items:
|
for item in items:
|
||||||
label = f"{item.title} ({item.year})" if item.year else item.title
|
label = f"{item.title} ({item.year})" if item.year else item.title
|
||||||
|
|
||||||
tmdb_info, art, _ = _tmdb_labels_and_art(item.title)
|
tmdb_info, art, _ = tmdb_prefetched.get(item.title, ({}, {}, []))
|
||||||
info_labels: dict[str, object] = dict(tmdb_info)
|
info_labels: dict[str, object] = dict(tmdb_info)
|
||||||
info_labels["title"] = label
|
info_labels["title"] = label
|
||||||
info_labels["tvshowtitle"] = item.title
|
info_labels["tvshowtitle"] = item.title
|
||||||
@@ -4921,19 +5059,10 @@ def _show_trakt_watchlist(media_type: str = "") -> None:
|
|||||||
info_labels["year"] = item.year
|
info_labels["year"] = item.year
|
||||||
info_labels["mediatype"] = "tvshow"
|
info_labels["mediatype"] = "tvshow"
|
||||||
|
|
||||||
match = _trakt_find_in_plugins(item.title)
|
_add_directory_item(handle, label, "search", {"query": item.title}, is_folder=True, info_labels=info_labels, art=art)
|
||||||
if match:
|
|
||||||
plugin_name, matched_title = match
|
|
||||||
action = "seasons"
|
|
||||||
params: dict[str, str] = {"plugin": plugin_name, "title": matched_title}
|
|
||||||
else:
|
|
||||||
action = "search"
|
|
||||||
params = {"query": item.title}
|
|
||||||
|
|
||||||
_add_directory_item(handle, label, action, params, is_folder=True, info_labels=info_labels, art=art)
|
|
||||||
if not items:
|
if not items:
|
||||||
xbmcgui.Dialog().notification("Trakt", "Watchlist ist leer.", xbmcgui.NOTIFICATION_INFO, 3000)
|
xbmcgui.Dialog().notification("Trakt", "Watchlist ist leer.", xbmcgui.NOTIFICATION_INFO, 3000)
|
||||||
xbmcplugin.endOfDirectory(handle)
|
xbmcplugin.endOfDirectory(handle, cacheToDisc=False)
|
||||||
|
|
||||||
|
|
||||||
def _show_trakt_history(page: int = 1) -> None:
|
def _show_trakt_history(page: int = 1) -> None:
|
||||||
@@ -4949,6 +5078,7 @@ def _show_trakt_history(page: int = 1) -> None:
|
|||||||
_set_content(handle, "episodes")
|
_set_content(handle, "episodes")
|
||||||
|
|
||||||
items = client.get_history(token, page=page, limit=LIST_PAGE_SIZE)
|
items = client.get_history(token, page=page, limit=LIST_PAGE_SIZE)
|
||||||
|
tmdb_prefetched = _tmdb_labels_and_art_bulk(list(dict.fromkeys(i.title for i in items))) if _tmdb_enabled() else {}
|
||||||
for item in items:
|
for item in items:
|
||||||
is_episode = item.media_type == "episode" and item.season and item.episode
|
is_episode = item.media_type == "episode" and item.season and item.episode
|
||||||
|
|
||||||
@@ -4969,7 +5099,7 @@ def _show_trakt_history(page: int = 1) -> None:
|
|||||||
art["fanart"] = item.show_fanart
|
art["fanart"] = item.show_fanart
|
||||||
if item.show_poster:
|
if item.show_poster:
|
||||||
art["poster"] = item.show_poster
|
art["poster"] = item.show_poster
|
||||||
_, tmdb_art, _ = _tmdb_labels_and_art(item.title)
|
_, tmdb_art, _ = tmdb_prefetched.get(item.title, ({}, {}, []))
|
||||||
for _k, _v in tmdb_art.items():
|
for _k, _v in tmdb_art.items():
|
||||||
art.setdefault(_k, _v)
|
art.setdefault(_k, _v)
|
||||||
|
|
||||||
@@ -4996,30 +5126,13 @@ def _show_trakt_history(page: int = 1) -> None:
|
|||||||
f"RunPlugin({sys.argv[0]}?{wl_params})"))
|
f"RunPlugin({sys.argv[0]}?{wl_params})"))
|
||||||
|
|
||||||
# Navigation: Episoden direkt abspielen, Serien zur Staffelauswahl
|
# Navigation: Episoden direkt abspielen, Serien zur Staffelauswahl
|
||||||
match = _trakt_find_in_plugins(item.title)
|
_add_directory_item(handle, label, "search", {"query": item.title}, is_folder=True, info_labels=info_labels, art=art, context_menu=ctx or None)
|
||||||
if match:
|
|
||||||
plugin_name, matched_title = match
|
|
||||||
if is_episode:
|
|
||||||
action = "play_episode"
|
|
||||||
params: dict[str, str] = {
|
|
||||||
"plugin": plugin_name,
|
|
||||||
"title": matched_title,
|
|
||||||
"season": f"Staffel {item.season}",
|
|
||||||
"episode": f"Episode {item.episode}",
|
|
||||||
}
|
|
||||||
_add_directory_item(handle, label, action, params, is_folder=False, info_labels=info_labels, art=art, context_menu=ctx or None)
|
|
||||||
else:
|
|
||||||
action = "seasons"
|
|
||||||
params = {"plugin": plugin_name, "title": matched_title}
|
|
||||||
_add_directory_item(handle, label, action, params, is_folder=True, info_labels=info_labels, art=art, context_menu=ctx or None)
|
|
||||||
else:
|
|
||||||
_add_directory_item(handle, label, "search", {"query": item.title}, is_folder=True, info_labels=info_labels, art=art, context_menu=ctx or None)
|
|
||||||
|
|
||||||
if len(items) >= LIST_PAGE_SIZE:
|
if len(items) >= LIST_PAGE_SIZE:
|
||||||
_add_directory_item(handle, "Naechste Seite >>", "trakt_history", {"page": str(page + 1)}, is_folder=True)
|
_add_directory_item(handle, "Naechste Seite >>", "trakt_history", {"page": str(page + 1)}, is_folder=True)
|
||||||
if not items and page == 1:
|
if not items and page == 1:
|
||||||
xbmcgui.Dialog().notification("Trakt", "Keine History vorhanden.", xbmcgui.NOTIFICATION_INFO, 3000)
|
xbmcgui.Dialog().notification("Trakt", "Keine History vorhanden.", xbmcgui.NOTIFICATION_INFO, 3000)
|
||||||
xbmcplugin.endOfDirectory(handle)
|
xbmcplugin.endOfDirectory(handle, cacheToDisc=False)
|
||||||
|
|
||||||
|
|
||||||
def _show_trakt_upcoming() -> None:
|
def _show_trakt_upcoming() -> None:
|
||||||
@@ -5066,6 +5179,10 @@ def _show_trakt_upcoming() -> None:
|
|||||||
pass
|
pass
|
||||||
dated_items.append((airdate, item))
|
dated_items.append((airdate, item))
|
||||||
|
|
||||||
|
# TMDB-Artwork fuer alle Serien parallel prefetchen (dedupliziert)
|
||||||
|
show_titles = list(dict.fromkeys(item.show_title for _, item in dated_items))
|
||||||
|
tmdb_prefetched = _tmdb_labels_and_art_bulk(show_titles) if _tmdb_enabled() else {}
|
||||||
|
|
||||||
last_date: _date | None = None
|
last_date: _date | None = None
|
||||||
for airdate, item in dated_items:
|
for airdate, item in dated_items:
|
||||||
# Datums-Ueberschrift einfuegen
|
# Datums-Ueberschrift einfuegen
|
||||||
@@ -5117,26 +5234,16 @@ def _show_trakt_upcoming() -> None:
|
|||||||
art["fanart"] = item.episode_thumb
|
art["fanart"] = item.episode_thumb
|
||||||
elif item.show_fanart:
|
elif item.show_fanart:
|
||||||
art["fanart"] = item.show_fanart
|
art["fanart"] = item.show_fanart
|
||||||
_, tmdb_art, _ = _tmdb_labels_and_art(item.show_title)
|
_, tmdb_art, _ = tmdb_prefetched.get(item.show_title, ({}, {}, []))
|
||||||
for _k, _v in tmdb_art.items():
|
for _k, _v in tmdb_art.items():
|
||||||
art.setdefault(_k, _v)
|
art.setdefault(_k, _v)
|
||||||
|
|
||||||
match = _trakt_find_in_plugins(item.show_title)
|
action = "search"
|
||||||
if match:
|
params: dict[str, str] = {"query": item.show_title}
|
||||||
plugin_name, matched_title = match
|
|
||||||
action = "episodes"
|
|
||||||
params: dict[str, str] = {
|
|
||||||
"plugin": plugin_name,
|
|
||||||
"title": matched_title,
|
|
||||||
"season": f"Staffel {item.season}",
|
|
||||||
}
|
|
||||||
else:
|
|
||||||
action = "search"
|
|
||||||
params = {"query": item.show_title}
|
|
||||||
|
|
||||||
_add_directory_item(handle, label, action, params, is_folder=True, info_labels=info_labels, art=art)
|
_add_directory_item(handle, label, action, params, is_folder=True, info_labels=info_labels, art=art)
|
||||||
|
|
||||||
xbmcplugin.endOfDirectory(handle)
|
xbmcplugin.endOfDirectory(handle, cacheToDisc=False)
|
||||||
|
|
||||||
|
|
||||||
def _show_trakt_continue_watching() -> None:
|
def _show_trakt_continue_watching() -> None:
|
||||||
@@ -5153,65 +5260,41 @@ def _show_trakt_continue_watching() -> None:
|
|||||||
_set_content(handle, "episodes")
|
_set_content(handle, "episodes")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
history = client.get_history(token, media_type="episodes", limit=100)
|
watched = client.get_watched_shows(token)
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
_log(f"Trakt History fehlgeschlagen: {exc}", xbmc.LOGWARNING)
|
_log(f"Trakt Watched fehlgeschlagen: {exc}", xbmc.LOGWARNING)
|
||||||
xbmcgui.Dialog().notification("Trakt", "History konnte nicht geladen werden.", xbmcgui.NOTIFICATION_INFO, 3000)
|
xbmcgui.Dialog().notification("Trakt", "Watched-Liste konnte nicht geladen werden.", xbmcgui.NOTIFICATION_INFO, 3000)
|
||||||
xbmcplugin.endOfDirectory(handle)
|
xbmcplugin.endOfDirectory(handle)
|
||||||
return
|
return
|
||||||
|
|
||||||
# Pro Serie nur den zuletzt gesehenen Eintrag behalten (History ist absteigend sortiert)
|
seen: dict[str, object] = {item.title: item for item in watched if item.title}
|
||||||
seen: dict[str, object] = {}
|
|
||||||
for item in history:
|
|
||||||
if item.title and item.title not in seen:
|
|
||||||
seen[item.title] = item
|
|
||||||
|
|
||||||
if not seen:
|
if not seen:
|
||||||
xbmcgui.Dialog().notification("Trakt", "Keine History vorhanden.", xbmcgui.NOTIFICATION_INFO, 3000)
|
xbmcgui.Dialog().notification("Trakt", "Keine gesehenen Serien vorhanden.", xbmcgui.NOTIFICATION_INFO, 3000)
|
||||||
xbmcplugin.endOfDirectory(handle)
|
xbmcplugin.endOfDirectory(handle)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# TMDB-Artwork fuer alle Serien parallel prefetchen
|
||||||
|
tmdb_prefetched = _tmdb_labels_and_art_bulk(list(seen.keys())) if _tmdb_enabled() else {}
|
||||||
|
|
||||||
for last in seen.values():
|
for last in seen.values():
|
||||||
next_season = last.season
|
# Staffelwechsel erkennen: wenn last.episode die höchste gesehene Episode
|
||||||
next_ep = last.episode + 1
|
# der aktuellen Staffel ist und eine höhere Staffel existiert → S+1 E01
|
||||||
|
seasons_watched: dict[int, int] = getattr(last, "seasons_watched", {})
|
||||||
match = _trakt_find_in_plugins(last.title)
|
max_ep_in_season = seasons_watched.get(last.season, 0)
|
||||||
|
next_seasons = sorted(s for s in seasons_watched if s > last.season)
|
||||||
# Wenn kein Plugin-Match: Suchaktion anbieten (kein Episode-Overflow-Problem)
|
if max_ep_in_season > 0 and last.episode >= max_ep_in_season and next_seasons:
|
||||||
if not match:
|
next_season = next_seasons[0]
|
||||||
label = f"{last.title} \u2013 S{next_season:02d}E{next_ep:02d}"
|
next_ep = 1
|
||||||
sub = f"(zuletzt: S{last.season:02d}E{last.episode:02d})"
|
else:
|
||||||
display_label = f"{label} {sub}"
|
next_season = last.season
|
||||||
info_labels: dict[str, object] = {
|
next_ep = last.episode + 1
|
||||||
"title": display_label,
|
|
||||||
"tvshowtitle": last.title,
|
|
||||||
"mediatype": "episode",
|
|
||||||
}
|
|
||||||
if last.year:
|
|
||||||
info_labels["year"] = last.year
|
|
||||||
_, art, _ = _tmdb_labels_and_art(last.title)
|
|
||||||
_add_directory_item(handle, display_label, "search", {"query": last.title}, is_folder=True, info_labels=info_labels, art=art)
|
|
||||||
continue
|
|
||||||
|
|
||||||
plugin_name, matched_title = match
|
|
||||||
# Prüfe ob die nächste Episode im Plugin tatsächlich existiert
|
|
||||||
plugin = _discover_plugins().get(plugin_name)
|
|
||||||
episodes_getter = getattr(plugin, "episodes_for_season", None) if plugin else None
|
|
||||||
if callable(episodes_getter):
|
|
||||||
try:
|
|
||||||
ep_list = episodes_getter(matched_title, next_season) or []
|
|
||||||
if next_ep > len(ep_list):
|
|
||||||
# Letzte Folge der Staffel war die letzte – nächste Staffel, Folge 1
|
|
||||||
next_season += 1
|
|
||||||
next_ep = 1
|
|
||||||
except Exception:
|
|
||||||
pass
|
|
||||||
|
|
||||||
label = f"{last.title} \u2013 S{next_season:02d}E{next_ep:02d}"
|
label = f"{last.title} \u2013 S{next_season:02d}E{next_ep:02d}"
|
||||||
sub = f"(zuletzt: S{last.season:02d}E{last.episode:02d})"
|
sub = f"(zuletzt: S{last.season:02d}E{last.episode:02d})"
|
||||||
display_label = f"{label} {sub}"
|
display_label = f"{label} {sub}"
|
||||||
|
|
||||||
info_labels = {
|
info_labels: dict[str, object] = {
|
||||||
"title": display_label,
|
"title": display_label,
|
||||||
"tvshowtitle": last.title,
|
"tvshowtitle": last.title,
|
||||||
"season": next_season,
|
"season": next_season,
|
||||||
@@ -5221,16 +5304,10 @@ def _show_trakt_continue_watching() -> None:
|
|||||||
if last.year:
|
if last.year:
|
||||||
info_labels["year"] = last.year
|
info_labels["year"] = last.year
|
||||||
|
|
||||||
_, art, _ = _tmdb_labels_and_art(last.title)
|
_, art, _ = tmdb_prefetched.get(last.title, ({}, {}, []))
|
||||||
|
_add_directory_item(handle, display_label, "search", {"query": last.title}, is_folder=True, info_labels=info_labels, art=art)
|
||||||
|
|
||||||
params: dict[str, str] = {
|
xbmcplugin.endOfDirectory(handle, cacheToDisc=False)
|
||||||
"plugin": plugin_name,
|
|
||||||
"title": matched_title,
|
|
||||||
"season": f"Staffel {next_season}",
|
|
||||||
}
|
|
||||||
_add_directory_item(handle, display_label, "episodes", params, is_folder=True, info_labels=info_labels, art=art)
|
|
||||||
|
|
||||||
xbmcplugin.endOfDirectory(handle)
|
|
||||||
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
@@ -5479,6 +5556,11 @@ def _route_random_title(params: dict[str, str]) -> None:
|
|||||||
_play_random_title(params.get("plugin", ""))
|
_play_random_title(params.get("plugin", ""))
|
||||||
|
|
||||||
|
|
||||||
|
@_router.route("trakt_menu")
|
||||||
|
def _route_trakt_menu(params: dict[str, str]) -> None:
|
||||||
|
_show_trakt_menu()
|
||||||
|
|
||||||
|
|
||||||
@_router.route("trakt_auth")
|
@_router.route("trakt_auth")
|
||||||
def _route_trakt_auth(params: dict[str, str]) -> None:
|
def _route_trakt_auth(params: dict[str, str]) -> None:
|
||||||
_trakt_authorize()
|
_trakt_authorize()
|
||||||
@@ -5552,12 +5634,47 @@ def _route_fallback(params: dict[str, str]) -> None:
|
|||||||
_show_root_menu()
|
_show_root_menu()
|
||||||
|
|
||||||
|
|
||||||
|
def _maybe_show_changelog() -> None:
|
||||||
|
"""Zeigt beim ersten Start nach einem Update das Benutzer-Changelog an."""
|
||||||
|
try:
|
||||||
|
current_version = str(_get_addon().getAddonInfo("version") or "").strip()
|
||||||
|
last_shown = _get_setting_string("changelog_last_shown_version").strip()
|
||||||
|
if not current_version or current_version == last_shown:
|
||||||
|
return
|
||||||
|
changelog_path = Path(__file__).parent / "CHANGELOG-USER.md"
|
||||||
|
if not changelog_path.exists():
|
||||||
|
return
|
||||||
|
text = changelog_path.read_text(encoding="utf-8")
|
||||||
|
# Ersten Abschnitt (neueste Version) extrahieren
|
||||||
|
lines = text.splitlines()
|
||||||
|
section: list[str] = []
|
||||||
|
for line in lines:
|
||||||
|
if line.startswith("## ") and section:
|
||||||
|
break
|
||||||
|
section.append(line)
|
||||||
|
content = "\n".join(section).strip()
|
||||||
|
if not content:
|
||||||
|
return
|
||||||
|
viewer = getattr(xbmcgui.Dialog(), "textviewer", None)
|
||||||
|
if callable(viewer):
|
||||||
|
try:
|
||||||
|
viewer("Was ist neu?", content)
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
_get_addon().setSetting("changelog_last_shown_version", current_version)
|
||||||
|
except Exception as exc:
|
||||||
|
_log(f"Changelog-Anzeige fehlgeschlagen: {exc}", xbmc.LOGWARNING)
|
||||||
|
|
||||||
|
|
||||||
def run() -> None:
|
def run() -> None:
|
||||||
params = _parse_params()
|
params = _parse_params()
|
||||||
action = params.get("action")
|
action = params.get("action")
|
||||||
_log(f"Action: {action}", xbmc.LOGDEBUG)
|
_log(f"Action: {action}", xbmc.LOGDEBUG)
|
||||||
_maybe_run_auto_update_check(action)
|
_maybe_run_auto_update_check(action)
|
||||||
_maybe_auto_install_resolveurl(action)
|
_maybe_auto_install_resolveurl(action)
|
||||||
|
_sync_trakt_status_setting()
|
||||||
|
if not action:
|
||||||
|
_maybe_show_changelog()
|
||||||
_router.dispatch(action=action, params=params)
|
_router.dispatch(action=action, params=params)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,6 @@ else: # pragma: no cover
|
|||||||
|
|
||||||
|
|
||||||
SETTING_BASE_URL = "serienstream_base_url"
|
SETTING_BASE_URL = "serienstream_base_url"
|
||||||
SETTING_CATALOG_SEARCH = "serienstream_catalog_search"
|
|
||||||
DEFAULT_BASE_URL = "https://s.to"
|
DEFAULT_BASE_URL = "https://s.to"
|
||||||
DEFAULT_PREFERRED_HOSTERS = ["voe"]
|
DEFAULT_PREFERRED_HOSTERS = ["voe"]
|
||||||
DEFAULT_TIMEOUT = 20
|
DEFAULT_TIMEOUT = 20
|
||||||
@@ -80,10 +79,7 @@ HEADERS = {
|
|||||||
SESSION_CACHE_TTL_SECONDS = 300
|
SESSION_CACHE_TTL_SECONDS = 300
|
||||||
SESSION_CACHE_PREFIX = "viewit.serienstream"
|
SESSION_CACHE_PREFIX = "viewit.serienstream"
|
||||||
SESSION_CACHE_MAX_TITLE_URLS = 800
|
SESSION_CACHE_MAX_TITLE_URLS = 800
|
||||||
CATALOG_SEARCH_TTL_SECONDS = 600
|
|
||||||
CATALOG_SEARCH_CACHE_KEY = "catalog_index"
|
|
||||||
GENRE_LIST_PAGE_SIZE = 20
|
GENRE_LIST_PAGE_SIZE = 20
|
||||||
_CATALOG_INDEX_MEMORY: tuple[float, list["SeriesResult"]] = (0.0, [])
|
|
||||||
ProgressCallback = Optional[Callable[[str, int | None], Any]]
|
ProgressCallback = Optional[Callable[[str, int | None], Any]]
|
||||||
|
|
||||||
|
|
||||||
@@ -509,6 +505,14 @@ def _strip_tags(value: str) -> str:
|
|||||||
return re.sub(r"<[^>]+>", " ", value or "")
|
return re.sub(r"<[^>]+>", " ", value or "")
|
||||||
|
|
||||||
|
|
||||||
|
def _clean_collection_title(title: str) -> str:
|
||||||
|
cleaned = "".join(
|
||||||
|
ch for ch in title
|
||||||
|
if unicodedata.category(ch) not in ("So", "Sm", "Sk", "Sc", "Cs", "Co", "Cn")
|
||||||
|
)
|
||||||
|
return re.sub(r"\s+", " ", cleaned).strip()
|
||||||
|
|
||||||
|
|
||||||
def _search_series_api(query: str) -> list[SeriesResult]:
|
def _search_series_api(query: str) -> list[SeriesResult]:
|
||||||
query = (query or "").strip()
|
query = (query or "").strip()
|
||||||
if not query:
|
if not query:
|
||||||
@@ -575,8 +579,8 @@ def _search_series_server(query: str) -> list[SeriesResult]:
|
|||||||
if not query:
|
if not query:
|
||||||
return []
|
return []
|
||||||
base = _get_base_url()
|
base = _get_base_url()
|
||||||
search_url = f"{base}/search?q={quote(query)}"
|
search_url = f"{base}/suche?term={quote(query)}"
|
||||||
alt_url = f"{base}/suche?q={quote(query)}"
|
alt_url = f"{base}/search?term={quote(query)}"
|
||||||
for url in (search_url, alt_url):
|
for url in (search_url, alt_url):
|
||||||
try:
|
try:
|
||||||
body = _get_html_simple(url)
|
body = _get_html_simple(url)
|
||||||
@@ -606,158 +610,30 @@ def _search_series_server(query: str) -> list[SeriesResult]:
|
|||||||
continue
|
continue
|
||||||
seen_urls.add(url_abs)
|
seen_urls.add(url_abs)
|
||||||
results.append(SeriesResult(title=title, description="", url=url_abs))
|
results.append(SeriesResult(title=title, description="", url=url_abs))
|
||||||
|
filtered = [r for r in results if _matches_query(query, title=r.title)]
|
||||||
|
if filtered:
|
||||||
|
return filtered
|
||||||
if results:
|
if results:
|
||||||
return results
|
return results
|
||||||
api_results = _search_series_api(query)
|
|
||||||
if api_results:
|
|
||||||
return api_results
|
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
|
||||||
def _extract_catalog_index_from_html(body: str, *, progress_callback: ProgressCallback = None) -> list[SeriesResult]:
|
|
||||||
items: list[SeriesResult] = []
|
|
||||||
if not body:
|
|
||||||
return items
|
|
||||||
seen_urls: set[str] = set()
|
|
||||||
item_re = re.compile(
|
|
||||||
r"<li[^>]*class=[\"'][^\"']*series-item[^\"']*[\"'][^>]*>(.*?)</li>",
|
|
||||||
re.IGNORECASE | re.DOTALL,
|
|
||||||
)
|
|
||||||
anchor_re = re.compile(r"<a[^>]+href=[\"']([^\"']+)[\"'][^>]*>(.*?)</a>", re.IGNORECASE | re.DOTALL)
|
|
||||||
data_search_re = re.compile(r"data-search=[\"']([^\"']*)[\"']", re.IGNORECASE)
|
|
||||||
for idx, match in enumerate(item_re.finditer(body), start=1):
|
|
||||||
if idx == 1 or idx % 200 == 0:
|
|
||||||
_emit_progress(progress_callback, f"Katalog parsen {idx}", 62)
|
|
||||||
block = match.group(0)
|
|
||||||
inner = match.group(1) or ""
|
|
||||||
anchor_match = anchor_re.search(inner)
|
|
||||||
if not anchor_match:
|
|
||||||
continue
|
|
||||||
href = (anchor_match.group(1) or "").strip()
|
|
||||||
url = _absolute_url(href)
|
|
||||||
if not url or "/serie/" not in url or "/staffel-" in url or "/episode-" in url:
|
|
||||||
continue
|
|
||||||
if url in seen_urls:
|
|
||||||
continue
|
|
||||||
seen_urls.add(url)
|
|
||||||
title_raw = anchor_match.group(2) or ""
|
|
||||||
title = unescape(re.sub(r"\s+", " ", _strip_tags(title_raw))).strip()
|
|
||||||
if not title:
|
|
||||||
continue
|
|
||||||
search_match = data_search_re.search(block)
|
|
||||||
description = (search_match.group(1) or "").strip() if search_match else ""
|
|
||||||
items.append(SeriesResult(title=title, description=description, url=url))
|
|
||||||
return items
|
|
||||||
|
|
||||||
|
|
||||||
def _catalog_index_from_soup(soup: BeautifulSoupT) -> list[SeriesResult]:
|
|
||||||
items: list[SeriesResult] = []
|
|
||||||
if not soup:
|
|
||||||
return items
|
|
||||||
seen_urls: set[str] = set()
|
|
||||||
for item in soup.select("li.series-item"):
|
|
||||||
anchor = item.find("a", href=True)
|
|
||||||
if not anchor:
|
|
||||||
continue
|
|
||||||
href = (anchor.get("href") or "").strip()
|
|
||||||
url = _absolute_url(href)
|
|
||||||
if not url or "/serie/" not in url or "/staffel-" in url or "/episode-" in url:
|
|
||||||
continue
|
|
||||||
if url in seen_urls:
|
|
||||||
continue
|
|
||||||
seen_urls.add(url)
|
|
||||||
title = (anchor.get_text(" ", strip=True) or "").strip()
|
|
||||||
if not title:
|
|
||||||
continue
|
|
||||||
description = (item.get("data-search") or "").strip()
|
|
||||||
items.append(SeriesResult(title=title, description=description, url=url))
|
|
||||||
return items
|
|
||||||
|
|
||||||
|
|
||||||
def _load_catalog_index_from_cache() -> Optional[list[SeriesResult]]:
|
|
||||||
global _CATALOG_INDEX_MEMORY
|
|
||||||
expires_at, cached = _CATALOG_INDEX_MEMORY
|
|
||||||
if cached and expires_at > time.time():
|
|
||||||
return list(cached)
|
|
||||||
raw = _session_cache_get(CATALOG_SEARCH_CACHE_KEY)
|
|
||||||
if not isinstance(raw, list):
|
|
||||||
return None
|
|
||||||
items: list[SeriesResult] = []
|
|
||||||
for entry in raw:
|
|
||||||
if not isinstance(entry, list) or len(entry) < 2:
|
|
||||||
continue
|
|
||||||
title = str(entry[0] or "").strip()
|
|
||||||
url = str(entry[1] or "").strip()
|
|
||||||
description = str(entry[2] or "") if len(entry) > 2 else ""
|
|
||||||
cover = str(entry[3] or "").strip() if len(entry) > 3 else ""
|
|
||||||
if title and url:
|
|
||||||
items.append(SeriesResult(title=title, description=description, url=url, cover=cover))
|
|
||||||
if items:
|
|
||||||
_CATALOG_INDEX_MEMORY = (time.time() + CATALOG_SEARCH_TTL_SECONDS, list(items))
|
|
||||||
return items or None
|
|
||||||
|
|
||||||
|
|
||||||
def _store_catalog_index_in_cache(items: list[SeriesResult]) -> None:
|
|
||||||
global _CATALOG_INDEX_MEMORY
|
|
||||||
if not items:
|
|
||||||
return
|
|
||||||
_CATALOG_INDEX_MEMORY = (time.time() + CATALOG_SEARCH_TTL_SECONDS, list(items))
|
|
||||||
payload: list[list[str]] = []
|
|
||||||
for entry in items:
|
|
||||||
if not entry.title or not entry.url:
|
|
||||||
continue
|
|
||||||
payload.append([entry.title, entry.url, entry.description, entry.cover])
|
|
||||||
_session_cache_set(CATALOG_SEARCH_CACHE_KEY, payload, ttl_seconds=CATALOG_SEARCH_TTL_SECONDS)
|
|
||||||
|
|
||||||
|
|
||||||
def search_series(query: str, *, progress_callback: ProgressCallback = None) -> list[SeriesResult]:
|
def search_series(query: str, *, progress_callback: ProgressCallback = None) -> list[SeriesResult]:
|
||||||
"""Sucht Serien. Katalog-Suche (vollstaendig) oder API-Suche (max 10) je nach Setting."""
|
"""Sucht Serien. Server-Suche (/suche?term=) zuerst, API als Fallback."""
|
||||||
_ensure_requests()
|
_ensure_requests()
|
||||||
if not _normalize_search_text(query):
|
if not _normalize_search_text(query):
|
||||||
return []
|
return []
|
||||||
|
|
||||||
use_catalog = _get_setting_bool(SETTING_CATALOG_SEARCH, default=True)
|
# 1. Server-Suche (schnell, vollstaendig, direkte HTML-Suche)
|
||||||
|
_emit_progress(progress_callback, "Suche", 20)
|
||||||
if use_catalog:
|
|
||||||
_emit_progress(progress_callback, "Pruefe Such-Cache", 15)
|
|
||||||
cached = _load_catalog_index_from_cache()
|
|
||||||
if cached is not None:
|
|
||||||
matched_from_cache = [entry for entry in cached if entry.title and _matches_query(query, title=entry.title)]
|
|
||||||
_emit_progress(progress_callback, f"Cache-Treffer: {len(cached)}", 35)
|
|
||||||
if matched_from_cache:
|
|
||||||
return matched_from_cache
|
|
||||||
|
|
||||||
_emit_progress(progress_callback, "Lade Katalogseite", 42)
|
|
||||||
catalog_url = f"{_get_base_url()}/serien?by=genre"
|
|
||||||
items: list[SeriesResult] = []
|
|
||||||
try:
|
|
||||||
soup = _get_soup_simple(catalog_url)
|
|
||||||
items = _catalog_index_from_soup(soup)
|
|
||||||
except Exception:
|
|
||||||
body = _get_html_simple(catalog_url)
|
|
||||||
items = _extract_catalog_index_from_html(body, progress_callback=progress_callback)
|
|
||||||
if not items:
|
|
||||||
_emit_progress(progress_callback, "Fallback-Parser", 58)
|
|
||||||
soup = BeautifulSoup(body, "html.parser")
|
|
||||||
items = _catalog_index_from_soup(soup)
|
|
||||||
if items:
|
|
||||||
_store_catalog_index_in_cache(items)
|
|
||||||
_emit_progress(progress_callback, f"Filtere Treffer ({len(items)})", 70)
|
|
||||||
return [entry for entry in items if entry.title and _matches_query(query, title=entry.title)]
|
|
||||||
|
|
||||||
# API-Suche (primaer wenn Katalog deaktiviert, Fallback wenn Katalog leer)
|
|
||||||
_emit_progress(progress_callback, "API-Suche", 60)
|
|
||||||
api_results = _search_series_api(query)
|
|
||||||
if api_results:
|
|
||||||
_emit_progress(progress_callback, f"API-Treffer: {len(api_results)}", 80)
|
|
||||||
return api_results
|
|
||||||
|
|
||||||
_emit_progress(progress_callback, "Server-Suche", 85)
|
|
||||||
server_results = _search_series_server(query)
|
server_results = _search_series_server(query)
|
||||||
if server_results:
|
if server_results:
|
||||||
_emit_progress(progress_callback, f"Server-Treffer: {len(server_results)}", 95)
|
return server_results
|
||||||
return [entry for entry in server_results if entry.title and _matches_query(query, title=entry.title)]
|
|
||||||
return []
|
# 2. API-Suche (Fallback, max 10 Ergebnisse)
|
||||||
|
_emit_progress(progress_callback, "API-Suche", 60)
|
||||||
|
return _search_series_api(query)
|
||||||
|
|
||||||
|
|
||||||
def parse_series_catalog(soup: BeautifulSoupT) -> dict[str, list[SeriesResult]]:
|
def parse_series_catalog(soup: BeautifulSoupT) -> dict[str, list[SeriesResult]]:
|
||||||
@@ -1159,6 +1035,8 @@ class SerienstreamPlugin(BasisPlugin):
|
|||||||
self._latest_hoster_cache: dict[str, list[str]] = {}
|
self._latest_hoster_cache: dict[str, list[str]] = {}
|
||||||
self._series_metadata_cache: dict[str, tuple[dict[str, str], dict[str, str]]] = {}
|
self._series_metadata_cache: dict[str, tuple[dict[str, str], dict[str, str]]] = {}
|
||||||
self._series_metadata_full: set[str] = set()
|
self._series_metadata_full: set[str] = set()
|
||||||
|
self._collection_url_cache: dict[str, str] = {}
|
||||||
|
self._collection_has_more: bool = False
|
||||||
self.is_available = True
|
self.is_available = True
|
||||||
self.unavailable_reason: str | None = None
|
self.unavailable_reason: str | None = None
|
||||||
if not self._requests_available: # pragma: no cover - optional dependency
|
if not self._requests_available: # pragma: no cover - optional dependency
|
||||||
@@ -1252,7 +1130,7 @@ class SerienstreamPlugin(BasisPlugin):
|
|||||||
except Exception:
|
except Exception:
|
||||||
continue
|
continue
|
||||||
url = str(item.get("url") or "").strip()
|
url = str(item.get("url") or "").strip()
|
||||||
if number <= 0 or not url:
|
if number < 0 or not url:
|
||||||
continue
|
continue
|
||||||
seasons.append(SeasonInfo(number=number, url=url, episodes=[]))
|
seasons.append(SeasonInfo(number=number, url=url, episodes=[]))
|
||||||
if not seasons:
|
if not seasons:
|
||||||
@@ -1383,7 +1261,63 @@ class SerienstreamPlugin(BasisPlugin):
|
|||||||
|
|
||||||
def capabilities(self) -> set[str]:
|
def capabilities(self) -> set[str]:
|
||||||
"""Meldet unterstützte Features für Router-Menüs."""
|
"""Meldet unterstützte Features für Router-Menüs."""
|
||||||
return {"popular_series", "genres", "latest_episodes", "alpha"}
|
return {"popular_series", "genres", "latest_episodes", "alpha", "collections"}
|
||||||
|
|
||||||
|
def collections(self) -> list[str]:
|
||||||
|
"""Liefert Sammlungs-Namen von /sammlungen (Seite 1, für Paginierung)."""
|
||||||
|
return self._collections_page(1)
|
||||||
|
|
||||||
|
def _collections_page(self, page: int = 1) -> list[str]:
|
||||||
|
"""Liefert eine Seite mit Sammlungs-Namen von /sammlungen (paginiert)."""
|
||||||
|
if not self._requests_available:
|
||||||
|
return []
|
||||||
|
base = _get_base_url()
|
||||||
|
names: list[str] = []
|
||||||
|
url_map: dict[str, str] = {}
|
||||||
|
url = f"{base}/sammlungen" if page == 1 else f"{base}/sammlungen?page={page}"
|
||||||
|
soup = _get_soup_simple(url)
|
||||||
|
for a in soup.select('a[href*="/sammlung/"]'):
|
||||||
|
h2 = a.find("h2")
|
||||||
|
if not h2:
|
||||||
|
continue
|
||||||
|
title = _clean_collection_title(h2.get_text(strip=True))
|
||||||
|
href = (a.get("href") or "").strip()
|
||||||
|
if title and href:
|
||||||
|
url_map[title] = _absolute_url(href)
|
||||||
|
names.append(title)
|
||||||
|
if url_map:
|
||||||
|
existing = _session_cache_get("collection_urls")
|
||||||
|
if isinstance(existing, dict):
|
||||||
|
existing.update(url_map)
|
||||||
|
_session_cache_set("collection_urls", existing)
|
||||||
|
else:
|
||||||
|
_session_cache_set("collection_urls", url_map)
|
||||||
|
names.sort(key=lambda t: t.casefold())
|
||||||
|
return names
|
||||||
|
|
||||||
|
def titles_for_collection(self, collection: str, page: int = 1) -> list[str]:
|
||||||
|
"""Liefert Serien-Titel einer Sammlung (paginiert)."""
|
||||||
|
if not self._requests_available:
|
||||||
|
return []
|
||||||
|
url_map = _session_cache_get("collection_urls")
|
||||||
|
if isinstance(url_map, dict):
|
||||||
|
self._collection_url_cache.update(url_map)
|
||||||
|
url = self._collection_url_cache.get(collection)
|
||||||
|
if not url:
|
||||||
|
return []
|
||||||
|
if page > 1:
|
||||||
|
url = f"{url}?page={page}"
|
||||||
|
base_url = self._collection_url_cache[collection]
|
||||||
|
soup = _get_soup_simple(url)
|
||||||
|
titles: list[str] = []
|
||||||
|
for a in soup.select('h6 a[href*="/serie/"]'):
|
||||||
|
title = a.get_text(strip=True)
|
||||||
|
href = (a.get("href") or "").strip()
|
||||||
|
if title and href:
|
||||||
|
self._remember_series_result(title, _absolute_url(href), "")
|
||||||
|
titles.append(title)
|
||||||
|
self._collection_has_more = bool(soup.select(f'a[href*="?page={page + 1}"]'))
|
||||||
|
return titles
|
||||||
|
|
||||||
def popular_series(self) -> list[str]:
|
def popular_series(self) -> list[str]:
|
||||||
"""Liefert die Titel der beliebten Serien (Quelle: `/beliebte-serien`)."""
|
"""Liefert die Titel der beliebten Serien (Quelle: `/beliebte-serien`)."""
|
||||||
@@ -1794,6 +1728,8 @@ class SerienstreamPlugin(BasisPlugin):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _season_label(number: int) -> str:
|
def _season_label(number: int) -> str:
|
||||||
|
if number == 0:
|
||||||
|
return "Filme"
|
||||||
return f"Staffel {number}"
|
return f"Staffel {number}"
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@@ -1808,6 +1744,8 @@ class SerienstreamPlugin(BasisPlugin):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _parse_season_number(label: str) -> int | None:
|
def _parse_season_number(label: str) -> int | None:
|
||||||
|
if (label or "").strip().casefold() == "filme":
|
||||||
|
return 0
|
||||||
digits = "".join(ch for ch in label if ch.isdigit())
|
digits = "".join(ch for ch in label if ch.isdigit())
|
||||||
if not digits:
|
if not digits:
|
||||||
return None
|
return None
|
||||||
|
|||||||
@@ -1,42 +1,82 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<settings>
|
<settings>
|
||||||
<category label="Quellen">
|
|
||||||
<setting id="serienstream_base_url" type="text" label="SerienStream Basis-URL" default="https://s.to" />
|
<category label="Wiedergabe">
|
||||||
<setting id="serienstream_catalog_search" type="bool" label="SerienStream: Katalog-Suche (mehr Ergebnisse, langsamer)" default="true" />
|
<setting id="autoplay_enabled" type="bool" label="Autoplay (bevorzugten Hoster automatisch waehlen)" default="false" />
|
||||||
<setting id="aniworld_base_url" type="text" label="AniWorld Basis-URL" default="https://aniworld.to" />
|
<setting id="preferred_hoster" type="enum" label="Bevorzugter Hoster" default="0" values="voe|streamtape|doodstream|vidoza|mixdrop|supervideo|dropload" enable="eq(-1,true)" />
|
||||||
<setting id="topstream_base_url" type="text" label="TopStream Basis-URL" default="https://topstreamfilm.live" />
|
</category>
|
||||||
<setting id="einschalten_base_url" type="text" label="Einschalten Basis-URL" default="https://einschalten.in" />
|
|
||||||
<setting id="filmpalast_base_url" type="text" label="Filmpalast Basis-URL" default="https://filmpalast.to" />
|
<category label="Globale Suche">
|
||||||
<setting id="doku_streams_base_url" type="text" label="Doku-Streams Basis-URL" default="https://doku-streams.com" />
|
<setting id="search_plugin_serienstream" type="bool" label="Serienstream durchsuchen" default="true" />
|
||||||
|
<setting id="search_plugin_aniworld" type="bool" label="Aniworld durchsuchen" default="true" />
|
||||||
|
<setting id="search_plugin_topstreamfilm" type="bool" label="Topstreamfilm durchsuchen" default="true" />
|
||||||
|
<setting id="search_plugin_filmpalast" type="bool" label="Filmpalast durchsuchen" default="true" />
|
||||||
|
<setting id="search_plugin_moflix" type="bool" label="Moflix durchsuchen" default="true" />
|
||||||
|
<setting id="search_plugin_kkiste" type="bool" label="KKiste durchsuchen" default="true" />
|
||||||
|
<setting id="search_plugin_hdfilme" type="bool" label="HDFilme durchsuchen" default="true" />
|
||||||
|
<setting id="search_plugin_einschalten" type="bool" label="Einschalten durchsuchen" default="true" />
|
||||||
|
<setting id="search_plugin_doku_streams" type="bool" label="Doku-Streams durchsuchen" default="true" />
|
||||||
|
<setting id="search_plugin_netzkino" type="bool" label="NetzkKino durchsuchen" default="true" />
|
||||||
|
<setting id="search_plugin_youtube" type="bool" label="YouTube durchsuchen" default="false" />
|
||||||
|
</category>
|
||||||
|
|
||||||
|
<category label="Trakt">
|
||||||
|
<setting id="trakt_enabled" type="bool" label="Trakt aktivieren" default="false" />
|
||||||
|
<setting id="trakt_status" type="text" label="Status" default="Nicht verbunden" enable="false" />
|
||||||
|
<setting id="trakt_auth" type="action" label="Trakt autorisieren" action="RunPlugin(plugin://plugin.video.viewit/?action=trakt_auth)" option="close" />
|
||||||
|
<setting id="trakt_scrobble" type="bool" label="Scrobbling aktivieren" default="true" enable="eq(-3,true)" />
|
||||||
|
<setting id="trakt_auto_watchlist" type="bool" label="Geschaute Serien automatisch zur Watchlist hinzufuegen" default="false" enable="eq(-4,true)" />
|
||||||
|
<setting id="trakt_access_token" type="text" label="" default="" visible="false" />
|
||||||
|
<setting id="trakt_refresh_token" type="text" label="" default="" visible="false" />
|
||||||
|
<setting id="trakt_token_expires" type="text" label="" default="0" visible="false" />
|
||||||
</category>
|
</category>
|
||||||
|
|
||||||
<category label="Metadaten">
|
<category label="Metadaten">
|
||||||
<setting id="serienstream_metadata_source" type="enum" label="SerienStream Metadatenquelle" default="0" values="Automatisch|Quelle|TMDB|Mischen" />
|
|
||||||
<setting id="aniworld_metadata_source" type="enum" label="AniWorld Metadatenquelle" default="0" values="Automatisch|Quelle|TMDB|Mischen" />
|
|
||||||
<setting id="topstreamfilm_metadata_source" type="enum" label="TopStream Metadatenquelle" default="0" values="Automatisch|Quelle|TMDB|Mischen" />
|
|
||||||
<setting id="einschalten_metadata_source" type="enum" label="Einschalten Metadatenquelle" default="0" values="Automatisch|Quelle|TMDB|Mischen" />
|
|
||||||
<setting id="filmpalast_metadata_source" type="enum" label="Filmpalast Metadatenquelle" default="0" values="Automatisch|Quelle|TMDB|Mischen" />
|
|
||||||
<setting id="doku_streams_metadata_source" type="enum" label="Doku-Streams Metadatenquelle" default="0" values="Automatisch|Quelle|TMDB|Mischen" />
|
|
||||||
<setting id="kkiste_metadata_source" type="enum" label="KKiste Metadatenquelle" default="0" values="Automatisch|Quelle|TMDB|Mischen" />
|
|
||||||
<setting id="moflix_metadata_source" type="enum" label="Moflix Metadatenquelle" default="0" values="Automatisch|Quelle|TMDB|Mischen" />
|
|
||||||
<setting id="tmdb_enabled" type="bool" label="TMDB aktivieren" default="true" />
|
<setting id="tmdb_enabled" type="bool" label="TMDB aktivieren" default="true" />
|
||||||
<setting id="tmdb_language" type="text" label="TMDB Sprache (z. B. de-DE)" default="de-DE" />
|
<setting id="tmdb_language" type="text" label="TMDB Sprache (z. B. de-DE)" default="de-DE" enable="eq(-1,true)" />
|
||||||
<setting id="tmdb_show_plot" type="bool" label="TMDB Beschreibung anzeigen" default="true" />
|
<setting id="tmdb_show_plot" type="bool" label="Beschreibung anzeigen" default="true" enable="eq(-2,true)" />
|
||||||
<setting id="tmdb_show_art" type="bool" label="TMDB Poster und Vorschaubild anzeigen" default="true" />
|
<setting id="tmdb_show_art" type="bool" label="Poster und Vorschaubild anzeigen" default="true" enable="eq(-3,true)" />
|
||||||
<setting id="tmdb_show_fanart" type="bool" label="TMDB Fanart/Backdrop anzeigen" default="true" />
|
<setting id="tmdb_show_fanart" type="bool" label="Fanart/Backdrop anzeigen" default="true" enable="eq(-4,true)" />
|
||||||
<setting id="tmdb_show_rating" type="bool" label="TMDB Bewertung anzeigen" default="true" />
|
<setting id="tmdb_show_rating" type="bool" label="Bewertung anzeigen" default="true" enable="eq(-5,true)" />
|
||||||
<setting id="tmdb_show_votes" type="bool" label="TMDB Stimmen anzeigen" default="false" />
|
<setting id="tmdb_show_votes" type="bool" label="Stimmen anzeigen" default="false" enable="eq(-6,true)" />
|
||||||
|
<setting type="lsep" label="Metadatenquellen" />
|
||||||
|
<setting id="serienstream_metadata_source" type="enum" label="SerienStream" default="0" values="Automatisch|Quelle|TMDB|Mischen" />
|
||||||
|
<setting id="aniworld_metadata_source" type="enum" label="AniWorld" default="0" values="Automatisch|Quelle|TMDB|Mischen" />
|
||||||
|
<setting id="topstreamfilm_metadata_source" type="enum" label="TopStream" default="0" values="Automatisch|Quelle|TMDB|Mischen" />
|
||||||
|
<setting id="einschalten_metadata_source" type="enum" label="Einschalten" default="0" values="Automatisch|Quelle|TMDB|Mischen" />
|
||||||
|
<setting id="filmpalast_metadata_source" type="enum" label="Filmpalast" default="0" values="Automatisch|Quelle|TMDB|Mischen" />
|
||||||
|
<setting id="doku_streams_metadata_source" type="enum" label="Doku-Streams" default="0" values="Automatisch|Quelle|TMDB|Mischen" />
|
||||||
|
<setting id="kkiste_metadata_source" type="enum" label="KKiste" default="0" values="Automatisch|Quelle|TMDB|Mischen" />
|
||||||
|
<setting id="moflix_metadata_source" type="enum" label="Moflix" default="0" values="Automatisch|Quelle|TMDB|Mischen" />
|
||||||
</category>
|
</category>
|
||||||
|
|
||||||
<category label="TMDB Erweitert">
|
<category label="Updates">
|
||||||
<setting id="tmdb_api_key" type="text" label="TMDB API Key (optional)" default="" />
|
<setting id="update_installed_version" type="text" label="Installierte Version" default="-" enable="false" />
|
||||||
<setting id="tmdb_api_key_active" type="text" label="Aktiver TMDB API Key" default="" />
|
<setting id="update_available_selected" type="text" label="Verfuegbar (gewaehlter Kanal)" default="-" enable="false" />
|
||||||
<setting id="tmdb_prefetch_concurrency" type="number" label="TMDB: gleichzeitige Anfragen (1-20)" default="6" />
|
<setting id="update_channel" type="enum" label="Update-Kanal" default="1" values="Main|Nightly|Custom|Dev" />
|
||||||
<setting id="tmdb_show_cast" type="bool" label="TMDB Besetzung anzeigen" default="false" />
|
<setting id="apply_update_channel" type="action" label="Update-Kanal jetzt anwenden" action="RunPlugin(plugin://plugin.video.viewit/?action=apply_update_channel)" option="close" />
|
||||||
<setting id="tmdb_show_episode_cast" type="bool" label="TMDB Besetzung pro Episode anzeigen" default="false" />
|
<setting id="auto_update_enabled" type="bool" label="Automatische Updates (beim Start pruefen)" default="false" />
|
||||||
<setting id="tmdb_genre_metadata" type="bool" label="TMDB Daten in Genre-Listen anzeigen" default="false" />
|
<setting id="auto_update_interval" type="enum" label="Update-Pruefintervall" default="1" values="1 Stunde|6 Stunden|24 Stunden" enable="eq(-1,true)" />
|
||||||
<setting id="tmdb_log_requests" type="bool" label="TMDB API-Anfragen loggen" default="false" />
|
<setting id="select_update_version" type="action" label="Version waehlen und installieren" action="RunPlugin(plugin://plugin.video.viewit/?action=select_update_version)" option="close" />
|
||||||
<setting id="tmdb_log_responses" type="bool" label="TMDB API-Antworten loggen" default="false" />
|
<setting type="lsep" label="ResolveURL" />
|
||||||
|
<setting id="install_resolveurl" type="action" label="ResolveURL installieren/reparieren" action="RunPlugin(plugin://plugin.video.viewit/?action=install_resolveurl)" option="close" />
|
||||||
|
<setting id="resolveurl_auto_install" type="bool" label="ResolveURL automatisch installieren (beim Start pruefen)" default="true" />
|
||||||
|
<setting id="resolveurl_status" type="text" label="ResolveURL Status" default="-" enable="false" />
|
||||||
|
<setting type="lsep" label="Kanaldetails" />
|
||||||
|
<setting id="update_active_channel" type="text" label="Aktiver Kanal" default="-" enable="false" />
|
||||||
|
<setting id="update_active_repo_url" type="text" label="Aktive Repo URL" default="-" enable="false" />
|
||||||
|
<setting id="update_repo_url_main" type="text" label="Main URL (addons.xml)" default="https://gitea.it-drui.de/viewit/ViewIT-Kodi-Repo/raw/branch/main/addons.xml" />
|
||||||
|
<setting id="update_repo_url_nightly" type="text" label="Nightly URL (addons.xml)" default="https://gitea.it-drui.de/viewit/ViewIT-Kodi-Repo/raw/branch/nightly/addons.xml" />
|
||||||
|
<setting id="update_repo_url_dev" type="text" label="Dev URL (addons.xml)" default="https://gitea.it-drui.de/viewit/ViewIT-Kodi-Repo/raw/branch/dev/addons.xml" />
|
||||||
|
<setting id="update_repo_url" type="text" label="Custom URL (addons.xml)" default="https://gitea.it-drui.de/viewit/ViewIT-Kodi-Repo/raw/branch/nightly/addons.xml" />
|
||||||
|
<setting id="auto_update_last_ts" type="text" label="" default="0" visible="false" />
|
||||||
|
<setting id="resolveurl_last_ts" type="text" label="" default="0" visible="false" />
|
||||||
|
</category>
|
||||||
|
|
||||||
|
<category label="YouTube">
|
||||||
|
<setting id="youtube_quality" type="enum" label="YouTube Videoqualitaet" default="0" values="Beste|1080p|720p|480p|360p" />
|
||||||
|
<setting id="install_ytdlp" type="action" label="yt-dlp installieren/reparieren" action="RunPlugin(plugin://plugin.video.viewit/?action=install_ytdlp)" option="close" />
|
||||||
|
<setting id="ytdlp_status" type="text" label="yt-dlp Status" default="-" enable="false" />
|
||||||
</category>
|
</category>
|
||||||
|
|
||||||
<category label="Anzeige">
|
<category label="Anzeige">
|
||||||
@@ -50,43 +90,27 @@
|
|||||||
<setting id="einschalten_max_page_items" type="number" label="Einschalten: Max. Eintraege pro Seite" default="15" />
|
<setting id="einschalten_max_page_items" type="number" label="Einschalten: Max. Eintraege pro Seite" default="15" />
|
||||||
</category>
|
</category>
|
||||||
|
|
||||||
<category label="Wiedergabe">
|
<category label="TMDB Erweitert">
|
||||||
<setting id="autoplay_enabled" type="bool" label="Autoplay (bevorzugten Hoster automatisch waehlen)" default="false" />
|
<setting id="tmdb_api_key" type="text" label="TMDB API Key (optional)" default="" />
|
||||||
<setting id="preferred_hoster" type="text" label="Bevorzugter Hoster" default="voe" />
|
<setting id="tmdb_api_key_active" type="text" label="Aktiver TMDB API Key" default="" enable="false" />
|
||||||
|
<setting id="tmdb_prefetch_concurrency" type="number" label="TMDB: gleichzeitige Anfragen (1-20)" default="6" />
|
||||||
|
<setting id="tmdb_show_cast" type="bool" label="TMDB Besetzung anzeigen" default="false" />
|
||||||
|
<setting id="tmdb_show_episode_cast" type="bool" label="TMDB Besetzung pro Episode anzeigen" default="false" />
|
||||||
|
<setting id="tmdb_genre_metadata" type="bool" label="TMDB Daten in Genre-Listen anzeigen" default="false" />
|
||||||
|
<setting id="tmdb_log_requests" type="bool" label="TMDB API-Anfragen loggen" default="false" />
|
||||||
|
<setting id="tmdb_log_responses" type="bool" label="TMDB API-Antworten loggen" default="false" />
|
||||||
</category>
|
</category>
|
||||||
|
|
||||||
<category label="Updates">
|
<category label="Quellen">
|
||||||
<setting id="update_channel" type="enum" label="Update-Kanal" default="1" values="Main|Nightly|Custom|Dev" />
|
<setting id="serienstream_base_url" type="text" label="SerienStream Basis-URL" default="https://s.to" />
|
||||||
<setting id="apply_update_channel" type="action" label="Update-Kanal jetzt anwenden" action="RunPlugin(plugin://plugin.video.viewit/?action=apply_update_channel)" option="close" />
|
<setting id="aniworld_base_url" type="text" label="AniWorld Basis-URL" default="https://aniworld.to" />
|
||||||
<setting id="auto_update_enabled" type="bool" label="Automatische Updates (beim Start pruefen)" default="false" />
|
<setting id="topstream_base_url" type="text" label="TopStream Basis-URL" default="https://topstreamfilm.live" />
|
||||||
<setting id="auto_update_interval" type="enum" label="Update-Pruefintervall" default="1" values="1 Stunde|6 Stunden|24 Stunden" />
|
<setting id="einschalten_base_url" type="text" label="Einschalten Basis-URL" default="https://einschalten.in" />
|
||||||
<setting id="select_update_version" type="action" label="Version waehlen und installieren" action="RunPlugin(plugin://plugin.video.viewit/?action=select_update_version)" option="close" />
|
<setting id="filmpalast_base_url" type="text" label="Filmpalast Basis-URL" default="https://filmpalast.to" />
|
||||||
<setting id="install_resolveurl" type="action" label="ResolveURL installieren/reparieren" action="RunPlugin(plugin://plugin.video.viewit/?action=install_resolveurl)" option="close" />
|
<setting id="doku_streams_base_url" type="text" label="Doku-Streams Basis-URL" default="https://doku-streams.com" />
|
||||||
<setting id="resolveurl_auto_install" type="bool" label="ResolveURL automatisch installieren (beim Start pruefen)" default="true" />
|
|
||||||
<setting id="update_installed_version" type="text" label="Installierte Version" default="-" enable="false" />
|
|
||||||
<setting id="update_available_selected" type="text" label="Verfuegbar (gewaehlter Kanal)" default="-" enable="false" />
|
|
||||||
<setting id="resolveurl_status" type="text" label="ResolveURL Status" default="-" enable="false" />
|
|
||||||
<setting id="update_active_channel" type="text" label="Aktiver Kanal" default="-" enable="false" />
|
|
||||||
<setting id="update_active_repo_url" type="text" label="Aktive Repo URL" default="-" enable="false" />
|
|
||||||
<setting id="update_repo_url_main" type="text" label="Main URL (addons.xml)" default="https://gitea.it-drui.de/viewit/ViewIT-Kodi-Repo/raw/branch/main/addons.xml" />
|
|
||||||
<setting id="update_repo_url_nightly" type="text" label="Nightly URL (addons.xml)" default="https://gitea.it-drui.de/viewit/ViewIT-Kodi-Repo/raw/branch/nightly/addons.xml" />
|
|
||||||
<setting id="update_repo_url_dev" type="text" label="Dev URL (addons.xml)" default="https://gitea.it-drui.de/viewit/ViewIT-Kodi-Repo/raw/branch/dev/addons.xml" />
|
|
||||||
<setting id="update_repo_url" type="text" label="Custom URL (addons.xml)" default="https://gitea.it-drui.de/viewit/ViewIT-Kodi-Repo/raw/branch/nightly/addons.xml" />
|
|
||||||
<setting id="auto_update_last_ts" type="text" label="Auto-Update letzte Pruefung (intern)" default="0" visible="false" />
|
|
||||||
<setting id="resolveurl_last_ts" type="text" label="ResolveURL letzte Pruefung (intern)" default="0" visible="false" />
|
|
||||||
</category>
|
</category>
|
||||||
|
|
||||||
<category label="Trakt">
|
<category label="Debug">
|
||||||
<setting id="trakt_enabled" type="bool" label="Trakt aktivieren" default="false" />
|
|
||||||
<setting id="trakt_auth" type="action" label="Trakt autorisieren" action="RunPlugin(plugin://plugin.video.viewit/?action=trakt_auth)" option="close" />
|
|
||||||
<setting id="trakt_scrobble" type="bool" label="Scrobbling aktivieren" default="true" />
|
|
||||||
<setting id="trakt_auto_watchlist" type="bool" label="Geschaute Serien automatisch zur Watchlist hinzufuegen" default="false" />
|
|
||||||
<setting id="trakt_access_token" type="text" label="" default="" visible="false" />
|
|
||||||
<setting id="trakt_refresh_token" type="text" label="" default="" visible="false" />
|
|
||||||
<setting id="trakt_token_expires" type="text" label="" default="0" visible="false" />
|
|
||||||
</category>
|
|
||||||
|
|
||||||
<category label="Debug Global">
|
|
||||||
<setting id="debug_log_urls" type="bool" label="URLs mitschreiben (global)" default="false" />
|
<setting id="debug_log_urls" type="bool" label="URLs mitschreiben (global)" default="false" />
|
||||||
<setting id="debug_dump_html" type="bool" label="HTML speichern (global)" default="false" />
|
<setting id="debug_dump_html" type="bool" label="HTML speichern (global)" default="false" />
|
||||||
<setting id="debug_show_url_info" type="bool" label="Aktuelle URL anzeigen (global)" default="false" />
|
<setting id="debug_show_url_info" type="bool" label="Aktuelle URL anzeigen (global)" default="false" />
|
||||||
@@ -94,38 +118,31 @@
|
|||||||
<setting id="log_max_mb" type="number" label="URL-Log: maximale Dateigroesse (MB)" default="5" />
|
<setting id="log_max_mb" type="number" label="URL-Log: maximale Dateigroesse (MB)" default="5" />
|
||||||
<setting id="log_max_files" type="number" label="URL-Log: Anzahl alter Dateien" default="3" />
|
<setting id="log_max_files" type="number" label="URL-Log: Anzahl alter Dateien" default="3" />
|
||||||
<setting id="dump_max_files" type="number" label="HTML: maximale Dateien pro Plugin" default="200" />
|
<setting id="dump_max_files" type="number" label="HTML: maximale Dateien pro Plugin" default="200" />
|
||||||
</category>
|
<setting type="lsep" label="Pro Quelle" />
|
||||||
|
|
||||||
<category label="Debug Quellen">
|
|
||||||
<setting id="log_urls_serienstream" type="bool" label="SerienStream: URLs mitschreiben" default="false" />
|
<setting id="log_urls_serienstream" type="bool" label="SerienStream: URLs mitschreiben" default="false" />
|
||||||
<setting id="dump_html_serienstream" type="bool" label="SerienStream: HTML speichern" default="false" />
|
<setting id="dump_html_serienstream" type="bool" label="SerienStream: HTML speichern" default="false" />
|
||||||
<setting id="show_url_info_serienstream" type="bool" label="SerienStream: Aktuelle URL anzeigen" default="false" />
|
<setting id="show_url_info_serienstream" type="bool" label="SerienStream: Aktuelle URL anzeigen" default="false" />
|
||||||
<setting id="log_errors_serienstream" type="bool" label="SerienStream: Fehler mitschreiben" default="false" />
|
<setting id="log_errors_serienstream" type="bool" label="SerienStream: Fehler mitschreiben" default="false" />
|
||||||
|
|
||||||
<setting id="log_urls_aniworld" type="bool" label="AniWorld: URLs mitschreiben" default="false" />
|
<setting id="log_urls_aniworld" type="bool" label="AniWorld: URLs mitschreiben" default="false" />
|
||||||
<setting id="dump_html_aniworld" type="bool" label="AniWorld: HTML speichern" default="false" />
|
<setting id="dump_html_aniworld" type="bool" label="AniWorld: HTML speichern" default="false" />
|
||||||
<setting id="show_url_info_aniworld" type="bool" label="AniWorld: Aktuelle URL anzeigen" default="false" />
|
<setting id="show_url_info_aniworld" type="bool" label="AniWorld: Aktuelle URL anzeigen" default="false" />
|
||||||
<setting id="log_errors_aniworld" type="bool" label="AniWorld: Fehler mitschreiben" default="false" />
|
<setting id="log_errors_aniworld" type="bool" label="AniWorld: Fehler mitschreiben" default="false" />
|
||||||
|
|
||||||
<setting id="log_urls_topstreamfilm" type="bool" label="TopStream: URLs mitschreiben" default="false" />
|
<setting id="log_urls_topstreamfilm" type="bool" label="TopStream: URLs mitschreiben" default="false" />
|
||||||
<setting id="dump_html_topstreamfilm" type="bool" label="TopStream: HTML speichern" default="false" />
|
<setting id="dump_html_topstreamfilm" type="bool" label="TopStream: HTML speichern" default="false" />
|
||||||
<setting id="show_url_info_topstreamfilm" type="bool" label="TopStream: Aktuelle URL anzeigen" default="false" />
|
<setting id="show_url_info_topstreamfilm" type="bool" label="TopStream: Aktuelle URL anzeigen" default="false" />
|
||||||
<setting id="log_errors_topstreamfilm" type="bool" label="TopStream: Fehler mitschreiben" default="false" />
|
<setting id="log_errors_topstreamfilm" type="bool" label="TopStream: Fehler mitschreiben" default="false" />
|
||||||
|
|
||||||
<setting id="log_urls_einschalten" type="bool" label="Einschalten: URLs mitschreiben" default="false" />
|
<setting id="log_urls_einschalten" type="bool" label="Einschalten: URLs mitschreiben" default="false" />
|
||||||
<setting id="dump_html_einschalten" type="bool" label="Einschalten: HTML speichern" default="false" />
|
<setting id="dump_html_einschalten" type="bool" label="Einschalten: HTML speichern" default="false" />
|
||||||
<setting id="show_url_info_einschalten" type="bool" label="Einschalten: Aktuelle URL anzeigen" default="false" />
|
<setting id="show_url_info_einschalten" type="bool" label="Einschalten: Aktuelle URL anzeigen" default="false" />
|
||||||
<setting id="log_errors_einschalten" type="bool" label="Einschalten: Fehler mitschreiben" default="false" />
|
<setting id="log_errors_einschalten" type="bool" label="Einschalten: Fehler mitschreiben" default="false" />
|
||||||
|
|
||||||
<setting id="log_urls_filmpalast" type="bool" label="Filmpalast: URLs mitschreiben" default="false" />
|
<setting id="log_urls_filmpalast" type="bool" label="Filmpalast: URLs mitschreiben" default="false" />
|
||||||
<setting id="dump_html_filmpalast" type="bool" label="Filmpalast: HTML speichern" default="false" />
|
<setting id="dump_html_filmpalast" type="bool" label="Filmpalast: HTML speichern" default="false" />
|
||||||
<setting id="show_url_info_filmpalast" type="bool" label="Filmpalast: Aktuelle URL anzeigen" default="false" />
|
<setting id="show_url_info_filmpalast" type="bool" label="Filmpalast: Aktuelle URL anzeigen" default="false" />
|
||||||
<setting id="log_errors_filmpalast" type="bool" label="Filmpalast: Fehler mitschreiben" default="false" />
|
<setting id="log_errors_filmpalast" type="bool" label="Filmpalast: Fehler mitschreiben" default="false" />
|
||||||
</category>
|
</category>
|
||||||
<category label="YouTube">
|
|
||||||
<setting id="youtube_quality" type="enum" label="YouTube Videoqualitaet" default="0" values="Beste|1080p|720p|480p|360p" />
|
<category label="Intern">
|
||||||
<setting id="install_ytdlp" type="action" label="yt-dlp installieren/reparieren" action="RunPlugin(plugin://plugin.video.viewit/?action=install_ytdlp)" option="close" />
|
<setting id="changelog_last_shown_version" type="text" label="" default="" visible="false" />
|
||||||
<setting id="ytdlp_status" type="text" label="yt-dlp Status" default="-" enable="false" />
|
|
||||||
</category>
|
</category>
|
||||||
|
|
||||||
</settings>
|
</settings>
|
||||||
|
|||||||
@@ -44,7 +44,9 @@ Einstellungen
|
|||||||
|
|
||||||
Menues im Hauptmenue
|
Menues im Hauptmenue
|
||||||
|
|
||||||
Wenn Trakt aktiviert und autorisiert ist, erscheinen im ViewIT-Hauptmenue folgende Eintraege:
|
Wenn Trakt aktiviert ist, erscheint im ViewIT-Hauptmenue ein Untermenüpunkt "Trakt" (nach allen Quellen-Plugins).
|
||||||
|
|
||||||
|
Ein Klick darauf oeffnet das Trakt-Untermenue mit folgenden Eintraegen (nur wenn bereits autorisiert):
|
||||||
|
|
||||||
|
|
||||||
Weiterschauen
|
Weiterschauen
|
||||||
|
|||||||
@@ -34,6 +34,10 @@ PY
|
|||||||
ZIP_NAME="${ADDON_ID}-${ADDON_VERSION}.zip"
|
ZIP_NAME="${ADDON_ID}-${ADDON_VERSION}.zip"
|
||||||
ZIP_PATH="${INSTALL_DIR}/${ZIP_NAME}"
|
ZIP_PATH="${INSTALL_DIR}/${ZIP_NAME}"
|
||||||
|
|
||||||
|
CHANGELOG_USER="${SRC_ADDON_DIR}/CHANGELOG-USER.md"
|
||||||
|
python3 "${ROOT_DIR}/scripts/update_user_changelog.py" --fill "${ADDON_XML}" "${CHANGELOG_USER}" >&2
|
||||||
|
python3 "${ROOT_DIR}/scripts/update_user_changelog.py" --check "${ADDON_XML}" "${CHANGELOG_USER}" >&2 || exit 1
|
||||||
|
|
||||||
ADDON_DIR="$("${ROOT_DIR}/scripts/build_install_addon.sh" >/dev/null; echo "${INSTALL_DIR}/${ADDON_ID}")"
|
ADDON_DIR="$("${ROOT_DIR}/scripts/build_install_addon.sh" >/dev/null; echo "${INSTALL_DIR}/${ADDON_ID}")"
|
||||||
|
|
||||||
rm -f "${ZIP_PATH}"
|
rm -f "${ZIP_PATH}"
|
||||||
|
|||||||
238
scripts/update_user_changelog.py
Normal file
238
scripts/update_user_changelog.py
Normal file
@@ -0,0 +1,238 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""
|
||||||
|
Pflegt CHANGELOG-USER.md vor dem ZIP-Build.
|
||||||
|
|
||||||
|
Modi:
|
||||||
|
--fill Liest Commits seit letztem Tag, generiert lesbaren Text und ersetzt
|
||||||
|
den Platzhalter im Abschnitt der aktuellen Version.
|
||||||
|
Legt den Abschnitt an falls noch nicht vorhanden.
|
||||||
|
--check Prüft ob ein gefüllter Abschnitt für VERSION existiert.
|
||||||
|
Exit 0 = OK, Exit 1 = fehlt oder ist Platzhalter.
|
||||||
|
|
||||||
|
Aufruf durch build_kodi_zip.sh:
|
||||||
|
python3 scripts/update_user_changelog.py --fill addon/addon.xml addon/CHANGELOG-USER.md
|
||||||
|
python3 scripts/update_user_changelog.py --check addon/addon.xml addon/CHANGELOG-USER.md
|
||||||
|
"""
|
||||||
|
|
||||||
|
import re
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
import xml.etree.ElementTree as ET
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
PLACEHOLDER_LINE = "(Bitte Changelog-Einträge hier einfügen)"
|
||||||
|
|
||||||
|
# Schlüsselwörter aus Commit-Messages → lesbarer Kategorie-Text
|
||||||
|
# Reihenfolge bestimmt Priorität (erster Treffer gewinnt).
|
||||||
|
CATEGORY_RULES: list[tuple[re.Pattern, str]] = [
|
||||||
|
(re.compile(r"trakt", re.I), "Trakt"),
|
||||||
|
(re.compile(r"serienstream|serien.?stream", re.I), "SerienStream"),
|
||||||
|
(re.compile(r"aniworld", re.I), "AniWorld"),
|
||||||
|
(re.compile(r"youtube|yt.?dlp", re.I), "YouTube"),
|
||||||
|
(re.compile(r"tmdb|metadat", re.I), "Metadaten"),
|
||||||
|
(re.compile(r"suche|search", re.I), "Suche"),
|
||||||
|
(re.compile(r"setting|einstellung", re.I), "Einstellungen"),
|
||||||
|
(re.compile(r"update|version", re.I), "Updates"),
|
||||||
|
(re.compile(r"moflix", re.I), "Moflix"),
|
||||||
|
(re.compile(r"filmpalast", re.I), "Filmpalast"),
|
||||||
|
(re.compile(r"kkiste", re.I), "KKiste"),
|
||||||
|
(re.compile(r"doku.?stream", re.I), "Doku-Streams"),
|
||||||
|
(re.compile(r"topstream", re.I), "Topstreamfilm"),
|
||||||
|
(re.compile(r"einschalten", re.I), "Einschalten"),
|
||||||
|
(re.compile(r"hdfilme", re.I), "HDFilme"),
|
||||||
|
(re.compile(r"netzkino", re.I), "NetzkKino"),
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def get_version(addon_xml: Path) -> str:
|
||||||
|
root = ET.parse(addon_xml).getroot()
|
||||||
|
return root.attrib.get("version", "").strip()
|
||||||
|
|
||||||
|
|
||||||
|
def strip_suffix(version: str) -> str:
|
||||||
|
return re.sub(r"-(dev|nightly|beta|alpha).*$", "", version)
|
||||||
|
|
||||||
|
|
||||||
|
def get_prev_tag(current_tag: str) -> str | None:
|
||||||
|
try:
|
||||||
|
result = subprocess.run(
|
||||||
|
["git", "tag", "--sort=-version:refname"],
|
||||||
|
capture_output=True, text=True, check=True,
|
||||||
|
)
|
||||||
|
tags = [t.strip() for t in result.stdout.splitlines() if t.strip()]
|
||||||
|
if current_tag in tags:
|
||||||
|
idx = tags.index(current_tag)
|
||||||
|
return tags[idx + 1] if idx + 1 < len(tags) else None
|
||||||
|
return tags[0] if tags else None
|
||||||
|
except Exception:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def get_commits_since(prev_tag: str | None) -> list[str]:
|
||||||
|
"""Gibt Commit-Subjects seit prev_tag zurück (ohne den Tag-Commit selbst)."""
|
||||||
|
try:
|
||||||
|
ref = f"{prev_tag}..HEAD" if prev_tag else "HEAD"
|
||||||
|
result = subprocess.run(
|
||||||
|
["git", "log", ref, "--pretty=format:%s"],
|
||||||
|
capture_output=True, text=True, check=True,
|
||||||
|
)
|
||||||
|
return [l.strip() for l in result.stdout.splitlines() if l.strip()]
|
||||||
|
except Exception:
|
||||||
|
return []
|
||||||
|
|
||||||
|
|
||||||
|
def extract_description(subject: str) -> str:
|
||||||
|
"""Extrahiert den lesbaren Teil aus einer Commit-Message."""
|
||||||
|
# "dev: bump to 0.1.86.0-dev Beschreibung hier" → "Beschreibung hier"
|
||||||
|
m = re.match(r"^(?:dev|nightly|main):\s*bump\s+to\s+[\d.]+(?:-\w+)?\s*(.+)$", subject, re.I)
|
||||||
|
if m:
|
||||||
|
return m.group(1).strip()
|
||||||
|
# "dev: Beschreibung" → "Beschreibung"
|
||||||
|
m = re.match(r"^(?:dev|nightly|main):\s*(.+)$", subject, re.I)
|
||||||
|
if m:
|
||||||
|
return m.group(1).strip()
|
||||||
|
return subject
|
||||||
|
|
||||||
|
|
||||||
|
def split_description(desc: str) -> list[str]:
|
||||||
|
"""Zerlegt kommagetrennte Beschreibungen in Einzelpunkte."""
|
||||||
|
parts = [p.strip() for p in re.split(r",\s*(?=[A-ZÄÖÜ\w])", desc) if p.strip()]
|
||||||
|
return parts if parts else [desc]
|
||||||
|
|
||||||
|
|
||||||
|
def categorize(items: list[str]) -> dict[str, list[str]]:
|
||||||
|
"""Gruppiert Beschreibungs-Punkte nach Kategorie."""
|
||||||
|
categories: dict[str, list[str]] = {}
|
||||||
|
for item in items:
|
||||||
|
cat = "Allgemein"
|
||||||
|
for pattern, label in CATEGORY_RULES:
|
||||||
|
if pattern.search(item):
|
||||||
|
cat = label
|
||||||
|
break
|
||||||
|
categories.setdefault(cat, []).append(item)
|
||||||
|
return categories
|
||||||
|
|
||||||
|
|
||||||
|
def build_changelog_text(commits: list[str]) -> str:
|
||||||
|
"""Erzeugt lesbaren Changelog-Text aus Commit-Subjects."""
|
||||||
|
all_items: list[str] = []
|
||||||
|
for subject in commits:
|
||||||
|
desc = extract_description(subject)
|
||||||
|
if desc:
|
||||||
|
all_items.extend(split_description(desc))
|
||||||
|
|
||||||
|
if not all_items:
|
||||||
|
return "- Verschiedene Verbesserungen und Fehlerbehebungen"
|
||||||
|
|
||||||
|
categories = categorize(all_items)
|
||||||
|
lines: list[str] = []
|
||||||
|
for cat, items in categories.items():
|
||||||
|
lines.append(f"**{cat}**")
|
||||||
|
for item in items:
|
||||||
|
# Ersten Buchstaben groß, Punkt am Ende
|
||||||
|
item = item[0].upper() + item[1:] if item else item
|
||||||
|
if not item.endswith((".","!","?")):
|
||||||
|
item += "."
|
||||||
|
lines.append(f"- {item}")
|
||||||
|
lines.append("")
|
||||||
|
return "\n".join(lines).rstrip()
|
||||||
|
|
||||||
|
|
||||||
|
def section_exists(lines: list[str], header: str) -> bool:
|
||||||
|
return any(line.strip() == header for line in lines)
|
||||||
|
|
||||||
|
|
||||||
|
def section_is_placeholder(lines: list[str], header: str) -> bool:
|
||||||
|
in_section = False
|
||||||
|
content_lines = []
|
||||||
|
for line in lines:
|
||||||
|
if line.strip() == header:
|
||||||
|
in_section = True
|
||||||
|
continue
|
||||||
|
if in_section:
|
||||||
|
if line.startswith("## "):
|
||||||
|
break
|
||||||
|
stripped = line.strip()
|
||||||
|
if stripped:
|
||||||
|
content_lines.append(stripped)
|
||||||
|
return not content_lines or all(l == PLACEHOLDER_LINE for l in content_lines)
|
||||||
|
|
||||||
|
|
||||||
|
def replace_section_content(lines: list[str], header: str, new_content: str) -> list[str]:
|
||||||
|
"""Ersetzt den Inhalt eines bestehenden Abschnitts."""
|
||||||
|
result: list[str] = []
|
||||||
|
in_section = False
|
||||||
|
content_written = False
|
||||||
|
for line in lines:
|
||||||
|
if line.strip() == header:
|
||||||
|
result.append(line)
|
||||||
|
result.append("")
|
||||||
|
result.extend(new_content.splitlines())
|
||||||
|
result.append("")
|
||||||
|
in_section = True
|
||||||
|
content_written = True
|
||||||
|
continue
|
||||||
|
if in_section:
|
||||||
|
if line.startswith("## "):
|
||||||
|
in_section = False
|
||||||
|
result.append(line)
|
||||||
|
# Alte Zeilen des Abschnitts überspringen
|
||||||
|
continue
|
||||||
|
result.append(line)
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
def insert_section(lines: list[str], header: str, content: str) -> list[str]:
|
||||||
|
new_section = [header, "", *content.splitlines(), ""]
|
||||||
|
return new_section + ([""] if lines and lines[0].strip() else []) + lines
|
||||||
|
|
||||||
|
|
||||||
|
def main() -> None:
|
||||||
|
if len(sys.argv) < 4 or sys.argv[1] not in ("--fill", "--check"):
|
||||||
|
print(f"Usage: {sys.argv[0]} --fill|--check <addon.xml> <CHANGELOG-USER.md>", file=sys.stderr)
|
||||||
|
sys.exit(2)
|
||||||
|
|
||||||
|
mode = sys.argv[1]
|
||||||
|
addon_xml = Path(sys.argv[2])
|
||||||
|
changelog = Path(sys.argv[3])
|
||||||
|
|
||||||
|
version = get_version(addon_xml)
|
||||||
|
if not version:
|
||||||
|
print("Fehler: Version konnte nicht aus addon.xml gelesen werden.", file=sys.stderr)
|
||||||
|
sys.exit(2)
|
||||||
|
|
||||||
|
clean_version = strip_suffix(version)
|
||||||
|
header = f"## {clean_version}"
|
||||||
|
lines = changelog.read_text(encoding="utf-8").splitlines() if changelog.exists() else []
|
||||||
|
|
||||||
|
if mode == "--check":
|
||||||
|
if not section_exists(lines, header):
|
||||||
|
print(f"FEHLER: Kein Changelog-Abschnitt für {clean_version} in {changelog}", file=sys.stderr)
|
||||||
|
sys.exit(1)
|
||||||
|
if section_is_placeholder(lines, header):
|
||||||
|
print(f"FEHLER: Changelog-Abschnitt für {clean_version} ist noch ein Platzhalter.", file=sys.stderr)
|
||||||
|
sys.exit(1)
|
||||||
|
print(f"OK: Changelog-Abschnitt für {clean_version} vorhanden.")
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
|
# --fill
|
||||||
|
current_tag = f"v{version}"
|
||||||
|
prev_tag = get_prev_tag(current_tag)
|
||||||
|
commits = get_commits_since(prev_tag)
|
||||||
|
content = build_changelog_text(commits)
|
||||||
|
|
||||||
|
if section_exists(lines, header):
|
||||||
|
if not section_is_placeholder(lines, header):
|
||||||
|
print(f"Abschnitt {header} bereits gefüllt – keine Änderung.")
|
||||||
|
sys.exit(0)
|
||||||
|
new_lines = replace_section_content(lines, header, content)
|
||||||
|
else:
|
||||||
|
new_lines = insert_section(lines, header, content)
|
||||||
|
|
||||||
|
changelog.write_text("\n".join(new_lines) + "\n", encoding="utf-8")
|
||||||
|
print(f"Changelog für {header} geschrieben.")
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
Reference in New Issue
Block a user