mirror of
https://github.com/THIS-IS-NOT-A-BACKUP/zspotify.git
synced 2024-11-26 09:53:17 +01:00
Patched a bug which stopped some playlists from downloading
Sometimes the spotify playlist API query will return None for some song id's which crashed my program further down the pipeline, fixed by added filter to skip those tracks.
This commit is contained in:
parent
545800a53b
commit
11e6323e41
11
zspotify.py
11
zspotify.py
@ -45,7 +45,7 @@ def wait(seconds: int = 3):
|
||||
time.sleep(1)
|
||||
|
||||
def sanitizeData(value):
|
||||
return value.replace("\\", "").replace("/", "")
|
||||
return value.replace("\\", "").replace("/", "").replace(":", "").replace("*", "").replace("?", "").replace("'", "").replace("<", "").replace(">", "")
|
||||
|
||||
def splash():
|
||||
print("=================================\n"
|
||||
@ -211,8 +211,9 @@ def search(searchTerm):
|
||||
playlistChoice = playlists[position - totalTracks - totalAlbums - 1]
|
||||
playlistSongs = get_playlist_songs(token, playlistChoice['id'])
|
||||
for song in playlistSongs:
|
||||
downloadTrack(song['track']['id'], sanitizeData(playlistChoice['name'].strip()) + "/")
|
||||
print("\n")
|
||||
if song['track']['id'] != None:
|
||||
downloadTrack(song['track']['id'], sanitizeData(playlistChoice['name'].strip()) + "/")
|
||||
print("\n")
|
||||
|
||||
def getSongInfo(songId):
|
||||
token = session.tokens().get("user-read-email")
|
||||
@ -422,8 +423,8 @@ def downloadFromOurPlaylists():
|
||||
playlistChoice = input("SELECT A PLAYLIST BY ID: ")
|
||||
playlistSongs = get_playlist_songs(token, playlists[int(playlistChoice) - 1]['id'])
|
||||
for song in playlistSongs:
|
||||
|
||||
downloadTrack(song['track']['id'], sanitizeData(playlists[int(playlistChoice) - 1]['name'].strip()) + "/")
|
||||
if song['track']['id'] != None:
|
||||
downloadTrack(song['track']['id'], sanitizeData(playlists[int(playlistChoice) - 1]['name'].strip()) + "/")
|
||||
print("\n")
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user