From ed0736896faf83948aa014644ebe04cff098d0a5 Mon Sep 17 00:00:00 2001 From: Nirvana Date: Fri, 13 Feb 2026 19:44:04 +0100 Subject: [PATCH] Add m3u playlists --- .../base/utils/manifest_parser.py | 27 +++++++++++++------ 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/lib/streaming_providers/base/utils/manifest_parser.py b/lib/streaming_providers/base/utils/manifest_parser.py index 7665a08..f6f4000 100644 --- a/lib/streaming_providers/base/utils/manifest_parser.py +++ b/lib/streaming_providers/base/utils/manifest_parser.py @@ -10,10 +10,10 @@ from .logger import logger class ManifestParser: @staticmethod def extract_pssh_from_manifest( - manifest_content: str, - manifest_url: str = "", - fallback_to_segments: bool = True, - segment_urls: List[str] = None, + manifest_content: str, + manifest_url: str = "", + fallback_to_segments: bool = True, + segment_urls: List[str] = None, ) -> List[PSSHData]: """ DEPRECATED: Use extract_single_init_segment_url instead. @@ -93,6 +93,17 @@ class ManifestParser: ] if filtered_pssh: return filtered_pssh + else: + # If filtering produced no matches, return all segment PSSH + # This can happen if the manifest had incomplete system IDs + logger.debug( + f"Filtering by expected_system_ids produced no matches, " + f"returning all {len(pssh_from_segment)} PSSH from segment" + ) + return pssh_from_segment + + # No filtering requested, return all segment PSSH + return pssh_from_segment except Exception as e: logger.warning(f"Failed to extract PSSH from segment: {e}") @@ -101,7 +112,7 @@ class ManifestParser: @staticmethod def _merge_pssh_data( - manifest_pssh: List[PSSHData], segment_pssh: List[PSSHData] + manifest_pssh: List[PSSHData], segment_pssh: List[PSSHData] ) -> List[PSSHData]: """Merge manifest and segment PSSH data""" if not manifest_pssh: @@ -197,7 +208,7 @@ class ManifestParser: @staticmethod def extract_single_init_segment_url( - manifest_content: str, manifest_url: str + manifest_content: str, manifest_url: str ) -> Optional[str]: """ Extract ONE init segment URL from DASH manifest. @@ -307,7 +318,7 @@ class ManifestParser: @staticmethod def extract_init_segment_urls( - manifest_content: str, manifest_url: str + manifest_content: str, manifest_url: str ) -> List[str]: """ DEPRECATED: Use extract_single_init_segment_url instead. @@ -318,4 +329,4 @@ class ManifestParser: init_url = ManifestParser.extract_single_init_segment_url( manifest_content, manifest_url ) - return [init_url] if init_url else [] + return [init_url] if init_url else [] \ No newline at end of file