No more sweet music.
January 24, 2008 4:44 AM   Subscribe

Say I wanted to fill the genre tags of my whole mp3 library automatically. Say I trusted the community enough to use the three most used tags for a certain song/album listed there (for example: New Order's Ceremony would get "80s" "new wave" and "post-punk"). Say I wanted to do this automatically. Say I had a Mac. How would I go about this?

I hate that none of the software I know adds genre tags automatically. And yeah, I know that people think differently about different genres, but I'm willing to overlook that and just go for the most common genre "opinion" for now. This seems like a nice solution - I know it would go wrong on occasions, but it seems quite accurate overall.

I know /some/ Ruby. I'm not really proficient at it, but I could learn. Or can you think of a better way?
posted by Skyanth to Computers & Internet (12 answers total) 16 users marked this as a favorite
Best answer: If it were me, I'd do it in Perl, but I can't imagine it's that much different using Ruby. has an API that you can use to fetch the tag information for a given track -- see here for an example of the XML file returned when calling the API for Metallica's Enter Sandman.

From there, you'd need to parse the XML file to get the three tags, and then find a Ruby library to use that XML data to modify the tag information. Here's a module to do it in Perl. Here's a library to do it in Ruby.
posted by Doofus Magoo at 5:23 AM on January 24, 2008

Best answer: Oh, and here's a list of all the data that Audioscrobbler makes available via a web API.
posted by Doofus Magoo at 5:25 AM on January 24, 2008

I need this too. Favorited.
posted by ArgentCorvid at 6:59 AM on January 24, 2008

This is a great idea, and I'm afraid I can't help you get closer to a solution, but one problem I see is that AFAIK the Genre field isn't designed to contain multiple elements. If you populate a track's Genre field with "80s, new wave, post-punk," iTunes will show you a new genre called "80s, new wave, post-punk"

There are, of course, ways around this. You could embed that data in a different field. I misuse the Grouping field (which really only comes into play for classical music) for my own manual tagging purposes. You could also use the Comments field, of course. Then you could use Smart Playlists (assuming you use iTunes) to access these tags.
posted by adamrice at 7:17 AM on January 24, 2008

What adamrice said. I await the day that iTunes supports the concept of multiple genres per track. You'll much better off looking for a way to dump these LastFM terms into the Comments field (I use the Groupings for "featuring..." "and the..." etc. artist info, myself).

If your problem is that your library has *no* genres, and you'd be satisfied by automagically assigning everything a genre, I believe that beaTunes will do that for you. It's a rather a Swiss army knife of iTunes library maintenance. I used it to normalize things and auto-calculate BPM for my library some time ago. While it's dashed slow, it seemed to get the job done. There's also MusicBrainz, which may be the same metadata dataset that beaTunes uses, without offering some of the more complicated cleanup features of beaTunes. I've not used a MusicBrainz app in a dog's age, however.
posted by mumkin at 10:05 AM on January 24, 2008

I didn't realise I needed this until you asked about it.
posted by subbes at 2:51 PM on January 24, 2008

Sadly, mumkin, I just checked, and MusicBrainz doesn't import the Genre tag. It imports everything else though :(
posted by ArgentCorvid at 8:22 AM on January 26, 2008

Damn, ArgentCorvid, beaTunes doesn't either. How unexpected, given all that it does populate (or generate through analysis).

Sorry, Skyanth, for being 100% wrong with my un-best answer.
posted by mumkin at 2:18 PM on January 26, 2008

Response by poster: Seems I'll have to code this myself then. Finally some content for my website!
posted by Skyanth at 3:23 AM on January 28, 2008

I know that you (hypothetically) have a Mac, but there is a tool that does just what you ask on Windows: FastTagger. "Automatically tag genre for mp3 files with information from"
posted by alb at 8:15 AM on January 30, 2008

Response by poster: Thanks alb!

a. That's a useful tool to know about, and, more importantly
b. Through looking it up and browsing around a bit I found this, which is getting very close to what I was actually looking for!
posted by Skyanth at 9:45 AM on January 30, 2008 [1 favorite]

Response by poster: Though that script is so slow it's not even funny. But hey! It works!
posted by Skyanth at 9:52 AM on January 30, 2008

« Older Dust traps   |   If I were really hitting on guys via Craigslist... Newer »
This thread is closed to new comments.