\n"; switch ($type) { case "popularalbum": $date = time() - (86400*7); /* Select Top objects counting by # of rows */ $sql = "SELECT object_id,COUNT(id) AS `count` FROM object_count" . " WHERE object_type='album' AND date >= '$date'" . " GROUP BY object_id ORDER BY `count` DESC LIMIT 10"; $db_result = Dba::query($sql); echo " \n $rss_popularalbum_title\n"; echo " $web_path\n $rss_main_description\n"; echo " $rss_main_copyright\n"; echo " $today\n"; while ( $r = @mysql_fetch_object($db_result) ) { echo "\n"; $album = new Album($r->object_id); echo " <![CDATA[$album->name ($r->count)]]>\n"; echo " $web_path/albums.php?action=show&album=$r->object_id\n"; echo " name - $album->artist ($r->count)]]>\n"; echo "\n"; } echo "\n"; break; case "popularartist"; $date = time() - (86400*7); /* Select Top objects counting by # of rows */ $sql = "SELECT object_id,COUNT(id) AS `count` FROM object_count" . " WHERE object_type='artist' AND date >= '$date'" . " GROUP BY object_id ORDER BY `count` DESC LIMIT 10"; $db_result = mysql_query($sql, $dbh); echo " \n $rss_popularartist_title\n"; echo " $web_path\n $rss_main_description\n"; echo " $rss_main_copyright\n"; echo " $today\n"; while ( $r = @mysql_fetch_object($db_result) ) { echo "\n"; $artist = new Artist($r->object_id); echo " <![CDATA[$artist->name ($r->count)]]>\n"; echo " $web_path/artists.php?action=show&artist=$r->object_id\n"; echo " name - $artist->albums ($r->count)]]>\n"; echo "\n"; } echo "\n"; break; case "popularsong"; $date = time() - (86400*7); /* Select Top objects counting by # of rows */ $sql = "SELECT object_id,COUNT(id) AS `count` FROM object_count" . " WHERE object_type='song' AND date >= '$date'" . " GROUP BY object_id ORDER BY `count` DESC LIMIT 10"; $db_result = mysql_query($sql, $dbh); echo " \n $rss_popularsong_title\n"; echo " $web_path\n $rss_main_description\n"; echo " $rss_main_copyright\n"; echo " $today\n"; while ( $r = @mysql_fetch_object($db_result) ) { echo "\n"; $song = new Song($r->object_id); $artist = $song->get_artist_name(); echo " <![CDATA[$artist - $song->title ($r->count)]]>\n"; echo " $web_path/stream.php?action=single_song&song_id=$r->object_id\n"; echo " title ($r->count)]]>\n"; echo "\n"; } echo "\n"; break; case "latestartist": $sql = "SELECT DISTINCT artist,album FROM song ORDER BY addition_time DESC LIMIT 10"; $db_result = mysql_query($sql, $dbh); $items = array(); echo " \n $rss_latestartist_title\n"; echo " $web_path\n $rss_main_description\n"; echo " $rss_main_copyright\n"; echo " $today\n"; while ( $item = mysql_fetch_row($db_result) ) { echo " \n"; $artist = new Artist($item[0]); $album = new Album($item[1]); $album->format_album(); $artist->format_artist(); echo " <![CDATA[$artist->full_name]]>\n"; echo " $web_path/artists.php?action=show&artist=$item[0]\n"; echo " full_name - $album->name]]>\n"; echo " \n"; } echo " \n"; break; case "latestalbum": $sql = "SELECT DISTINCT album FROM song ORDER BY addition_time DESC LIMIT 10"; $db_result = mysql_query($sql, $dbh); echo " \n $rss_latestalbum_title\n"; echo " $web_path\n $rss_main_description\n"; echo " $rss_main_copyright\n"; echo " $today\n"; while ( $item = mysql_fetch_row($db_result) ) { echo "\n"; $album = new Album($item[0]); $album->format_album(); echo " <![CDATA[$album->name]]>\n"; echo " $web_path/albums.php?action=show&album=$item[0]\n"; echo " name - $album->artist]]>\n"; echo "\n"; } echo "\n"; break; case "recentlyplayed": $time_unit = array('',_('seconds ago'),_('minutes ago'),_('hours ago'),_('days ago'),_('weeks ago'),_('months ago'),_('years ago')); $recent = get_recently_played(); echo " \n $rss_recentlyplayed_title\n"; echo " $web_path\n $rss_main_description\n"; echo " $rss_main_copyright\n"; echo " $today\n"; foreach ( $recent as $item ){ $amount = intval(time() - $item['date']+2); $time_place = '0'; while ($amount >= 1) { $final = $amount; $time_place++; $amount = floor($amount/60); } $time_string = $final . ' ' . $time_unit[$time_place]; echo "\n"; $song = new Song($item['object_id']); $song->format(); $user = new User($item['user']); $user->format_user(); echo " <![CDATA[$song->title]]>\n"; echo " $web_path/stream.php?action=single_song&song_id=".$item['object_id']."\n"; echo " fullname played $song->title - $song->f_artist $time_string]]>\n"; echo "\n"; } echo "\n"; break; default: $now_playing = get_now_playing(); $rss_song_description = $rss_description; echo " \n $rss_main_title\n"; echo " $web_path\n $rss_main_description\n"; echo " $rss_main_copyright\n"; echo " $today\n"; foreach ( $now_playing as $r ){ $song = $r['song']; $user = $r['user']; $song->format(); $artist = $song->f_artist; $album = $song->get_album_name(); $text = "$artist - $song->f_title played by $user->fullname"; echo " \n"; echo " <![CDATA[$text]]> \n"; echo " $web_path/image.php?id=$song->album\n"; echo " $web_path/albums.php?action=show&album=$song->album\n"; echo " f_title @ $album is played by $user->fullname]]>\n"; echo " $today\n"; echo "\n"; } echo "\n"; break; } } ?>