Fix bug where a new Tidal playlist was created everytime sync.py run with --uri argument
I was passing (playlist, None) in the case where the --uri argument was used, and None means create a new playlist. I've fixed it to look for the Tidal playlist if it exists like the other code paths do, and only pass None when it doesn't exist. Unfortunately this will mean that your Tidal collection might have been polluted with duplicate playlists. I've added a delete playlist function to tidalapi_patch to help with deleting these programmatically, which some people might find useful. Fixes #8
This commit is contained in:
@@ -70,4 +70,7 @@ def create_tidal_playlist(session, name):
|
||||
result = session.request('POST','users/%s/playlists' % session.user.id ,data={'title': name})
|
||||
return session.get_playlist(result.json()['uuid'])
|
||||
|
||||
|
||||
def delete_tidal_playlist(session, playlist):
|
||||
etag = session.request('GET','playlists/%s' % playlist.id).headers['ETag']
|
||||
headers = {'if-none-match' : etag}
|
||||
session.request('DELETE','playlists/%s' % playlist.id, headers=headers)
|
||||
|
||||
Reference in New Issue
Block a user