Saturday, 9 May 2009

iTunes in Adobe Air

I use itunes a lot and it struck me to think how apple decided to store all of my playlist information, song name, album, artist, composer, track length and so on... So I opened up my iTunes Music Library.xml file and saw what I can only describe as a complete mess. Apple have made it very difficult indeed to find what you are looking for in their bundle of seemingly random XML nodes. Below is an example of the information stored for a single song.
A complete and utter mess if you ask me. Anyway I went about foolishly trying to decode the alien structures. A word to apple, why not just label your XML tags with relevant names, like track ID, instead of calling every single one ? So after a few hours I had a fully working iTunes emulator, running perfectly well with 20000 or so tracks all loaded into a dataGrid component. Due to the shear amount of XML (mostly wasted) songs couldn't all be loaded at once which meant a small wait until the Air application had parsed every line. I think that if apple ordered it's XML in a slightly more coherent and sensible fashion then the task would have been far easier. Anyway here is a screenshot of what I came up with.
I also added the music visualizer to the application and now I have my very own lightweight itunes, get in touch if you're interested in the source for either of these things.


  1. Hi,

    I really like what you've come up with here! I am building a jukebox application that plays mp3's from data stored in an SQLite db. I was hoping to integrate some sort of iTunes support for playing files also and was wondering could you possibly provide me with some source code? I would really appreciate any help or advice?

    You can reach me at

    Many thanks

  2. Hi Adam, have emailed you with some stuff!

  3. Hi Sam... is there any chance I might be able to get a copy of this? I'm doing integration similar to adam above. Would be much appreciated. email is

  4. Hey there, I'll just copy you in on the email I sent to adam, should have a bit to get you started!


  5. Hi Sam,

    I realize this is a little late in the day/year but very interesting project, i'm intrigued by the process as i'm looking to do the reverse, import tracks into the iTunes library using Air.

    Would greatly appreciate it if i could have a look at your source to see how you deciphered the XML structure. Would you mind sending to davegrant85[at] ?

  6. Hi Dave, I have some badly written, uncommented examples which I'd be more than happy to send to you. What you're trying to do is definitely doable. Just make sure you test with a smaller test library first, otherwise you're at risk of overwriting a lot of data!

    I'll email them over as soon as I'm on my computer.

  7. Hi Sam,

    I'm definitely interested in looking at the source for this. Also something I've been banging my head against lately: Do you think there's any way to get an Adobe AIR app to accept a song dragged from iTunes under OS X? It works fine in windows, but there's something weird about the iTunes Clipboard object which I don't understand. :(

    At any rate, my email address is philip at mccarty at gmail dot com.