fixed HTTPError handling

This commit is contained in:
uh_wot 2020-03-01 21:48:57 +01:00
parent 4509b809cb
commit 92d24aca83
2 changed files with 2 additions and 1 deletions

View File

@ -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):

View File

@ -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