From 4132e414c4e22cbcac6202aec9d163ffffa2cd00 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Tue, 27 Jun 2017 10:31:49 +0200 Subject: [PATCH] Add check for nonexistent playlists showing up for some reason (#92) --- spotdl.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/spotdl.py b/spotdl.py index 68b1430..812925a 100755 --- a/spotdl.py +++ b/spotdl.py @@ -121,9 +121,12 @@ def feed_playlist(username): # iterate over user playlists while True: for playlist in playlists['items']: - print(str(check) + '. ' + misc.fix_encoding(playlist['name']) + ' (' + str(playlist['tracks']['total']) + ' tracks)') - links.append(playlist) - check += 1 + # In rare cases, playlists may not be found, so playlists['next'] is + # None. Skip these. Also see Issue #91. + if playlist['name'] is not None: + print(str(check) + '. ' + misc.fix_encoding(playlist['name']) + ' (' + str(playlist['tracks']['total']) + ' tracks)') + links.append(playlist) + check += 1 if playlists['next']: playlists = spotify.next(playlists) else: