I'm trying to use eyed3, as a Python library, in order to change the artist name for a large collection of .MP3 files. I tried using the sample code of the project's web page (http://eyed3.nicfit.net/) and setsaudiofile.tag.artist changes the "Contributing Artist". According to the docs (at http://eyed3.nicfit.net/api/eyed3.html) there are no other artist fields for a tag object.
Is is possible to use eyed3 to actually change the Album Artist? If so, can you provide clear, concise Python code that does so?
This is the command I wrote down some time ago to change that field:
eyeD3 --set-text-frame=TPE2:"Various Artists" filename.mp3
where "Various Artists" is the value you want in the "Album Artist" field.
For a large collection of MP3s, what you can do is put all of the songs of one artist in a particular folder. Eg:- All "Coldplay" songs go in the "Coldplay" folder
If you are on Linux, you can do the following:-
import os
import eyed3
folder = raw_input('Please enter the folder of music')
files = os.listdir(folder) # This will give us a list of all of the MP3s in that folder
artist = folder.split('/')[-1]
for x in files:
mp3 = eyed3.load(folder + '/' + x) # Loads each and every MP3
mp3.tag.artist = unicode(artist, "UTF-8") # Sets the "artist" tag to the artist name
mp3.tag.save() # Saves tag
Just edit the code by making all the slashes "/" into backslashes "\" if you are on Windows
The above code works pretty well for me. Glad if I helped :)
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