In searching out cool things I could do with this blog, I happened upon the concept of using Kung-Tunes, a spiffy app written by a fellow living in Japan. Not being a PHP wizard, I struggled to get this to work correctly. Googling away on the subject, I happened upon a summary which looked intriguing. Damn – 403 forbidden – no help. I checked the Google cache, and viola! A *great* guide to using the HTTP-post feature of Kung-Tunes to send my currently playing iTunes track to a ‘track-back’ url in the blog. Confused? Read on for the background I grabbed from the Google cache.
kung-tunes primer, borrowed from s-phase.com
It really is straightforward. First download the application from here. Then check out the author’s instructional blog entry.
This is oriented to Movable Type users who have the TrackBack function built-in. Normally this is a cool way for weblogs to easily refer to one another by pinging to a .cgi script. The latest version of Kung-Tunes takes advantage of this by using the “HTTP POST” method to ping iTunes info to the mt-tb.cgi in your Movable Type installation.
So, once you’ve downloaded the app, go to your Movable Type website’s control panel and select the appropriate blog (assuming you have a couple). In the sidebar on the left, select “Manage/Categories” and create a new Category called “nowplaying”. Click on the “Save” button and wait for the screen to refresh. Now “nowplaying” is added to the list of Categories you already have running. Click on the “Edit category attributes” link next to the “nowplaying” field. Here you can add a description of “nowplaying”, but the key is to scroll down to the section “Incoming Pings” and click the “On” radio button for “Accept incoming TrackBack pings?” Click the “Save” button. The screen will refresh and you’ll see below the “Incoming Pings” section a new section headed “Trackback URL for this category”. In the box below will be an URL that looks something like:
This will vary depending on how you installed Movable Type, and the numeral after mt-tb.cgi will vary (I think). Copy this URL into your clipboard.
Now go back to your blog’s management sidebar and click “Templates” and select “Main Index”. At this point, for prudence’s sake I’d copy the original “Main Index” template to TextEdit in case you goof. Now Kung-Tunes’s author doesn’t recommend just cutting and pasting the HTML that inserts your iTunes track info directly into your template, but assuming your template HTML is straightforward (e.g. the standard column layouts), this is quite doable. I have a heavily modified version of one of the templates that come standard with Movable Type and knew exactly where in the right hand column I wanted to insert my “Now Playing” section. Here’s how it looks for me:
<div class=”sidetitle”><br /> Now Playing<br /> </div></p> <div class=”side”> Below are the tracks I’m currently listening to on iTunes 4:<br /> <p><MTPings category=”nowplaying” lastn=”5″><br /> <$MTPingExcerpt$><br /><br /> </MTPings><br /> </div>
So the “MTPings category” is the new “nowplaying” category we created where “lastn” refers to the number of most recent tracks you’ve listened to.
Now open Kung-Tunes and select the “Preferences” panel from the Kung-Tunes Menu. Make sure the “Upload” tab is selected and that the “Upload Method” is HTTP. Paste in the TrackBack URL into the “URL:” field. Make sure you delete the “http://” from that URL. Kung-Tunes automatically inserts this and otherwise you’ll be left scratching your head why you keep on getting “Type 6 Errors” whenever you try to upload iTunes data to your blog. It took me an hour to find this boneheaded error. Click the “Save” button. As is advisable with any program, if a “Console” is available, open it if you’re having trouble; it’s much easier to spot silly syntax errors if you can see what the application is telling the server.
Otherwise, the defaults in this panel are fine. Next, select the “Formats” panel from the menu and delete everything from each of the fields and paste
title=itunes&url=foo&blog_name=myblogname&excerpt=^t by <b>^p</b> (^a)
into the “Format for currently playing track” field. You can play around with the tags later if you want to customize how the tracks are formatted. Also make sure to enter your own blog’s name where you see “blog_name” above. It’s the name you specified in the Movable Type control panel. Click the “Save” button.
You should be set now. Fire up iTunes. Kung-Tunes should show your track info. Click the “Upload” button and a small bit of text with your track info that’s saved in your /Library/Preferences directory should be sent to your Movable Type installation’s “mt-tb.cgi” and published on your website.
This primer isn’t radically different than the author’s own directions, it just clarifies some points.
Posted by erich at May 04, 2003 03:27 PM