Sunday, October 01, 2006

Locked in the bunker

I barely left my room this weekend. I've been working on my latest computer project and the current phase is extremely tedious. Briefly:

I'm guessing that you, dear reader, are either using Windows or OSX. Well, there's a third thing called Linux. Linux is FREE. It's free both as in speech and as in beer. That is to say, it doesn't cost any money and it's not proprietary/copyrighted/licensed/restricted/closed-source. The problem is, it's not as good. But that's starting to change. There's a new type of Linux called Ubuntu. Ubuntu is fully functional and very easy to use. It's not quite ready to take over the world (e.g., I'm not going to recommend it to my mom yet), but it's getting close. I've been using Ubuntu for about a month now and I'm not looking back.

I use iTunes on Windows and when I moved to Ubuntu, I wanted a familiar interface for my music. Linux has a number of iTunes-clones for organizing and playing music. The app I settled on is called Banshee. It imported my music collection just fine, but certain information that I had in iTunes (song ratings, play counts, play lists, &c.) is kept inside of iTunes and therefore wasn't brought into Banshee. Since iTunes is a popular music player, I imagine other first-time Linux users will have this problem too.

I'm writing a plugin for Banshee that will dig that information out of iTunes an merge it into Banshee. If all goes well, the plugin will import the following:

Luckily, iTunes makes available an XML file with most of that info. Here's an excerpt from the file (emphasis mine):
<key>Name</key><string>Stacey's Mom</string>
<key>Total Time</key><integer>198844</integer>
<key>Track Number</key><integer>3</integer>
<key>Track Count</key><integer>16</integer>
<key>Play Count</key><integer>77</integer>
<key>Play Date</key><integer>3242496736</integer>
As you can see, the information we're looking for is very easy to find. I've listened to Stacey's Mom 77 times and it has a rating of 100 (5 stars). Right now, my plugin does a fine job of importing ratings, play counts, last played, and playlists. The next step is to handle smart playlists. Here's where it gets tricky. While the XML data is very easy to read, smart playlists are encoded in binary: 1's and 0's. Here is part of a smart playlist:
00000000 00000000 00000000 00010010 00000000
01000010 00000000 01100101 00000000 01101110
00000000 00100000 00000000 01000110 00000000
01101111 00000000 01101100 00000000 01100100
00000000 01110011 01010011 01001100 01110011
That is decidedly more difficult to interpret. Enter the I-haven't-left-my-room-in-two-days factor. So I've spent the last 48 hours creating smart playlists in iTunes and analyzing the bytes that come out. I'm making good headway and it's only a matter of time before I have all of the bits figured out, but the tedium does wear on me.

Thankfully, I've discovered a new distraction: DEFCON! It's a charming little game about global thermonuclear warfare. It's easy to learn and loads of fun and best of all, you can play the whole game for free (the demo just limits the number of opponents you can have). New York City is a common target for ICBMs, so maybe it's best that I stay inside.