summaryrefslogtreecommitdiffstats
path: root/lib/class/song.class.php
diff options
context:
space:
mode:
authormartian <martian@ampache>2010-02-09 17:44:44 +0000
committermartian <martian@ampache>2010-02-09 17:44:44 +0000
commit1b35c20dd0a93b143d8b9542743a743e0db66386 (patch)
tree0500ae3eec1dfb70b66c3ca30e9a61da2c0daba8 /lib/class/song.class.php
parent5e52f0d7ccb6183d7e1b4e5033adad0d08a48eb6 (diff)
downloadampache-1b35c20dd0a93b143d8b9542743a743e0db66386.tar.gz
ampache-1b35c20dd0a93b143d8b9542743a743e0db66386.tar.bz2
ampache-1b35c20dd0a93b143d8b9542743a743e0db66386.zip
Adding the bandwidth option to the preferences. This changes the complexity of the UI and toggles album art.
Diffstat (limited to 'lib/class/song.class.php')
-rw-r--r--lib/class/song.class.php11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/class/song.class.php b/lib/class/song.class.php
index 7d30b116..6b68df94 100644
--- a/lib/class/song.class.php
+++ b/lib/class/song.class.php
@@ -918,7 +918,7 @@ class Song extends database_object implements media {
* it uses the popular threshold to figure out how many to pull
* it will only return unique object
*/
- public static function get_recently_played($user_id='') {
+ public static function get_recently_played($user_id='', $limit=null) {
if ($user_id) {
$user_limit = " AND `object_count`.`user`='" . Dba::escape($user_id) . "'";
@@ -931,12 +931,15 @@ class Song extends database_object implements media {
"ORDER BY `object_count`.`date` DESC ";
$db_results = Dba::read($sql);
- $results = array();
+ $results = array();
while ($row = Dba::fetch_assoc($db_results)) {
if (isset($results[$row['object_id']])) { continue; }
- $results[$row['object_id']] = $row;
- if (count($results) > Config::get('popular_threshold')) { break; }
+ $results[$row['object_id']] = $row;
+ if (!is_null($limit))
+ if (count($results) > $limit) { break; }
+ else
+ if (count($results) > Config::get('popular_threshold')) { break; }
}
return $results;