From 8fe15ffdb48f27c77fefc7d99a0fa6999541d01b Mon Sep 17 00:00:00 2001 From: RemixDev Date: Mon, 13 Apr 2020 18:35:29 +0200 Subject: [PATCH] Fixed artist artwork, path creation and post download issues --- deemix/app/downloader.py | 8 ++++---- deemix/utils/pathtemplates.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/deemix/app/downloader.py b/deemix/app/downloader.py index c9cdd3b..5822fc9 100644 --- a/deemix/app/downloader.py +++ b/deemix/app/downloader.py @@ -511,8 +511,8 @@ 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{}-000000-80-0-0.{}".format(track['album']['artist']['pic'], settings['localArtworkSize'], settings['localArtworkSize'], 'png' if settings['PNGcovers'] else 'jpg') - result['artistPath'] = os.path.join(artistPath, f"{settingsRegexArtist(settings['artistImageTemplate'], track['album']['artist'], settings)}.{'png' if settings['PNGcovers'] else 'jpg'}") + result['artistURL'] = "https://e-cdns-images.dzcdn.net/images/artist/{}/{}x{}-000000-80-0-0.{}".format(track['album']['mainArtist']['pic'], settings['localArtworkSize'], settings['localArtworkSize'], 'png' if settings['PNGcovers'] else 'jpg') + result['artistPath'] = os.path.join(artistPath, f"{settingsRegexArtist(settings['artistImageTemplate'], track['album']['mainArtist'], settings)}.{'png' if settings['PNGcovers'] else 'jpg'}") # Data for m3u file if extrasPath: @@ -647,9 +647,9 @@ def after_download(tracks, settings, queueItem): searched += result['searched']+"\r\n" if not extrasPath and 'extrasPath' in result: extrasPath = result['extrasPath'] - if settings['saveArtwork'] and result['albumPath']: + if settings['saveArtwork'] and 'albumPath' in result: downloadImage(result['albumURL'], result['albumPath']) - if settings['saveArtworkArtist'] and result['artistPath']: + if settings['saveArtworkArtist'] and 'artistPath' in result: downloadImage(result['artistURL'], result['artistPath']) if 'playlistPosition' in result: playlist[index] = result['playlistPosition'] diff --git a/deemix/utils/pathtemplates.py b/deemix/utils/pathtemplates.py index f33a468..6db8b78 100644 --- a/deemix/utils/pathtemplates.py +++ b/deemix/utils/pathtemplates.py @@ -21,7 +21,7 @@ def fixLongName(name): if pathSep in name: name2 = name.split(pathSep) name = "" - for txt in name: + for txt in name2: txt = txt[:200] name += txt+pathSep name = name[:-1] @@ -134,7 +134,7 @@ def settingsRegexAlbum(foldername, album, settings): foldername = foldername.replace("%artist_id%", str(album['mainArtist']['id'])) foldername = foldername.replace("%tracktotal%", str(album['trackTotal'])) foldername = foldername.replace("%disctotal%", str(album['discTotal'])) - foldername = foldername.replace("%type%", fixName(album['recordType'], settings['illegalCharacterReplacer'])) + foldername = foldername.replace("%type%", fixName(album['recordType'][0].upper()+album['recordType'][1:].lower(), settings['illegalCharacterReplacer'])) foldername = foldername.replace("%upc%", album['barcode']) foldername = foldername.replace("%label%", fixName(album['label'], settings['illegalCharacterReplacer'])) if len(album['genre']) > 0: