Fixed artist artwork, path creation and post download issues

This commit is contained in:
RemixDev 2020-04-13 18:35:29 +02:00
parent 329648d46d
commit 8fe15ffdb4
2 changed files with 6 additions and 6 deletions

View File

@ -511,8 +511,8 @@ def downloadTrackObj(dz, trackAPI, settings, bitrate, queueItem, extraTrack=None
# Save artist art # Save artist art
if artistPath: 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['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']['artist'], settings)}.{'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 # Data for m3u file
if extrasPath: if extrasPath:
@ -647,9 +647,9 @@ def after_download(tracks, settings, queueItem):
searched += result['searched']+"\r\n" searched += result['searched']+"\r\n"
if not extrasPath and 'extrasPath' in result: if not extrasPath and 'extrasPath' in result:
extrasPath = result['extrasPath'] extrasPath = result['extrasPath']
if settings['saveArtwork'] and result['albumPath']: if settings['saveArtwork'] and 'albumPath' in result:
downloadImage(result['albumURL'], result['albumPath']) downloadImage(result['albumURL'], result['albumPath'])
if settings['saveArtworkArtist'] and result['artistPath']: if settings['saveArtworkArtist'] and 'artistPath' in result:
downloadImage(result['artistURL'], result['artistPath']) downloadImage(result['artistURL'], result['artistPath'])
if 'playlistPosition' in result: if 'playlistPosition' in result:
playlist[index] = result['playlistPosition'] playlist[index] = result['playlistPosition']

View File

@ -21,7 +21,7 @@ def fixLongName(name):
if pathSep in name: if pathSep in name:
name2 = name.split(pathSep) name2 = name.split(pathSep)
name = "" name = ""
for txt in name: for txt in name2:
txt = txt[:200] txt = txt[:200]
name += txt+pathSep name += txt+pathSep
name = name[:-1] name = name[:-1]
@ -134,7 +134,7 @@ def settingsRegexAlbum(foldername, album, settings):
foldername = foldername.replace("%artist_id%", str(album['mainArtist']['id'])) foldername = foldername.replace("%artist_id%", str(album['mainArtist']['id']))
foldername = foldername.replace("%tracktotal%", str(album['trackTotal'])) foldername = foldername.replace("%tracktotal%", str(album['trackTotal']))
foldername = foldername.replace("%disctotal%", str(album['discTotal'])) 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("%upc%", album['barcode'])
foldername = foldername.replace("%label%", fixName(album['label'], settings['illegalCharacterReplacer'])) foldername = foldername.replace("%label%", fixName(album['label'], settings['illegalCharacterReplacer']))
if len(album['genre']) > 0: if len(album['genre']) > 0: