Better download managing for covers

This commit is contained in:
RemixDev 2020-09-10 11:43:32 +02:00
parent 37b801f2f0
commit da34c289a7
3 changed files with 9 additions and 7 deletions

View File

@ -1,3 +1,3 @@
#!/usr/bin/env python3
__version__ = "1.2.19"
__version__ = "1.2.20"

View File

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

View File

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