summaryrefslogtreecommitdiffstats
path: root/lib/song.php
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2005-07-09 19:32:21 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2005-07-09 19:32:21 +0000
commit17ff1d5f0f60e29cf12509be663c6f7b2c97893a (patch)
tree26059e0676ee28cd87181334634869f5f3fff11e /lib/song.php
parentc5d6e04d114d3c4b3f31743ccd0d4a60c9ef9632 (diff)
downloadampache-17ff1d5f0f60e29cf12509be663c6f7b2c97893a.tar.gz
ampache-17ff1d5f0f60e29cf12509be663c6f7b2c97893a.tar.bz2
ampache-17ff1d5f0f60e29cf12509be663c6f7b2c97893a.zip
fixed song class
Diffstat (limited to 'lib/song.php')
-rw-r--r--lib/song.php34
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/song.php b/lib/song.php
index 0e847ad9..7c9a3282 100644
--- a/lib/song.php
+++ b/lib/song.php
@@ -53,5 +53,39 @@ function format_song($song) {
} // format_song
+/**
+ * get_popular_songs
+ * This returns the current popular songs
+ * @package Stream
+ * @catagory Get
+ */
+function get_popular_songs( $threshold, $type, $user_id = '' ) {
+
+ $dbh = dbh();
+
+ if ( $type == 'your' ) {
+ $sql = "SELECT object_id FROM object_count" .
+ " WHERE object_type = 'song'" .
+ " AND userid = '$user_id'" .
+ " ORDER BY count DESC LIMIT $threshold";
+ }
+ else {
+ $sql = "SELECT object_id FROM object_count" .
+ " WHERE object_type = 'song'" .
+ " ORDER BY count DESC LIMIT $threshold";
+ }
+
+ $db_result = mysql_query($sql, $dbh);
+ $songs = array();
+
+ while ( $id = mysql_fetch_array($db_result) ) {
+ $songs[] = $id[0];
+ }
+
+ return $songs;
+
+} // get_popular_songs()
+
+
?>