Added metadata to m4a files downloaded from tidal

This commit is contained in:
Manuel Cortez 2020-07-13 16:04:20 -05:00
parent fef5c218b0
commit 0cc6f97f01

View File

@ -92,7 +92,14 @@ def apply_metadata(local_filename, metadata):
from mutagen.easyid3 import EasyID3 as metadataeditor from mutagen.easyid3 import EasyID3 as metadataeditor
elif local_filename.endswith(".flac"): elif local_filename.endswith(".flac"):
from mutagen.flac import FLAC as metadataeditor from mutagen.flac import FLAC as metadataeditor
elif local_filename.endswith(".m4a"):
from mutagen.mp4 import MP4 as metadataeditor
audio = metadataeditor(local_filename) audio = metadataeditor(local_filename)
for k in metadata.keys(): if local_filename.endswith(".m4a") == False:
audio[k] = metadata[k] for k in metadata.keys():
audio[k] = metadata[k]
else:
audio["\xa9nam"] = metadata["title"]
audio["\xa9alb"] = metadata["album"]
audio["\xa9ART"] = metadata["artist"]
audio.save() audio.save()