This document is available on the Internet at:  http://urbanmainframe.com/folders/blog/20040518/

iTunes to Weblog Interface

Date:  18th May, 2004

Filed Under:

Following months of yearning, I finally get a "now playing in iTunes" widget on my website and it was so easy to implement...

The more observant among you might have noticed the introduction of a new item in the sidebar of this weblog the "Who Am I?" page. The "Currently Hearing" panel lists the track that I am currently playing in iTunes (if any). It also displays the artist and album (most of the time).

The source data file for the panel is updated in real-time. So, as you browse the weblog refresh the page, the track information will change - revealing the true depths of my eclectic and questionable taste in music.

I have been trying to find a way of doing this for many months. I finally discovered Brandon Fuller's "Now Playing" plug-in just as I was beginning to consider abandoning my quest.

"Now Playing" is stunning in its simplicity and elegance. Its tabbed UI is uncluttered and uncomplicated.

The plug-in extracts current track information via the iTunes API, generates a tiny XML file from the contents and then uploads that file directly on to the web-server (via FTP or Secure FTP). The process is totally transparent once it's configured.

Once the file's on the web-server, it's a simple matter to get the data on to a web-page (as illustrated on Brandon's website).

I have enclosed the "Now Playing" fields with appropriate links for a little added value:

  • Track Name - This uses Google's "I'm Feeling Lucky" functionality to locate lyrics for the currently playing track, where possible (assuming it's not an instrumental piece). I added this because I just love to sing along when I'm all alone (much to the annoyance of my neighbours)!
  • Artist - This launches a Google search using the artist's name, great for catching up with that salacious celebrity gossip!
  • Album - This launches an Amazon search for the album currently being played - in a roundabout kind of way (ie: it doesn't always work), again using Google's "I'm Feeling Lucky" search facilities in conjunction with its "site:" localisation.

I heartily recommend this excellent plug-in. Nice work Brandon.


Of Note...

Unfortunately, my ID3 tag maintenance is not as thorough as it should be. Because of this, the information displayed in the panel might be missing a few details on occasion.

There is a 10-second delay between my track changes and the website being updated. This is a feature of "Now Playing". Its purpose is to avoid the erratic changes that would otherwise occur when I listen to just the first few seconds of a track before deciding to skip it.

"Now Playing" does not, as yet, notify the website when a track is paused or play is stopped. This means that a track's details will be persistent when either condition occurs (either that or I am simply playing the same track over and over - I frequently do). However, the plug-in does notify the website when iTunes is closed and the display will reflect that.


See Also

Redux: iTunes to Weblog Interface