Software: July 2005 Archives

You may recall I half-wrote a script to do this a couple years ago, but I was mostly cribbing from some guy at Apple and really had no idea what i was doing.

Anyway, I'm taking another shot at parsing the iTunes library XML using PHP5's new "SimpleXML" library, which is a terrific feature that I never get tired of working with.

I cooked up this little script in about 10 minutes. The format of Apple's XML files makes it sort of a pain to process in the usual ways, but you can still get reasonable output with just a few lines of code. And most of that code is concerned with formatting, not the actual XML processing.

To use this script:

  1. Make sure you are using PHP5 with SimpleXML support. At Dreamhost, you can turn this on by clicking the "edit" link on the main domain management page. If you're hosting a site on your Mac, you can get an easy-to-install version of PHP5.
  2. In iTunes, select a Playlist or Library, choose "File:Export..." and export it as XML. Name it itunes.xml. (If your site is hosted on your Mac, you can just create a symlink called "itunes.xml" that points to your "iTunes Music Library.xml" file or the playlist file you just exported. Place this link in your website directory.)
  3. Upload itunes.phps and itunes.xml to your webserver.
  4. Rename itunes.phps to itunes.php.
  5. Open your browser and navigate to itunes.php.

Obviously there are lots of ways to enhance the functionality of this script, but this will get you started.

About this Archive

This page is a archive of entries in the Software category from July 2005.

Software: February 2005 is the previous archive.

Software: September 2005 is the next archive.

Find recent content on the main index or look in the archives to find all content.

Powered by Movable Type 4.0