No need for encrypted hls as seperate stream type
authorMarcel van der Veldt <m.vanderveldt@outlook.com>
Tue, 22 Oct 2024 18:17:56 +0000 (20:17 +0200)
committerMarcel van der Veldt <m.vanderveldt@outlook.com>
Tue, 22 Oct 2024 18:17:56 +0000 (20:17 +0200)
music_assistant/common/models/enums.py
music_assistant/server/controllers/streams.py
music_assistant/server/helpers/audio.py
music_assistant/server/helpers/playlists.py
music_assistant/server/providers/siriusxm/__init__.py

index 6dc5b2092df720c00dfbde2c8128a439bafc3b37..8a22c039456a8cf827af127f455fa2641571ded6 100644 (file)
@@ -427,7 +427,6 @@ class StreamType(StrEnum):
     HTTP = "http"  # regular http stream
     ENCRYPTED_HTTP = "encrypted_http"  # encrypted http stream
     HLS = "hls"  # http HLS stream
-    ENCRYPTED_HLS = "encrypted_hls"  # encrypted HLS stream
     ICY = "icy"  # http stream with icy metadata
     LOCAL_FILE = "local_file"
     CUSTOM = "custom"
index 63e188236539f8043a39b45dbf1cd410f60ec6de..8b4dd9b34d1581e51daa9c14eb965af73af7d170 100644 (file)
@@ -851,7 +851,7 @@ class StreamsController(CoreController):
             )
         elif streamdetails.stream_type == StreamType.ICY:
             audio_source = get_icy_radio_stream(self.mass, streamdetails.path, streamdetails)
-        elif streamdetails.stream_type in (StreamType.HLS, StreamType.ENCRYPTED_HLS):
+        elif streamdetails.stream_type == StreamType.HLS:
             substream = await get_hls_substream(self.mass, streamdetails.path)
             audio_source = substream.path
             if streamdetails.media_type == MediaType.RADIO:
index e3ff7bd24a49b4aec620eb300a9c78f374c4b0b0..b37ca762f2bf6ea930a936ecc4b4f4e8ecff34a7 100644 (file)
@@ -515,8 +515,8 @@ async def resolve_radio_stream(mass: MusicAssistant, url: str) -> tuple[str, Str
                         # unfold first url of playlist
                         return await resolve_radio_stream(mass, line.path)
                     raise InvalidDataError("No content found in playlist")
-            except IsHLSPlaylist as err:
-                stream_type = StreamType.ENCRYPTED_HLS if err.encrypted else StreamType.HLS
+            except IsHLSPlaylist:
+                stream_type = StreamType.HLS
 
     except Exception as err:
         LOGGER.warning("Error while parsing radio URL %s: %s", url, err)
index e3cef70234e89828c7304480fae54e8aa32dc48a..60f697034a18001a73afde68a6ea4672510183b2 100644 (file)
@@ -29,8 +29,6 @@ HLS_CONTENT_TYPES = (
 class IsHLSPlaylist(InvalidDataError):
     """The playlist from an HLS stream and should not be parsed."""
 
-    encrypted: bool = False
-
 
 @dataclass
 class PlaylistItem:
@@ -167,9 +165,7 @@ async def fetch_playlist(
         raise InvalidDataError(msg) from err
 
     if raise_on_hls and "#EXT-X-VERSION:" in playlist_data or "#EXT-X-STREAM-INF:" in playlist_data:
-        exc = IsHLSPlaylist()
-        exc.encrypted = "#EXT-X-KEY:" in playlist_data
-        raise exc
+        raise IsHLSPlaylist
 
     if url.endswith((".m3u", ".m3u8")):
         playlist = parse_m3u(playlist_data)
index 6e94331c353c153baa1a284ff6fe07378fd59b27..fab10ffd51c753b0c6145503236dd60ec197dcde 100644 (file)
@@ -209,7 +209,7 @@ class SiriusXMProvider(MusicProvider):
             audio_format=AudioFormat(
                 content_type=ContentType.AAC,
             ),
-            stream_type=StreamType.ENCRYPTED_HLS,
+            stream_type=StreamType.HLS,
             media_type=MediaType.RADIO,
             path=hls_path,
             can_seek=False,