From 1eedd8eeb43c98afc3a24e3ec6a2b09052a1e167 Mon Sep 17 00:00:00 2001 From: Nirvana Date: Wed, 25 Feb 2026 10:02:40 +0100 Subject: [PATCH] Add discovery --- lib/streaming_providers/base/drm/drm_plugin.py | 8 ++++++-- lib/streaming_providers/base/drm_operations.py | 16 ++++++++++++++++ .../providers/discovery/constants.py | 2 +- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/lib/streaming_providers/base/drm/drm_plugin.py b/lib/streaming_providers/base/drm/drm_plugin.py index 41b9c4a..5344eb1 100644 --- a/lib/streaming_providers/base/drm/drm_plugin.py +++ b/lib/streaming_providers/base/drm/drm_plugin.py @@ -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 \ No newline at end of file diff --git a/lib/streaming_providers/base/drm_operations.py b/lib/streaming_providers/base/drm_operations.py index 7754a4a..bcc1453 100644 --- a/lib/streaming_providers/base/drm_operations.py +++ b/lib/streaming_providers/base/drm_operations.py @@ -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://')): diff --git a/lib/streaming_providers/providers/discovery/constants.py b/lib/streaming_providers/providers/discovery/constants.py index 1cdf663..5d3b4ed 100644 --- a/lib/streaming_providers/providers/discovery/constants.py +++ b/lib/streaming_providers/providers/discovery/constants.py @@ -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[