From b6cfe134badb2d4393e9081b13b2dfca011ed736 Mon Sep 17 00:00:00 2001 From: Karl 'vollmerk' Vollmer Date: Sun, 7 Jan 2007 20:35:49 +0000 Subject: * Re-worked Main page of Ampache, adding Album of the moment. * Moved stats to /stats.php page * Fixed logic error in resize that could cause nothign to display if resize was on, but it still failed * Fixed Upload Album art from Find Album Art * Added Menu to the TV page * Fixed logic error that showed localplay if user had access regardless of global config * Changed default action of browse.php to song browse --- lib/album.lib.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'lib/album.lib.php') diff --git a/lib/album.lib.php b/lib/album.lib.php index d01691b2..134e040e 100644 --- a/lib/album.lib.php +++ b/lib/album.lib.php @@ -59,4 +59,28 @@ function get_image_from_source($data) { } // get_image_from_source +/** + * get_random_albums + * This returns a random number of albums from the catalogs + * this is used by the index to return some 'potential' albums to play + */ +function get_random_albums($count='') { + + if (!$count) { $count = 5; } + + $count = sql_escape($count); + + $sql = "SELECT id FROM album ORDER BY RAND() LIMIT $count"; + $db_results = mysql_query($sql,dbh()); + + $results = array(); + + while ($r = mysql_fetch_assoc($db_results)) { + $results[] = $r['id']; + } + + return $results; + +} // get_random_albums + ?> -- cgit