Resolve logic error with both liked songs and playlists

pull/30/head
Casey Chu 2020-10-10 13:13:18 -07:00
parent b0cbd8e242
commit 8822f5780a
1 changed files with 3 additions and 2 deletions

View File

@ -167,13 +167,14 @@ def main():
# List all playlists and the tracks in each playlist
if 'playlists' in args.dump:
logging.info('Loading playlists...')
playlists += spotify.list('users/{user_id}/playlists'.format(user_id=me['id']), {'limit': 50})
playlist_data = spotify.list('users/{user_id}/playlists'.format(user_id=me['id']), {'limit': 50})
logging.info(f'Found {len(playlists)} playlists')
# List all tracks in each playlist
for playlist in playlists:
for playlist in playlist_data:
logging.info('Loading playlist: {name} ({tracks[total]} songs)'.format(**playlist))
playlist['tracks'] = spotify.list(playlist['tracks']['href'], {'limit': 100})
playlists += playlist_data
# Write the file.
logging.info('Writing files...')