fixed HTTPError handling
This commit is contained in:
parent
4509b809cb
commit
92d24aca83
|
@ -255,6 +255,7 @@ class Deezer:
|
|||
|
||||
def stream_track(self, track_id, url, stream):
|
||||
request = requests.get(url, stream=True)
|
||||
request.raise_for_status()
|
||||
blowfish_key = str.encode(self._get_blowfish_key(str(track_id)))
|
||||
i = 0
|
||||
for chunk in request.iter_content(2048):
|
||||
|
|
|
@ -311,7 +311,7 @@ def downloadTrackObj(trackAPI, settings, overwriteBitrate=False, extraTrack=None
|
|||
with open(writepath, 'wb') as stream:
|
||||
dz.stream_track(track['id'], track['downloadUrl'], stream)
|
||||
except HTTPError:
|
||||
remove(writePath)
|
||||
remove(writepath)
|
||||
if track['selectedFormat'] == 9:
|
||||
print("Track not available in flac, trying mp3")
|
||||
track['filesize']['flac'] = 0
|
||||
|
|
Loading…
Reference in New Issue