summaryrefslogtreecommitdiffstats
path: root/lib/class/playlist.class.php
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-11-05 09:59:50 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-11-05 09:59:50 +0000
commitd3b5f2f3f814f0342094b60614af10ec7b9d82b2 (patch)
tree261b00384b64dffec1274735db9fe564bd4e67dc /lib/class/playlist.class.php
parent99ed8eb9b0bb7f80bb12201c5231fe97c67cf452 (diff)
downloadampache-d3b5f2f3f814f0342094b60614af10ec7b9d82b2.tar.gz
ampache-d3b5f2f3f814f0342094b60614af10ec7b9d82b2.tar.bz2
ampache-d3b5f2f3f814f0342094b60614af10ec7b9d82b2.zip
more work towards the democratic play stuff, really need a UI to test from here on out
Diffstat (limited to 'lib/class/playlist.class.php')
-rw-r--r--lib/class/playlist.class.php10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/class/playlist.class.php b/lib/class/playlist.class.php
index 866e8ba8..af4962c9 100644
--- a/lib/class/playlist.class.php
+++ b/lib/class/playlist.class.php
@@ -159,12 +159,16 @@ class Playlist {
/**
* get_random_songs
* This returns all of the songs in a random order, except those
- * pulled from dyn_songs
+ * pulled from dyn_songs, takes an optional limit
*/
- function get_random_songs() {
+ function get_random_songs($limit='') {
+
+ if ($limit) {
+ $limit_sql = "LIMIT " . intval($limit);
+ }
$sql = "SELECT * FROM playlist_data WHERE playlist='" . sql_escape($this->id) . "'" .
- " ORDER BY RAND()";
+ " ORDER BY RAND() $limit_sql";
$db_results = mysql_query($sql, dbh());
$results = array();