mirror of
https://github.com/nirvana-7777/script.service.ultimate.git
synced 2026-09-16 22:22:27 +02:00
Add web config
This commit is contained in:
@@ -27,6 +27,8 @@ class StreamingProvider(ABC):
|
||||
Abstract base class for streaming providers with centralized HTTP and auth management
|
||||
"""
|
||||
|
||||
SUPPORTED_COUNTRIES: List[str] = []
|
||||
|
||||
def __init__(self, country: str = 'DE'):
|
||||
self.country = country
|
||||
self.channels: List[StreamingChannel] = []
|
||||
@@ -697,4 +699,42 @@ class StreamingProvider(ABC):
|
||||
else:
|
||||
# Default to query parameters
|
||||
separator = '&' if '?' in base_url else '?'
|
||||
return f"{base_url}{separator}start={start_time}&end={end_time}"
|
||||
return f"{base_url}{separator}start={start_time}&end={end_time}"
|
||||
|
||||
@classmethod
|
||||
def get_supported_countries(cls) -> List[str]:
|
||||
"""
|
||||
Get list of countries supported by this provider.
|
||||
|
||||
Returns:
|
||||
List of ISO country codes (e.g., ['de', 'at', 'ch'])
|
||||
Empty list means single-country provider using default country
|
||||
"""
|
||||
return cls.SUPPORTED_COUNTRIES.copy()
|
||||
|
||||
@classmethod
|
||||
def supports_multiple_countries(cls) -> bool:
|
||||
"""
|
||||
Check if this provider supports multiple countries.
|
||||
|
||||
Returns:
|
||||
True if provider supports country-specific instances
|
||||
"""
|
||||
return len(cls.SUPPORTED_COUNTRIES) > 0
|
||||
|
||||
@classmethod
|
||||
def validate_country(cls, country: str) -> bool:
|
||||
"""
|
||||
Validate if a country is supported by this provider.
|
||||
|
||||
Args:
|
||||
country: ISO country code to validate
|
||||
|
||||
Returns:
|
||||
True if country is supported or provider is single-country
|
||||
"""
|
||||
if not cls.supports_multiple_countries():
|
||||
# Single-country providers accept any country (or ignore it)
|
||||
return True
|
||||
|
||||
return country.lower() in [c.lower() for c in cls.SUPPORTED_COUNTRIES]
|
||||
@@ -89,6 +89,13 @@ class JoynProvider(StreamingProvider):
|
||||
proxy_config: Optional proxy configuration (highest priority)
|
||||
proxy_url: Optional proxy URL string (medium priority)
|
||||
"""
|
||||
if not self.validate_country(country):
|
||||
supported = ', '.join(self.SUPPORTED_COUNTRIES)
|
||||
raise ValueError(
|
||||
f"Unsupported country: {country}. "
|
||||
f"Joyn supports: {supported}"
|
||||
)
|
||||
|
||||
super().__init__(country=country)
|
||||
|
||||
if country not in SUPPORTED_COUNTRIES:
|
||||
|
||||
@@ -39,6 +39,12 @@ class MagentaProvider(StreamingProvider):
|
||||
proxy_url: Optional[str] = None):
|
||||
|
||||
logger.info(f"=== MagentaProvider.__init__ START for country: {country} ===")
|
||||
if not self.validate_country(country):
|
||||
supported = ', '.join(self.SUPPORTED_COUNTRIES)
|
||||
raise ValueError(
|
||||
f"Unsupported country: {country}. "
|
||||
f"MagentaTV EU supports: {supported}"
|
||||
)
|
||||
super().__init__(country=country)
|
||||
|
||||
if country not in SUPPORTED_COUNTRIES:
|
||||
@@ -474,7 +480,7 @@ class MagentaProvider(StreamingProvider):
|
||||
logger.debug(f"Credential validation failed: {e}")
|
||||
return False
|
||||
|
||||
@staticmethod
|
||||
def get_supported_countries() -> List[str]:
|
||||
@classmethod
|
||||
def get_supported_countries(cls) -> List[str]:
|
||||
"""Get list of supported countries"""
|
||||
return SUPPORTED_COUNTRIES.copy()
|
||||
return cls.SUPPORTED_COUNTRIES.copy()
|
||||
Reference in New Issue
Block a user