Editing MP3 Tags using Python

Here's an example of a Python script that can be used to read and write MP3 tags:

This script uses the eyeD3 library to read and write MP3 tags. The script starts by loading an MP3 file using the eyed3.load() method, which takes the filename of the MP3 file as an argument. The variable audiofile now contains an instance of the AudioFile class, which provides access to the MP3's tags.

The script then prints the current values of the title, artist, album, and track number tags using the audiofile.tag object.

The script then updates the tags by assigning new values to the audiofile.tag.title, audiofile.tag.artist, audiofile.tag.album and audiofile.tag.track_num properties.

Finally, the script saves the changes to the MP3 file using the audiofile.tag.save() method.

This script will read and update the standard ID3 tags, including title, artist, album, and track number. eyeD3 supports both ID3v1 and ID3v2 for both reading and writing tags.

Hope this helps! Let me know if you have any questions.


No comments:

Post a Comment

Please disable your ad blocker to support this website.

Our website relies on revenue from ads to keep providing free content.