because something was f[beep] up with the way kung-tunes posted the trackinfo from my itunes to the sidebar, here’s the roundup on how i did it (adding to this post):
– go to mt’s control panel.
– make a new blog (itunes).
– make a new category (nowplaying).
– hit “edit category attributes”, toggle “accept incoming trackback pings” to yes.
– jot down the trackback url.
– add that url to kung-tunes preferences.
– make the format of kungtunes notification:
&title=^t&url=http://itunes.com&#pblog_name=^p#p&#aexcerpt=^a#a
– add three files to the sub-blog (here: itunes), now_playing.html and lastfive.html and last30.html.
– for each of the three above files add something along these lines to the code: (MTAmazon optional for album cover)
<?php
function datediff($datestr)
{
$r = array();
$d = time() – strtotime($datestr);
if ($d > 86400*2)
array_push($r, floor($d / 86400) . ” days”);
elseif ($d > 86400)
array_push($r, “1 day”);
$d = $d % 86400;
if ($d > 7200)
array_push($r, floor($d / 3600) . ” hours”);
else if ($d > 3600)
array_push($r, “1 hour”);
$d = $d % 3600;
if ($d > 120)
array_push($r, floor($d / 60) . ” minutes”);
else if ($d > 60)
array_push($r, “1 minute”);
if (!count($r))
return “now”;
else
return implode(” and “, $r) . ” ago”;
}
?>
<MTPings category=”nowplaying” lastn=”1″><br/>
<MTAmazon search=”[MTPingBlogName] [MTPingExcerpt]”
line=”music” lastn=”1″>
<a href=”<MTAmazonLink>”>
<img border=”0″ src=”<MTAmazonSmallImage>” align=”left” alt=”see the album” />
</a>
</MTAmazon>
<a href=”itms://phobos.apple.com/WebObjects/MZSearch.woa/
wa/advancedSearchResults?songTerm=<$MTPingTitle encode_url=”1″$>&artistTerm=<$MTPingBlogName encode_url=”1″$>” title=”Search at the iTunes Music Store”>
<$MTPingTitle$></a><br/>by <a href=”itms://
phobos.apple.com/WebObjects/MZSearch.woa/wa/
advancedSearchResults?artistTerm=<$MTPingBlogName encode_url=”1″$>”
title=”Search at the iTunes Music Store”><$MTPingBlogName$></a><br/>from the album <a href=”itms://phobos.apple.com/WebObjects/MZSearch.woa/wa/
advancedSearchResults?albumTerm=<$MTPingExcerpt encode_url=”1″$>”
title=”Search at the iTunes Music Store”><$MTPingExcerpt$></a><p/>was played <? echo datediff(‘<$MTPingDate format=”%Y-%m-%d %H:%M:%S”$>’); ?>.
<br />
</MTPings>
<br clear=”all” />
– thank b. for whacking out quite a bit of the above code and helping with the initial debugging.
– prettify the code for the 5 and 30 page, because these are the pages the people are gonna look at (iterate lastn=X in: “<MTPings category=”nowplaying” lastn=”1″><br/>”.
– add the code below to the sidebar of the main blog.
<?php require_once(“itunes/now_playing.html”); ?>
you can also see the <a href=”https://habi.gna.ch/blog/itunes/lastfive.html” target=”_blank”>last five</a> or the <a href=”https://habi.gna.ch/blog/itunes/last30.html” target=”_blank”>last 30 songs</a>
– rebuild all involved blogs.
– wash, rinse, repeat
btw: you did not notice that since i installed panther kung-tunes was posting the album title as the song title, did you?
How would I adapt
&title=^t&url=http://itunes.com&#pblog_name=^p#p&#aexcerpt=^a#a
So that the Genre is also sent with it?
thanks!
hey, sorry for not responding, i was on holidays….
i have no idea on how you would do that (mostly because i never use “genre” in itunes)
maybe you can find some infos on the links i liked from http://habi.gna.ch/blog/archives/000129.html or you might be able to adapt the comment upload according to the preferences found in kung-tunes.
hope that helps you a bit.