I’ve been playing around with Firefly Media Server a bit of late, and I needed a good way to convert my existing iTunes playlists into m3u files which Firefly would understand. Since iTunes exports XML playlist files, and since I’ve been meaning to learn some XSLT, I thought I’d give an XSLT converter a try.

The XSLT relies on features found in XSTL 2.0, so you’ll need a 2.0 compatible processor, like Saxon. To use Saxon, you’ll also need Java installed, and Saxon is command-line only.

To use with Saxon, export your playlist from iTunes as an XML file, and then run:

java -jar saxon9.jar -s:MyPlaylist.xml -xsl:itunesToM3u.xsl -o:MyPlaylist.m3u

This will strip out any escaped values in the URLs in the iTunes XML file, and strip off the leading “file://localhost/” from each file. Enjoy!

Get it here: itunesToM3u.xsl