fixed KeyError issue when downloading single

This commit is contained in:
RemixDev 2021-12-28 09:10:31 +01:00
parent 5107bde5c9
commit 0c4db05db1
No known key found for this signature in database
GPG Key ID: B33962B465BDB51C
1 changed files with 3 additions and 3 deletions

View File

@ -36,7 +36,7 @@ def generateTrackItem(dz, link_id, bitrate, trackAPI=None, albumAPI=None):
else: else:
cover = f"https://e-cdns-images.dzcdn.net/images/cover/{trackAPI['md5_image']}/75x75-000000-80-0-0.jpg" cover = f"https://e-cdns-images.dzcdn.net/images/cover/{trackAPI['md5_image']}/75x75-000000-80-0-0.jpg"
del trackAPI['track_token'] if 'track_token' in trackAPI: del trackAPI['track_token']
return Single({ return Single({
'type': 'track', 'type': 'track',
@ -108,7 +108,7 @@ def generateAlbumItem(dz, link_id, bitrate, rootArtist=None):
collection = [] collection = []
for pos, trackAPI in enumerate(tracksArray, start=1): for pos, trackAPI in enumerate(tracksArray, start=1):
trackAPI = map_track(trackAPI) trackAPI = map_track(trackAPI)
del trackAPI['track_token'] if 'track_token' in trackAPI: del trackAPI['track_token']
trackAPI['position'] = pos trackAPI['position'] = pos
collection.append(trackAPI) collection.append(trackAPI)
@ -159,7 +159,7 @@ def generatePlaylistItem(dz, link_id, bitrate, playlistAPI=None, playlistTracksA
trackAPI = map_track(trackAPI) trackAPI = map_track(trackAPI)
if trackAPI['explicit_lyrics']: if trackAPI['explicit_lyrics']:
playlistAPI['explicit'] = True playlistAPI['explicit'] = True
del trackAPI['track_token'] if 'track_token' in trackAPI: del trackAPI['track_token']
trackAPI['position'] = pos trackAPI['position'] = pos
collection.append(trackAPI) collection.append(trackAPI)