Apple Music: Fix edge case for album parsing (#1463)
authorMarvin Schenkel <marvinschenkel@gmail.com>
Sun, 7 Jul 2024 13:16:08 +0000 (15:16 +0200)
committerGitHub <noreply@github.com>
Sun, 7 Jul 2024 13:16:08 +0000 (15:16 +0200)
* Fix albums without name. Increase cooldown periode on 504 timeout.

* Fix edge case for albums.

music_assistant/server/providers/apple_music/__init__.py

index 3889729e36b5d4d4648ebb78f3bc6a77dd6b77b6..3adf6b652f00c2e26096870fa3d80d68e478084b 100644 (file)
@@ -417,7 +417,11 @@ class AppleMusicProvider(MusicProvider):
         """Parse album object to generic layout."""
         relationships = album_obj.get("relationships", {})
         response_type = album_obj.get("type")
-        if response_type == "library-albums" and relationships["catalog"]["data"] != []:
+        if (
+            response_type == "library-albums"
+            and relationships["catalog"]["data"] != []
+            and "attributes" in relationships["catalog"]["data"][0]
+        ):
             album_id = relationships.get("catalog", {})["data"][0]["id"]
             attributes = relationships.get("catalog", {})["data"][0]["attributes"]
         elif "attributes" in album_obj: