dev: revert resolveurl dependency path injection

This commit is contained in:
2026-02-24 21:00:21 +01:00
parent 39ec975afa
commit 482e0b0cc6

View File

@@ -7,36 +7,10 @@ zu einer abspielbaren Media-URL (inkl. evtl. Header-Suffix) aufgelöst werden.
from __future__ import annotations
from typing import Optional
import sys
_LAST_RESOLVE_ERROR = ""
def _append_kodi_dependency_paths() -> None:
"""Ensure optional Kodi module dependencies are importable."""
try:
import xbmcaddon # type: ignore
import xbmcvfs # type: ignore
except Exception:
return
for addon_id in ("script.module.resolveurl", "script.module.kodi-six", "script.module.six"):
try:
addon = xbmcaddon.Addon(addon_id)
addon_path = addon.getAddonInfo("path") or ""
except Exception:
addon_path = ""
if not addon_path:
continue
try:
addon_path = xbmcvfs.translatePath(addon_path)
except Exception:
pass
lib_path = f"{addon_path}/lib"
for candidate in (lib_path, addon_path):
if candidate and candidate not in sys.path:
sys.path.append(candidate)
def get_last_error() -> str:
return str(_LAST_RESOLVE_ERROR or "")
@@ -46,19 +20,9 @@ def resolve(url: str) -> Optional[str]:
_LAST_RESOLVE_ERROR = ""
if not url:
return None
resolveurl = None
try:
import resolveurl as _resolveurl # type: ignore
resolveurl = _resolveurl
import resolveurl # type: ignore
except Exception:
# Ohne harte addon.xml-Abhaengigkeit liegen optionale libs ggf. nicht im Python-Pfad.
_append_kodi_dependency_paths()
try:
import resolveurl as _resolveurl # type: ignore
resolveurl = _resolveurl
except Exception:
resolveurl = None
if resolveurl is None:
_LAST_RESOLVE_ERROR = "resolveurl missing"
return None