Fix hrti vod

This commit is contained in:
Nirvana
2026-05-05 08:05:28 +02:00
parent 6176b190f1
commit 5a9ef79a98
2 changed files with 22 additions and 12 deletions
+9 -10
View File
@@ -1,5 +1,3 @@
# [file name]: auth.py
# [file content begin]
# streaming_providers/providers/hrti/auth.py
import base64
import json
@@ -553,15 +551,19 @@ class HRTiAuthenticator(BaseAuthenticator):
response.raise_for_status()
result = response.json()
if "Result" in result:
authorized = result["Result"].get("Authorized", False)
session_id = result["Result"].get("SessionId") or result["Result"].get("DrmId")
session_result = result.get("Result")
if session_result: # guards against None/null
authorized = session_result.get("Authorized", False)
session_id = session_result.get("SessionId") or session_result.get("DrmId")
logger.debug(
f"Session authorization result - authorized: {authorized}, session_id: {session_id}"
)
return result["Result"]
return session_result
else:
logger.warning("No result in session authorization response")
logger.warning(
f"No result in session authorization response "
f"(ErrorCode={result.get('ErrorCode')}: {result.get('ErrorDescription')})"
)
return None
except Exception as e:
@@ -794,6 +796,3 @@ class HRTiAuthenticator(BaseAuthenticator):
except Exception as e:
logger.error(f"HRTi token refresh failed: {e}")
return None
# [file content end]
@@ -20,6 +20,10 @@ from .vod_manager import HRTiVodManager
# not a live channel id.
_VOD_PREFIXES = ("catalogue:", "series:", "season:", "details:", "special:")
_PLAYABLE_VOD_PREFIXES = ("details:", "series:", "season:", "special:")
# catalogue: is a category, not directly playable
# raw UUIDs (no prefix) are playable VOD items from catalogue listings
class HRTiProvider(StreamingProvider):
"""
@@ -133,8 +137,15 @@ class HRTiProvider(StreamingProvider):
@staticmethod
def _is_vod_id(content_id: str) -> bool:
"""Return True when content_id belongs to the VOD namespace."""
return any(content_id.startswith(p) for p in _VOD_PREFIXES)
if any(content_id.startswith(p) for p in _PLAYABLE_VOD_PREFIXES):
return True
# Raw ReferenceIds from _parse_vod_catalogue_item have no prefix
# and look like UUIDs or legacy alphanumeric IDs (e.g. "85b273d1-...")
# catalogue: prefix = category node, not playable
if content_id.startswith("catalogue:"):
return False
# Anything else (no prefix) treat as a raw VOD ref id
return True
@staticmethod
def _derive_content_drm_id(streaming_url: str) -> Optional[str]: