Fix playback for video based songs without artist info. (#1402)
authorMarvin Schenkel <marvinschenkel@gmail.com>
Sat, 22 Jun 2024 11:36:03 +0000 (13:36 +0200)
committerGitHub <noreply@github.com>
Sat, 22 Jun 2024 11:36:03 +0000 (13:36 +0200)
music_assistant/server/providers/ytmusic/helpers.py

index 9fd1a217815377e14d661e896a63fca61c540144..7ff9486a181e568ba98c02202495c47c78f19e61 100644 (file)
@@ -35,8 +35,11 @@ async def get_artist(
             # ChannelId can sometimes be different and original ID is not part of the response
             artist["channelId"] = prov_artist_id
         except KeyError:
-            user = ytm.get_user(channelId=prov_artist_id)
-            artist = {"channelId": prov_artist_id, "name": user["name"]}
+            try:
+                user = ytm.get_user(channelId=prov_artist_id)
+                artist = {"channelId": prov_artist_id, "name": user["name"]}
+            except KeyError:
+                artist = {"channelId": prov_artist_id, "name": "Unknown"}
         return artist
 
     return await asyncio.to_thread(_get_artist)