$feed->set_feed_url("http://ws.audioscrobbler.com/1.0/user/bbc6music/recenttracks.rss"); $feed->set_cache_duration(59); # 1 minute $feed->init(); $feed->handle_content_type(); $songs = $feed->get_items(); $song = $songs[0]->get_title(); $query = preg_replace('/\\W/', ' ', $song); $mp3s = array(); if ($conf['amazon']['key'] && $conf['amazon']['secret']) { require __DIR__ . '/amazon.php'; $amazon = new Amazon(); $amazon->key = $conf['amazon']['key']; $amazon->secret = $conf['amazon']['secret']; $amazon->tag = $conf['amazon']['tag']; $mp3s = $amazon->lookup($query); } if (empty($mp3s)) { $mp3s = array(array('info' => 'http://www.amazon.com/s/?url=search-alias%3Ddigital-music&field-keywords=' . urlencode($query))); } $feed->set_feed_url("http://twitter.com/statuses/user_timeline/15734589.rss"); $feed->set_cache_duration(59); # 1 minute $feed->init(); $feed->handle_content_type(); $shows = $feed->get_items(); # title is of the form "on_6music: Liz Kershaw http://bbc.co.uk/6music/" so always chomp first 12 and last 24 $showtitle = substr($shows[0]->get_title(), 11, -24); function getRelativeTime($date) { $diff = time() - $date;