Core & Architektur: - Neues Verzeichnis addon/core/ mit router.py, trakt.py, metadata.py, gui.py, playstate.py, plugin_manager.py, updater.py - Tests-Verzeichnis hinzugefügt (24 Tests, pytest + Coverage) Trakt-Integration: - OAuth Device Flow, Scrobbling, Watchlist, History, Calendar - Upcoming Episodes, Weiterschauen (Continue Watching) - Watched-Status in Episodenlisten - _trakt_find_in_plugins() mit 5-Min-Cache Serienstream-Suche: - API-Ergebnisse werden immer mit Katalog-Cache ergänzt (serverseitiges 10-Treffer-Limit) - Katalog-Cache wird beim Addon-Start im Daemon-Thread vorgewärmt - Notification nach Cache-Load via xbmc.executebuiltin() (thread-sicher) Bugfixes (Code-Review): - Race Condition auf _TRAKT_WATCHED_CACHE: _TRAKT_WATCHED_CACHE_LOCK hinzugefügt - GUI-Dialog aus Daemon-Thread: xbmcgui -> xbmc.executebuiltin() - ValueError in Trakt-Watchlist-Routen abgesichert - Token expires_at==0 Check korrigiert - get_setting_bool() Kontrollfluss in gui.py bereinigt - topstreamfilm_plugin: try-finally um xbmcvfs.File.close() Cleanup: - default.py.bak und refactor_router.py entfernt - .gitignore: /tests/ Eintrag entfernt - Type-Hints vereinheitlicht (Dict/List/Tuple -> dict/list/tuple)
55 lines
1.6 KiB
Python
55 lines
1.6 KiB
Python
from __future__ import annotations
|
|
import threading
|
|
from typing import Any
|
|
|
|
# Playstate-Verwaltung für den ViewIT Kodi Addon.
|
|
# Aktuell sind die meisten Funktionen Stubs, da Kodi die Wiedergabe-Stände selbst verwaltet.
|
|
|
|
_PLAYSTATE_CACHE: dict[str, dict[str, Any]] | None = None
|
|
_PLAYSTATE_LOCK = threading.RLock()
|
|
|
|
|
|
def playstate_key(*, plugin_name: str, title: str, season: str, episode: str) -> str:
|
|
plugin_name = (plugin_name or "").strip()
|
|
title = (title or "").strip()
|
|
season = (season or "").strip()
|
|
episode = (episode or "").strip()
|
|
return f"{plugin_name}\t{title}\t{season}\t{episode}"
|
|
|
|
|
|
def load_playstate() -> dict[str, dict[str, Any]]:
|
|
return {}
|
|
|
|
|
|
def save_playstate(state: dict[str, dict[str, Any]]) -> None:
|
|
return
|
|
|
|
|
|
def get_playstate(key: str) -> dict[str, Any]:
|
|
return {}
|
|
|
|
|
|
def set_playstate(key: str, value: dict[str, Any]) -> None:
|
|
return
|
|
|
|
|
|
def apply_playstate_to_info(info_labels: dict[str, Any], playstate: dict[str, Any]) -> dict[str, Any]:
|
|
return dict(info_labels or {})
|
|
|
|
|
|
def label_with_playstate(label: str, playstate: dict[str, Any]) -> str:
|
|
return label
|
|
|
|
|
|
def title_playstate(plugin_name: str, title: str) -> dict[str, Any]:
|
|
return get_playstate(playstate_key(plugin_name=plugin_name, title=title, season="", episode=""))
|
|
|
|
|
|
def season_playstate(plugin_name: str, title: str, season: str) -> dict[str, Any]:
|
|
return get_playstate(playstate_key(plugin_name=plugin_name, title=title, season=season, episode=""))
|
|
|
|
|
|
def track_playback_and_update_state_async(key: str) -> None:
|
|
# Eigenes Resume/Watched ist deaktiviert; Kodi verwaltet das selbst.
|
|
return
|