Add discovery

This commit is contained in:
Nirvana
2026-02-25 10:02:40 +01:00
parent 805908bfba
commit 1eedd8eeb4
3 changed files with 23 additions and 3 deletions
@@ -35,7 +35,11 @@ class DRMPlugin(ABC):
Args:
drm_config: The DRM config to process (guaranteed to match supported_drm_system)
pssh_data: The PSSH data for this DRM system from the manifest, or None if not available
**kwargs: Additional context from the original method call
**kwargs: Additional context from the original method call. Well-known keys:
proxy_config (Optional[ProxyConfig]): The proxy configured for the calling
provider's HTTPManager, if any. Plugins that need to make outbound
requests (e.g. license key fetching) should read this via
``kwargs.get("proxy_config")`` and apply it to their own HTTP calls.
Returns:
Transformed DRMConfig, or None if the config should be filtered out
@@ -43,4 +47,4 @@ class DRMPlugin(ABC):
Raises:
Exception: Any exception will be caught and logged, plugin will be skipped
"""
pass
pass
@@ -250,6 +250,22 @@ class DRMOperations:
if not provider:
raise ValueError(f"Provider '{provider_name}' not found or disabled")
# Inject proxy_config from the provider's HTTPManager into kwargs so that
# DRM plugins can optionally use the same proxy the provider is configured with.
# Plugins read it via kwargs.get("proxy_config"). Existing callers that already
# pass proxy_config explicitly are not overridden.
if "proxy_config" not in kwargs:
http_mgr = getattr(provider, "http_manager", None)
if http_mgr is not None:
provider_proxy = getattr(getattr(http_mgr, "config", None), "proxy_config", None)
if provider_proxy is not None:
kwargs["proxy_config"] = provider_proxy
logger.debug(
f"DRMOperations: Injected proxy_config from provider "
f"'{provider_name}' into plugin kwargs "
f"({provider_proxy.host}:{provider_proxy.port})"
)
# Step 0a: Fetch manifest and check if it's encrypted
manifest_url = provider.get_manifest(channel_id, **kwargs)
if manifest_url and manifest_url.startswith(('http://', 'https://')):
@@ -66,7 +66,7 @@ DEFAULT_PLATFORM_OS: Final[PlatformOS] = PlatformOS.WINDOWS
# Provider information
DISCOVERY_LOGO: Final[
str] = "https://upload.wikimedia.org/wikipedia/commons/thumb/f/f1/Discovery%2B_logo.svg/2560px-Discovery%2B_logo.svg.png"
str] = "https://upload.wikimedia.org/wikipedia/commons/thumb/d/df/Discovery%2B.png/960px-Discovery%2B.png"
# Bootstrap endpoint for dynamic configuration
DISCOVERY_BOOTSTRAP_URL: Final[