From 0d3bb6732e8aa23bc2ca72cab4a6b855d33c4df9 Mon Sep 17 00:00:00 2001 From: Parker Date: Sat, 30 Nov 2024 00:15:34 -0600 Subject: [PATCH] Fix artwork_url for Spotify albums --- code/utils/custom_sources.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/code/utils/custom_sources.py b/code/utils/custom_sources.py index 240947d..5cf2295 100644 --- a/code/utils/custom_sources.py +++ b/code/utils/custom_sources.py @@ -98,14 +98,15 @@ class SpotifySource(Source): ) async def load_album(self, user, metadata): + try: + artwork_url = metadata["images"][0]["url"] + except IndexError: + artwork_url = None + tracks = [] for track in metadata["tracks"][ "items" ]: # Loop through each track in the album. - try: - artwork_url = track["album"]["images"][0]["url"] - except IndexError: - artwork_url = None tracks.append( CustomAudioTrack( { # Create an instance of our CustomAudioTrack.