From da34c289a7990e56d170562699920c079b744214 Mon Sep 17 00:00:00 2001 From: RemixDev Date: Thu, 10 Sep 2020 11:43:32 +0200 Subject: [PATCH] Better download managing for covers --- deemix/__init__.py | 2 +- deemix/app/downloadjob.py | 12 +++++++----- setup.py | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/deemix/__init__.py b/deemix/__init__.py index 97275d8..01bea58 100644 --- a/deemix/__init__.py +++ b/deemix/__init__.py @@ -1,3 +1,3 @@ #!/usr/bin/env python3 -__version__ = "1.2.19" +__version__ = "1.2.20" diff --git a/deemix/app/downloadjob.py b/deemix/app/downloadjob.py index 27ae72e..c2597e8 100644 --- a/deemix/app/downloadjob.py +++ b/deemix/app/downloadjob.py @@ -66,10 +66,13 @@ def downloadImage(url, path, overwrite="n"): logger.warn("Couldn't download "+str(pictureSize)+"x"+str(pictureSize)+" image, falling back to 1200x1200") sleep(1) return downloadImage(urlBase+pictureUrl.replace(str(pictureSize)+"x"+str(pictureSize), '1200x1200'), path, overwrite) - logger.error("Couldn't download Image: "+url) - except: - sleep(1) + logger.error("Image not found: "+url) + except (request_exception.ConnectionError, request_exception.ChunkedEncodingError) as e: + logger.error("Couldn't download Image, retrying in 5 seconds...: "url+"\n") + sleep(5) return downloadImage(url, path, overwrite) + except Exception as e: + logger.exception(f"Error while downloading an image, you should report this to the developers: {str(e)}") if os.path.isfile(path): remove(path) return None else: @@ -480,8 +483,7 @@ class DownloadJob: return downloadMusic(track, trackAPI_gw) except Exception as e: remove(writepath) - logger.exception(str(e)) - logger.warn(f"[{track.mainArtist['name']} - {track.title}] Error while downloading the track, you should report this to the developers") + logger.exception(f"[{track.mainArtist['name']} - {track.title}] Error while downloading the track, you should report this to the developers: {str(e)}") raise e return True diff --git a/setup.py b/setup.py index d281b2c..dabea38 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ README = (HERE / "README.md").read_text() setup( name="deemix", - version="1.2.19", + version="1.2.20", description="A barebone deezer downloader library", long_description=README, long_description_content_type="text/markdown",