I have a large music library which I have just spent around 30 hours organizing. For some of the MP3 files, I embedded the cover art image as type 0 (Other) and I'd like to change it to type 3 (Front Cover). Is there a way to do this in Python, specifically in Mutagen?
Here's how I was able to pull it off.
First, get access to the file in Mutagen:
audio = MP3("filename.mp3")
Then, get a reference to the tag you're looking for:
picturetag = audio.tags['APIC:Folder.jpg']
Then, modify the type
attribute:
picturetag.type = 3
Then, assign it back into the audio file, just to be sure
audio.tags['APIC:Folder.jpg'] = picturetag
Finally, save it!
audio.save()
And you're there! The APIC tag comes with its own class that sports everything you'd need to modify pictures and picture tagging info. Happy music organizing!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With