From 92d24aca83322bd155691d9ef762b87dd1f0abf4 Mon Sep 17 00:00:00 2001 From: uh_wot <3631986-uh_wot@users.noreply.gitlab.com> Date: Sun, 1 Mar 2020 21:48:57 +0100 Subject: [PATCH] fixed HTTPError handling --- deemix/api/deezer.py | 1 + deemix/app/downloader.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/deemix/api/deezer.py b/deemix/api/deezer.py index 29f8d5a..efee77f 100755 --- a/deemix/api/deezer.py +++ b/deemix/api/deezer.py @@ -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): diff --git a/deemix/app/downloader.py b/deemix/app/downloader.py index 2e3f9d7..984ce63 100644 --- a/deemix/app/downloader.py +++ b/deemix/app/downloader.py @@ -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