Trackbacks in Winamp

You might have noticed that I show the current playing song from my mp3 player here on my site. What you don't know is that I've been using a hack for the past few months. For Winamp, I used the DoSomething plugin to work through a local special template file which would create another local flat file with song info. I'd then ftp the output file to my server, which I loaded as an include. To get my mac to the same, I had to setup a similar program, and both hacks ended up constantly sending flat files to my server over insecure FTP. Kinda sounds like overkill, doesn't it?

I kind of rushed to get this site's new design online before the trip to Austin, and this past week at SXSW gave me about a bazillion more ideas for the site. I'm going to write up all the tech I used, how I built it, and why I did each part in a couple weeks when the site is more feature complete, but I wanted to give you a preview of what that'll be like.

One of the ideas I got yesterday at lunch was using trackback on blogs to do Now Playing lists by just passing urls through mp3 players. I asked Ben and Mena a couple questions and they told me it was 10 minutes work. With a few clicks and copy/paste jobs, I just completed in a matter of minutes and it actually worked.

So Winamp is now sending trackbacks to my blog, and every time a new song comes on, a new ping goes out, and my site changes. Here's how to do it in Winamp 2.x:

- Go into your movabletype admin and make a new category for your blog to hold all the song pings.

(I called mine "nowplaying". You won't post new items to this category, it'll just be a dumping ground for trackback pings. Categories can accept trackbacks in the newer (2.5+?) versions of MT.)

- Hit the "edit category attributes" link after you create the category.

- Toggle the "Accept incoming TrackBack pings?" to yes.

- Copy the tb URL to the clipboard

- Download the DoSomething Plugin and install it.

- Go into Winamp's preferences (control-P), look under the Plugins - General Purpose, highlight DoSomething, then hit configure (follow the next steps exactly because the DoSomething plugin has a crappy UI).

- Find the "Actions" drop down, change it to "Submit A URL"

- On the URL line, paste your trackback URL that MT gave you after you enabled category trackbacks. I modified mine slightly, so that it took the following form:

http://example.com/mt/mt-tb.cgi?tb_id=xxxx

(xxx = special ID given to you by MT)

Now, to complete the trackback data, just add on song info as an excerpt in the URL. DoSomething offers artist, song, album, and lots of other info, but I find in my aging and varied collection of MP3s, the simpliest "%%CURRENTSONG%%" variable gives you what it can.

I submit a fake URL, and I used blog_name to trackback my username (if you had a group blog, you might want to track other authors like this).

My final DoSomething URL looks like this:

http://example.com/mt/mt-tb.cgi?tb_id=xxxxx
&excerpt=%%CURRENTSONG%%&url=foo&blog_name=mathowie

Be sure to then click the "Add ->" button to save it to DoSomething's list of things to do when playing mp3s.

- Go back to MT, and make a new index template, like so:

<MTPings category="nowplaying" lastn="10">
<$MTPingExcerpt$><br />
</MTPings>

I include that down the side of my site using normal server-side includes, but you could also just toss the previous code into your main template (be aware it might involve a lot of rebuilding in the main template, that you might want to avoid).

I bet this would be a ten minute applescript hack for iTunes. If anyone figures that out too, lemme know. I'd love to be able to keep track of songs played on both platforms.

Also note that in the ten minutes it took me to implement this, I used a single variable from Winamp, and only display a single variable from the trackback. There is lots of room for customization here, and this could be just the tip of the iceberg on how to connect various applications to your blog. There are still some display issues for me to work out over in my sidebar, but I'm really impressed it all worked so easily.

update: Ian Skeeling got it working in Blosxom.