Adding tags to mp3 with eyed3 results in no change

2.7k Views Asked by At

I am trying to add tags (title, genre, etc.) to a mp3 file downloaded created with urllib in Python. Using eye3d and the example from their website, the program runs without any errors, but doesn't seem to do anything. When checking the details of the file, title, artist and everything else stays empty as it was before.

Using this example:

import eyed3

audiofile = eyed3.load("song.mp3")
audiofile.tag.artist = u"Nobunny"
audiofile.tag.album = u"Love Visions"
audiofile.tag.album_artist = u"Various Artists"
audiofile.tag.title = u"I Am a Girlfriend"
audiofile.tag.track_num = 4

audiofile.tag.save()

Am I missing something?

2

There are 2 best solutions below

0
On

Your mp3 file might has no tags at all, you shout initialize it first:

audiofile = eyed3.load("song.mp3")
audiofile.initTag()
...

Or create tag with specific version, for example:

audiofile.initTag(version=(2, 3, 0))  # v2.4 by default
0
On

I had the same problem. What worked for me was to add the file's path in the save() function:

    audiofile.tag.save(fileName)

In your example fileName would be "song.mp3".