From ae0a1ed42974c7b0fd061d8ba30222d23199dbed Mon Sep 17 00:00:00 2001 From: RemixDev Date: Sun, 31 May 2020 13:59:08 +0200 Subject: [PATCH] Force JPG images on missing artist art, PNG is not available This fixes #9 --- deemix/app/downloader.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/deemix/app/downloader.py b/deemix/app/downloader.py index bee0b3b..09304b0 100644 --- a/deemix/app/downloader.py +++ b/deemix/app/downloader.py @@ -683,11 +683,17 @@ def downloadTrackObj(dz, trackAPI, settings, bitrate, queueItem, extraTrack=None # Save artist art if artistPath: - result['artistURL'] = "https://e-cdns-images.dzcdn.net/images/artist/{}/{}x{}-{}".format( - track['album']['mainArtist']['pic'], settings['localArtworkSize'], settings['localArtworkSize'], - 'none-100-0-0.png' if settings['PNGcovers'] else f'000000-{settings["jpegImageQuality"]}-0-0.jpg') - result['artistPath'] = os.path.join(artistPath, - f"{settingsRegexArtist(settings['artistImageTemplate'], track['album']['mainArtist'], settings)}.{'png' if settings['PNGcovers'] else 'jpg'}") + if track['album']['mainArtist']['pic'] != "": + result['artistURL'] = "https://e-cdns-images.dzcdn.net/images/artist/{}/{}x{}-{}".format( + track['album']['mainArtist']['pic'], settings['localArtworkSize'], settings['localArtworkSize'], + 'none-100-0-0.png' if settings['PNGcovers'] else f'000000-{settings["jpegImageQuality"]}-0-0.jpg') + result['artistPath'] = os.path.join(artistPath, + f"{settingsRegexArtist(settings['artistImageTemplate'], track['album']['mainArtist'], settings)}.{'png' if settings['PNGcovers'] else 'jpg'}") + else: + result['artistURL'] = "https://e-cdns-images.dzcdn.net/images/artist//{}x{}-{}".format( + settings['localArtworkSize'], settings['localArtworkSize'], f'000000-{settings["jpegImageQuality"]}-0-0.jpg') + result['artistPath'] = os.path.join(artistPath, + f"{settingsRegexArtist(settings['artistImageTemplate'], track['album']['mainArtist'], settings)}.jpg") # Data for m3u file if extrasPath: