iTunes and Rhythmbox Ratings

Posted May 21, 2007

A couple months ago, I moved my trusty Alienware laptop from Windows XP to Ubuntu. So far, I'm very happy with using Linux. It's faster, more stable, runs Beryl (so I can get all my nifty visualizations), and most important of all, isn't a Microsoft product.

There are, of course, some things I miss. Photoshop is a big one; The Gimp just doesn't feel natural enough. I also sometimes miss the advanced features of the Microsoft Office suite, though usually OpenOffice does a fine job. But what I miss most of all are the song ratings I worked so hard to put into iTunes.

At first, I tried using Amarok for my music, but found it to be a little sluggish in GNOME, outside of its natural, K-flavored environment. After switching to Rhythmbox, I was much happier. Rhythmbox has similar features to iTunes, like smart playlists, podcasts and internet radio, but with a much smaller footprint. But because there was no easy way to transfer ratings from iTunes, my main method of sorting and categorizing songs, I often found myself skipping through 10 or more songs to find something I wanted to listen to.

I searched the web for ways to import iTunes ratings to Rhythmbox, but came across nothing useful. So, like any good hacker, I decided to write my own. Using Python and an example of how to parse the iTunes library, I figured out how to extract the ratings for each song. Next, I wrote a class to parse the Rhythmbox Library, using much of the same code as the iTunes parser. Finally, I found a tutorial on proper XML generation, which helped me write the output of the updated Rhythmbox Library.

The script can be found at http://code.google.com/p/itunes-to-rhythmbox- ratings/. Enjoy, and let me know if you find any bugs.