Recently envious of Matt Woodward's Now Playing on iTunes pod on his blog, a blog built with BlogFusion, I investigated what might be involved in producing an equivalent pod for BlogCFC software users.

I read the installation and usage guide for the Now Playing plug-in, available for a small charge from Brandon Fuller, and it seemed very easy to setup in iTunes. I logged into PayPal, bought a Now Playing license, and immediately received my key in the mail. The plug-in for Mac has few features than the one for Windows by the way. I think he will implement the Mac features in the not too distant future tho.

The plug-in will upload a small xml file called now_playing.xml to a specified directory on your FTP server where your ColdFusion server and blog reside. For each song played, the now_playing.xml file is uploaded with the metadata associated with the song currently playing. If the song has an artwork image associated with it, that image is also uploaded.

To display the song on my blog, I had to write a pod for BlogCFC that would not only parse the the now_playing.xml file to display info like the song name, artist, and album in the pod, but I also had to design a way for the pod to behave efficiently so as to minimize the number of times it reads the timestamp on now_playing.xml and parsing the file only if the pod detects that the file has been updated.

So you can see to the left that the Now Playing pod for BlogCFC is being used here. A few assumptions are made for efficiency, and they are configurable in the code. The pod assumes by default that it should only check for a new file after at least 3 minutes have passed since the last time it checked, which I estimate to be an average running time for a song. After 3 minutes it will check the timestamp for every page request until the now_playing.xml file has been updated or until the default max value of 60 minutes where the pod goes into a kind of sleep mode where it assumes that you have stopped playing iTunes. There's also a snooze feature that really kicks in after 60 minutes and will then wake up to check for a new file only once every 5 minutes by default, waiting for you to start iTunes again.

The pod usage is described in the comments, but all you have to do is save the pod cfm file to the {blog_root}/includes/pods/ directory and create a new directory {blog_root}/nowplaying/. Then configure your iTunes plugin to upload to {blog_root}/nowplaying/. The additional directory is recommended because if the song has artwork the image is also uploaded, so its better put all that in their own directory.

Please check it out and report and problems to me. So far I think I've ruled out any glaring problems, but you never know.

Download Now Playing Pod for BlogCFC