Fix HLS radio stream playback and exception handling (#2585)
authorOzGav <gavnosp@hotmail.com>
Mon, 3 Nov 2025 00:20:21 +0000 (10:20 +1000)
committerGitHub <noreply@github.com>
Mon, 3 Nov 2025 00:20:21 +0000 (01:20 +0100)
music_assistant/helpers/playlists.py

index 1fa645c614723b4156a5fd65b3d0772384f9b4c2..aac79966998e6daca73a303a6a145391cf807271 100644 (file)
@@ -84,7 +84,12 @@ def parse_m3u(m3u_data: str) -> list[PlaylistItem]:
                 kev_value_parts = part.strip().split("=")
                 stream_info[kev_value_parts[0]] = kev_value_parts[1]
         elif line.startswith("#EXT-X-KEY:"):
-            key = line.split(",URI=")[1].strip('"')
+            # Extract encryption key URI if present
+            # METHOD=NONE means no encryption, so explicitly clear the key
+            if "METHOD=NONE" in line:
+                key = None
+            elif ",URI=" in line:
+                key = line.split(",URI=")[1].strip('"')
         elif line.startswith("#"):
             # Ignore other extensions
             continue