From ba1b6516017d4949e2931d272c84783f30b51a26 Mon Sep 17 00:00:00 2001 From: Vlad Kolotoff Date: Wed, 3 Nov 2021 22:01:41 +0000 Subject: [PATCH] Fix an issue when Spotify returns None as track, which leads to retries and a failure eventually. --- sync.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sync.py b/sync.py index 9b4db0d..3eed219 100755 --- a/sync.py +++ b/sync.py @@ -162,7 +162,7 @@ def get_tracks_from_spotify_playlist(spotify_session, spotify_playlist): output = [] results = spotify_session.playlist_tracks(spotify_playlist['id'], fields="next,items(track(name,album(name,artists),artists,track_number,duration_ms,id))") while True: - output.extend([r['track'] for r in results['items']]) + output.extend([r['track'] for r in results['items'] if r['track'] is not None]) # move to the next page of results if there are still tracks remaining in the playlist if results['next']: results = spotify_session.next(results)