Implement ViewIt Plugin System Documentation and Update Project Notes
- Added comprehensive documentation for the ViewIt Plugin System, detailing the plugin loading process, required methods, optional features, and community extension workflow. - Updated project notes to reflect the current structure, build process, search logic, and known issues. - Introduced new build scripts for installing the add-on and creating ZIP packages. - Added test scripts for TMDB API integration, including argument parsing and logging functionality. - Enhanced existing plugins with improved search logic and error handling.
This commit is contained in:
43
addon/resolveurl_backend.py
Normal file
43
addon/resolveurl_backend.py
Normal file
@@ -0,0 +1,43 @@
|
||||
"""Optionales ResolveURL-Backend für das Kodi-Addon.
|
||||
|
||||
Wenn `script.module.resolveurl` installiert ist, kann damit eine Hoster-URL
|
||||
zu einer abspielbaren Media-URL (inkl. evtl. Header-Suffix) aufgelöst werden.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Optional
|
||||
|
||||
|
||||
def resolve(url: str) -> Optional[str]:
|
||||
if not url:
|
||||
return None
|
||||
try:
|
||||
import resolveurl # type: ignore
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
try:
|
||||
hosted = getattr(resolveurl, "HostedMediaFile", None)
|
||||
if callable(hosted):
|
||||
hmf = hosted(url)
|
||||
valid = getattr(hmf, "valid_url", None)
|
||||
if callable(valid) and not valid():
|
||||
return None
|
||||
resolver = getattr(hmf, "resolve", None)
|
||||
if callable(resolver):
|
||||
result = resolver()
|
||||
return str(result) if result else None
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
try:
|
||||
resolve_fn = getattr(resolveurl, "resolve", None)
|
||||
if callable(resolve_fn):
|
||||
result = resolve_fn(url)
|
||||
return str(result) if result else None
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user