Merge notabug.org:RemixDev/deemix

This commit is contained in:
uh_wot 2020-02-29 22:05:31 +01:00
commit 2d366fdc71
1 changed files with 3 additions and 2 deletions

View File

@ -257,7 +257,7 @@ def downloadTrackObj(trackAPI, settings, overwriteBitrate=False, extraTrack=None
track['selectedFormat'] = format track['selectedFormat'] = format
track['selectedFilesize'] = filesize track['selectedFilesize'] = filesize
track['album']['bitrate'] = format track['album']['bitrate'] = format
track['album']['picUrl'] = "https://e-cdn-images.deezer.com/images/cover/{}/{}x{}-000000-80-0-0.{}".format(track['album']['pic'], settings['embeddedArtworkSize'], settings['embeddedArtworkSize'], 'png' if settings['PNGcovers'] else 'jpg') track['album']['picUrl'] = "https://e-cdns-images.dzcdn.net/images/cover/{}/{}x{}-000000-80-0-0.{}".format(track['album']['pic'], settings['embeddedArtworkSize'], settings['embeddedArtworkSize'], 'png' if settings['PNGcovers'] else 'jpg')
# Generate filename and filepath from metadata # Generate filename and filepath from metadata
filename = generateFilename(track, trackAPI, settings) filename = generateFilename(track, trackAPI, settings)
@ -282,11 +282,12 @@ def downloadTrackObj(trackAPI, settings, overwriteBitrate=False, extraTrack=None
# Save local album art # Save local album art
if coverPath: if coverPath:
track['album']['picUrlLocal'] = track['album']['picUrl'].replace(f"{settings['embeddedArtworkSize']}x{settings['embeddedArtworkSize']}", f"{settings['localArtworkSize']}x{settings['localArtworkSize']}")
track['album']['picPathLocal'] = os.path.join(coverPath, f"{settingsRegexAlbum(settings['coverImageTemplate'], track['album'], settings)}.{'png' if settings['PNGcovers'] else 'jpg'}") track['album']['picPathLocal'] = os.path.join(coverPath, f"{settingsRegexAlbum(settings['coverImageTemplate'], track['album'], settings)}.{'png' if settings['PNGcovers'] else 'jpg'}")
if not os.path.isfile(track['album']['picPathLocal']): if not os.path.isfile(track['album']['picPathLocal']):
with open(track['album']['picPathLocal'], 'wb') as f: with open(track['album']['picPathLocal'], 'wb') as f:
try: try:
f.write(get(track['album']['picUrl'].replace(f"{settings['embeddedArtworkSize']}x{settings['embeddedArtworkSize']}", f"{settings['localArtworkSize']}x{settings['localArtworkSize']}")).content) f.write(get(track['album']['picUrlLocal']).content)
except HTTPError: except HTTPError:
track['album']['picPathLocal'] = None track['album']['picPathLocal'] = None
# Save artist art # Save artist art