Setting "Album Artist" using eyed3?
Asked Answered
E

3

6

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?

Enrage answered 9/2, 2013 at 6:5 Comment(2)
If you were looking for album art, i.e. the image file. Here is a stackoverflow answer https://mcmap.net/q/436878/-how-do-you-embed-album-art-into-an-mp3-using-python. album_artist is available in the tag object import eyed3; audiofile = eyed3.load("song.mp3"); audiofile.tag.album_artist = u"Various Artists";, example right from eyed3.nicfit.netRoundsman
Thank you for the reply, and the helpful link! I'm actually looking to set the 'album artist' tag. I am NOT interested in the actual art itself (I figure that once it's on my iPod/media player/etc I'm not going to be looking at it, just listening to it :) ). album_artist: huh, yeah, that does look right. That said, it's been a while (1.5 years, looks like) since I asked this, and I honestly can't remember the exact details of why that did (or didn't) work. That example does seem pretty clear, though - I'm thinking maybe the API changed since I asked the question? Anyways - thanks!Enrage
P
1

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.

Pawnshop answered 20/9, 2013 at 15:21 Comment(4)
I think OP is asking about 'album art' not 'artist'!?Roundsman
Nope, OP is asking about album artist, not album art (see extended reply, above)Enrage
Still, this does not answer the question "Setting “Album Artist” using eyed3?" at all.Agree
This code assumes that albums are grouped under artists in your file system. Run at your own risk.Inopportune
I
2

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.

Isoleucine answered 22/2, 2015 at 22:51 Comment(7)
You may correct your answer from the syntax: eyeD3 --set-text-frame=TPE2:"Various Artists" *.mp3. eyeD3 is totally capable of handling this requirement. You can mention the official spec id3.org/id3v2.3.0.Dottydoty
Why does "The Band/Orchestra/Accompaniment frame is used for additional information about the performers in the recording" translate to "Album Artist" on media players? Is this actually the correct frame? EDIT: "As of iTunes 7 (confirm?) the TPE1 frame is used for the "Artist" field, and the TPE2 frame is used for "Album artist"." id3.org/iTunes Also see the Foobar2000 ID3 specifications: wiki.hydrogenaud.io/index.php?title=Foobar2000:ID3_Tag_MappingIsoleucine
@Dottydoty I take this to mean that the command eyeD3 --album-artist="Various Artists" *.mp3 should now work. It doesn't.Inopportune
@TomRussell Not sure, why you think your command will work. My answer was 2 years ago and work as stated with the eyed3 version at that time and IMHO still works. You just use the TPE2 field to store the information. Any id3 viewer will give you the right information.Dottydoty
@Dottydoty Sorry. I guess I misunderstood. To me, "fully supported" means that the command syntax as I stated and consistent with the rest of the API should work. I don't understand why we'd have to access an obscure data item instead.Inopportune
@TomRussell Checking my version eyeD3 --version = eyeD3 0.6.18. This version does not have your mentioned option. I know there are new versions since it is actively maintained again. On Ubuntu 16.04 it is above version.Dottydoty
@Dottydoty AFAICT it's not implemented in 0.7.4.Inopportune
P
1

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.

Pawnshop answered 20/9, 2013 at 15:21 Comment(4)
I think OP is asking about 'album art' not 'artist'!?Roundsman
Nope, OP is asking about album artist, not album art (see extended reply, above)Enrage
Still, this does not answer the question "Setting “Album Artist” using eyed3?" at all.Agree
This code assumes that albums are grouped under artists in your file system. Run at your own risk.Inopportune
D
0

Related: If the album artist was empty, I wanted it to be set to the value of the artist field for my music library in Quod Libet. That worked with:

import os
import quodlibet.library

library_path = os.path.join(quodlibet.get_user_dir(), "songs")
library = quodlibet.library.init(library_path)

for song in library:
    if song('albumartist') == '':
        song['albumartist'] = song('artist')
        print(song['albumartist'])
    library.changed([song])

library.save()
Duumvir answered 11/1, 2023 at 20:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.