dev: YouTube-Plugin: yt-dlp Suche, Bug-Fix Any-Import

This commit is contained in:
2026-03-13 19:43:50 +01:00
parent e4828dedd0
commit 811f617ff7
5 changed files with 321 additions and 1 deletions

View File

@@ -1209,6 +1209,7 @@ UPDATE_HTTP_TIMEOUT_SEC = 8
UPDATE_ADDON_ID = "plugin.video.viewit"
RESOLVEURL_ADDON_ID = "script.module.resolveurl"
RESOLVEURL_AUTO_INSTALL_INTERVAL_SEC = 6 * 60 * 60
YTDLP_ADDON_ID = "script.module.yt-dlp"
def _selected_update_channel() -> int:
@@ -1692,6 +1693,38 @@ def _sync_tmdb_active_key_setting() -> None:
_set_setting_string("tmdb_api_key_active", masked)
def _sync_ytdlp_status_setting() -> None:
status = "Installiert" if _is_addon_installed(YTDLP_ADDON_ID) else "Fehlt"
_set_setting_string("ytdlp_status", status)
def _ensure_ytdlp_installed(*, force: bool, silent: bool) -> bool:
if _is_addon_installed(YTDLP_ADDON_ID):
_sync_ytdlp_status_setting()
return True
wait_seconds = 20 if force else 0
ok = _install_kodi_addon(YTDLP_ADDON_ID, wait_seconds=wait_seconds)
_sync_ytdlp_status_setting()
if not silent:
if ok:
xbmcgui.Dialog().notification(
"yt-dlp",
"script.module.yt-dlp ist installiert.",
xbmcgui.NOTIFICATION_INFO,
4000,
)
else:
xbmcgui.Dialog().notification(
"yt-dlp",
"Installation fehlgeschlagen. Bitte Repository/Netzwerk pruefen.",
xbmcgui.NOTIFICATION_ERROR,
5000,
)
return ok
def _sync_update_version_settings() -> None:
addon_version = _installed_addon_version_from_disk()
if addon_version == "0.0.0":
@@ -1703,6 +1736,7 @@ def _sync_update_version_settings() -> None:
addon_version = "0.0.0"
_set_setting_string("update_installed_version", addon_version)
_sync_resolveurl_status_setting()
_sync_ytdlp_status_setting()
_sync_update_channel_status_settings()
_sync_tmdb_active_key_setting()
@@ -5004,6 +5038,11 @@ def _route_install_resolveurl(params: dict[str, str]) -> None:
_ensure_resolveurl_installed(force=True, silent=False)
@_router.route("install_ytdlp")
def _route_install_ytdlp(params: dict[str, str]) -> None:
_ensure_ytdlp_installed(force=True, silent=False)
@_router.route("choose_source")
def _route_choose_source(params: dict[str, str]) -> None:
_show_choose_source(params.get("title", ""), params.get("plugins", ""))