mirror of
https://github.com/KevinMidboe/spotify-downloader.git
synced 2025-12-08 20:39:08 +00:00
Fix albumart exception in .M4A downloads
This commit is contained in:
@@ -74,7 +74,7 @@ def embed_mp3(music_file, meta_tags):
|
|||||||
desc=u'Cover', data=albumart.read())
|
desc=u'Cover', data=albumart.read())
|
||||||
albumart.close()
|
albumart.close()
|
||||||
except IndexError:
|
except IndexError:
|
||||||
albumart = None
|
pass
|
||||||
audiofile.save(v2_version=3)
|
audiofile.save(v2_version=3)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@@ -114,9 +114,12 @@ def embed_m4a(music_file, meta_tags):
|
|||||||
audiofile[tags['genre']] = meta_tags['genre']
|
audiofile[tags['genre']] = meta_tags['genre']
|
||||||
if meta_tags['copyright']:
|
if meta_tags['copyright']:
|
||||||
audiofile[tags['copyright']] = meta_tags['copyright']
|
audiofile[tags['copyright']] = meta_tags['copyright']
|
||||||
|
try:
|
||||||
albumart = urllib.request.urlopen(meta_tags['album']['images'][0]['url'])
|
albumart = urllib.request.urlopen(meta_tags['album']['images'][0]['url'])
|
||||||
audiofile[tags['albumart']] = [MP4Cover(
|
audiofile[tags['albumart']] = [MP4Cover(
|
||||||
albumart.read(), imageformat=MP4Cover.FORMAT_JPEG)]
|
albumart.read(), imageformat=MP4Cover.FORMAT_JPEG)]
|
||||||
albumart.close()
|
albumart.close()
|
||||||
|
except IndexError:
|
||||||
|
pass
|
||||||
audiofile.save()
|
audiofile.save()
|
||||||
return True
|
return True
|
||||||
|
|||||||
Reference in New Issue
Block a user