From 3db3ce59c700329b55b799f4c97f1841ade3b5c6 Mon Sep 17 00:00:00 2001 From: Nirvana Date: Thu, 25 Dec 2025 22:29:14 +0100 Subject: [PATCH] Restructure for enabling/disabling --- .../base/provider_registry.py | 2 +- .../providers/magentaeu/provider.py | 36 ++++++++++++------- 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/lib/streaming_providers/base/provider_registry.py b/lib/streaming_providers/base/provider_registry.py index 56f2712..2aa284c 100644 --- a/lib/streaming_providers/base/provider_registry.py +++ b/lib/streaming_providers/base/provider_registry.py @@ -46,7 +46,7 @@ class ProviderMetadata: # Rest of the method remains the same... self.label = self.plugin_class.get_static_label(self.country) self.supported_auth_types = self.plugin_class.get_static_auth_types() - self.logo = self.plugin_class.get_static_logo() + self.logo = self.plugin_class.get_static_logo(self.country) self.supported_countries = self.plugin_class.get_static_supported_countries() self.requires_credentials = any( auth_type in ['user_credentials', 'client_credentials'] diff --git a/lib/streaming_providers/providers/magentaeu/provider.py b/lib/streaming_providers/providers/magentaeu/provider.py index 5728874..bafc67d 100644 --- a/lib/streaming_providers/providers/magentaeu/provider.py +++ b/lib/streaming_providers/providers/magentaeu/provider.py @@ -39,6 +39,8 @@ class MagentaEUProvider(StreamingProvider): PROVIDER_LOGO_PL: ClassVar[str] = MAGENTA_TV_PL_LOGO PROVIDER_LOGO_HR: ClassVar[str] = MAX_TV_LOGO + PROVIDER_LOGO: ClassVar[str] = "" + SUPPORTED_COUNTRIES = SUPPORTED_COUNTRIES def __init__(self, country: str = DEFAULT_COUNTRY, @@ -107,17 +109,11 @@ class MagentaEUProvider(StreamingProvider): else: return f'Magenta TV ({self.country.upper()})' + # Also update the instance property for consistency @property def provider_logo(self) -> str: - country_lower = self.country.lower() - if country_lower == 'at': - return self.PROVIDER_LOGO_AT - elif country_lower == 'hr': - return self.PROVIDER_LOGO_HR - elif country_lower == 'pl': - return self.PROVIDER_LOGO_PL - else: - return '' + """Instance property that returns country-specific logo.""" + return self.get_static_logo(self.country) @property def uses_dynamic_manifests(self) -> bool: @@ -485,7 +481,16 @@ class MagentaEUProvider(StreamingProvider): @classmethod def get_static_logo(cls, country: str = None) -> str: - """Static version for metadata extraction.""" + """ + Override to provide country-specific logos. + + Args: + country: Optional country code to get specific logo + + Returns: + Logo URL for the specified country, or default if not available + """ + # If country is provided, return country-specific logo if country: country_lower = country.lower() if country_lower == 'at': @@ -494,8 +499,15 @@ class MagentaEUProvider(StreamingProvider): return cls.PROVIDER_LOGO_HR elif country_lower == 'pl': return cls.PROVIDER_LOGO_PL - # Return HR logo as default - return cls.PROVIDER_LOGO_HR + elif country_lower == 'hu': + # Hungary - use AT logo as fallback or add specific one + return cls.PROVIDER_LOGO_AT or cls.PROVIDER_LOGO_HR + elif country_lower == 'me': + # Montenegro - use HR logo as fallback or add specific one + return cls.PROVIDER_LOGO_HR + + # No country specified - return a sensible default + return cls.PROVIDER_LOGO_HR # or cls.PROVIDER_LOGO_AT @classmethod def get_static_label(cls, country: str = None) -> str: