October 5th, 2008

My iTunes library is pretty close to perfectly manicured, with 90% or more of all tracks being complete albums with complete metadata and album artwork.

Except genre. There really is no canonical source of genre information on the internet, because bands tend not to self-categorize.

So, a problem arose: Lots of music, little (accurate) genre information. My solution was to harness the power of the crowds to pull what I could from Last.fm

Conveniently, Last.fm provides a surfeit of XML feeds for their data. Because Last.fm doesn’t track genre, tags have become a sort of de facto stand-in.

I whipped up a hybrid AppleScript-Ruby application that will take the selected track (or tracks) in iTunes, find the artist, and then set all tracks by that artist to the most popular Last.fm tag.

It’s pretty fast, and it works decently. At least, it’s the best I could think of without manually spending hours updating every artist.

I’m making the script available here for public use. Please note that I have only done limited testing, but it works for me. Always back up your iTunes library on a regular basis. I am not responsible if this script decides that all of your music deserves to be labelled Prog Rock.

To use it, drag Fetch Genre from Top Last.fm Tag.app to ~/Library/iTunes/Scripts (create it if it doesn’t exist). Then select a track from the artist you want to update, and select Fetch Genre from Top Last.fm Tag from the Scripts menu in iTunes.

The source is not protected and you are welcome (and encouraged) to make changes. If you do, please just provide credit and a link here.

Known Issues

Download “Fetch Genre from Top Last.fm Tag” (28KB)

October 5th, 2008

Terminal.app in Leopard supports tabs, which is awesome. And, just like Safari, the command to open a new tab is ⌘T.

Call me crazy, but when my brain is in “Terminal mode” things like keyboard shortcuts are just not at the fore (let’s say they’ve been temporarily cached to disk).

What I really wanted was an easy-to-remember command that would open a new tab in Terminal without me having to revert to Mac OS mode. So this is what I added to my .bash_profile:

alias tab="osascript -e 'tell application \"System Events\" to tell process \"Terminal\" to keystroke \"t\" using command down'"

Now I can type tab at any command prompt and instantly get a new tab. One more keystroke, yes, but I preserve my mental context.