Fix album Art and description tag
parent
dca712f66b
commit
7b3ca4477a
34
scdl/scdl.py
34
scdl/scdl.py
|
@ -564,6 +564,10 @@ def already_downloaded(track, title, filename=None):
|
||||||
|
|
||||||
if filename and os.path.isfile(filename):
|
if filename and os.path.isfile(filename):
|
||||||
already_downloaded = True
|
already_downloaded = True
|
||||||
|
if filename and arguments['--flac'] \
|
||||||
|
and filename.endswith('.wav') \
|
||||||
|
and os.path.isfile(filename[:-4] + ".flac"):
|
||||||
|
already_downloaded = True
|
||||||
if arguments['--download-archive'] and in_download_archive(track):
|
if arguments['--download-archive'] and in_download_archive(track):
|
||||||
already_downloaded = True
|
already_downloaded = True
|
||||||
|
|
||||||
|
@ -658,26 +662,30 @@ def set_metadata(track, filename, album=None):
|
||||||
if track['genre']: audio['genre'] = track['genre']
|
if track['genre']: audio['genre'] = track['genre']
|
||||||
if track['permalink_url']: audio['website'] = track['permalink_url']
|
if track['permalink_url']: audio['website'] = track['permalink_url']
|
||||||
if track['date']: audio['date'] = track['date']
|
if track['date']: audio['date'] = track['date']
|
||||||
|
audio.save()
|
||||||
|
|
||||||
|
a = mutagen.File(filename)
|
||||||
if track['description']:
|
if track['description']:
|
||||||
if audio.__class__ is mutagen.flac:
|
if a.__class__ is mutagen.flac.FLAC:
|
||||||
audio['comment'] = track['description']
|
a['description'] = track['description']
|
||||||
elif audio.__class__ is mutagen.easyid3:
|
elif a.__class__ is mutagen.mp3.MP3:
|
||||||
a = mutagen.File(filename)
|
|
||||||
a['COMM'] = mutagen.id3.COMM(
|
a['COMM'] = mutagen.id3.COMM(
|
||||||
encoding=3, lang=u'ENG', text=track['description']
|
encoding=3, lang=u'ENG', text=track['description']
|
||||||
)
|
)
|
||||||
if artwork_url:
|
if artwork_url:
|
||||||
if audio.__class__ is mutagen.flac:
|
if a.__class__ is mutagen.flac.FLAC:
|
||||||
p = mutagen.flac.Picture(out_file.read())
|
p = mutagen.flac.Picture()
|
||||||
p.type = 3
|
p.data = out_file.read()
|
||||||
audio.add_picture(p)
|
p.width = 500
|
||||||
elif audio.__class__ is mutagen.easyid3:
|
p.height = 500
|
||||||
a = mutagen.File(filename)
|
p.type = mutagen.id3.PictureType.COVER_FRONT
|
||||||
|
a.add_picture(p)
|
||||||
|
elif a.__class__ is mutagen.mp3.MP3:
|
||||||
a['APIC'] = mutagen.id3.APIC(
|
a['APIC'] = mutagen.id3.APIC(
|
||||||
encoding=3, mime='image/jpeg', type=3, data=out_file.read()
|
encoding=3, mime='image/jpeg', type=3,
|
||||||
|
desc='Cover', data=out_file.read()
|
||||||
)
|
)
|
||||||
|
a.save()
|
||||||
audio.save()
|
|
||||||
|
|
||||||
|
|
||||||
def signal_handler(signal, frame):
|
def signal_handler(signal, frame):
|
||||||
|
|
Loading…
Reference in New Issue