summaryrefslogtreecommitdiffstats
path: root/lib/song.php
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-11-26 04:04:24 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-11-26 04:04:24 +0000
commita41697ea25a58ea5db5ed46a251fb62364626b1b (patch)
tree9754a325a5c700135e69e341b47d2658d2344762 /lib/song.php
parent0635397ab2bd5afc6789cef56b9a9d87bd52bcfd (diff)
downloadampache-a41697ea25a58ea5db5ed46a251fb62364626b1b.tar.gz
ampache-a41697ea25a58ea5db5ed46a251fb62364626b1b.tar.bz2
ampache-a41697ea25a58ea5db5ed46a251fb62364626b1b.zip
tweaked icons to use built in functions and removed them from where there were not icons for every optin, added recently played
Diffstat (limited to 'lib/song.php')
-rw-r--r--lib/song.php26
1 files changed, 25 insertions, 1 deletions
diff --git a/lib/song.php b/lib/song.php
index 5156ca88..b1d3579d 100644
--- a/lib/song.php
+++ b/lib/song.php
@@ -42,7 +42,31 @@ function get_songs($sql, $action=0) {
return $results;
-} // get_albums
+} // get_songs
+
+/**
+ * get_recently_played
+ * This function returns the last X songs that have been played
+ * It uses the 'popular' threshold to determine how many to pull
+ */
+function get_recently_played() {
+
+ $sql = "SELECT object_count.object_id, object_count.user, object_count.object_type, object_count.date " .
+ "FROM object_count " .
+ "WHERE object_type='song' " .
+ "ORDER by object_count.date DESC " .
+ "LIMIT " . conf('popular_threshold');
+ $db_results = mysql_query($sql, dbh());
+
+ $results = array();
+
+ while ($r = mysql_fetch_assoc($db_results)) {
+ $results[] = $r;
+ }
+
+ return $results;
+
+} // get_recently_played
/*!
@function format_song