Parsing iTunes data with C#

This application has since been updated. Read about the current version of iTunes Playlists to Xml.

For better or worse, when I began setting up my iPod I opted to manually organize my iPod. In large part, this was because at the time I had a machine with a pretty small hard drive, and couldn't keep all of my music on it.

However, with a new HP, I was able to store all my music on that computer, as well as back it up to a USB drive.

Unfortunately, that means that my playlists, ratings, play counts, etcetera, are stored solely on my iPod. Not a good situation to be in. If we could export our iPod library using iTunes, like we can for the library on our computer, it might not be so bad. However, that's not the case.

I've tried manually rating my music on my computer, every once in a while, but it's ended up a disaster.

While I was digging into the iTunesDB, I found a post on how to use a custom library to query this file using C#. Further digging revealed that once you install iTunes you can use C# (etcetera) to access a COM, thereby getting results directly out of iTunes.

But, it seems to be very resource intensive to query iTunes and pull information.

I've created a test application (called iTunes Application) that queries iTunes and outputs the following information;

  • sources of the kind library or iPod
  • playlist names and kinds on those sources
  • the first 10 songs, with the number of stars, on any "Music" playlists

Because of the way it operates, if iTunes isn't started, it will be when the application begins. Outside of writing to a text box and label, no writing occurs, so the application should be pretty safe. Tested on Windows Vista Ultimate and Windows XP Home, with iTunes 8.0.2.20. .NET is required (probably 3.5).

What I'd like to do is have it allow you to pull the songs/ratings for any playlist, on any device. Then I can do a compare to determine what songs are different.

Download iTunes Application pre-alpha.