From e90b5a4b4e277329a43cd4b84f079d5481ef372a Mon Sep 17 00:00:00 2001 From: Ritiek Malhotra Date: Mon, 26 Jun 2017 19:18:22 +0530 Subject: [PATCH] Fetches all user playlists now (was limited to 50) --- spotdl.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/spotdl.py b/spotdl.py index ee2d067..2fa38e9 100755 --- a/spotdl.py +++ b/spotdl.py @@ -119,10 +119,15 @@ def feed_playlist(username): links = [] check = 1 # iterate over user playlists - for playlist in playlists['items']: - print(str(check) + '. ' + misc.fix_encoding(playlist['name']) + ' (' + str(playlist['tracks']['total']) + ' tracks)') - links.append(playlist) - check += 1 + 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 + if playlists['next']: + playlists = spotify.next(playlists) + else: + break print('') # let user select playlist playlist = misc.input_link(links) @@ -285,4 +290,4 @@ if __name__ == '__main__': elif args.list: grab_list(file=args.list) elif args.username: - feed_playlist(username=args.username) \ No newline at end of file + feed_playlist(username=args.username)