summaryrefslogtreecommitdiffstats
path: root/lib/song.php
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-12-20 02:59:31 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-12-20 02:59:31 +0000
commitd62207327c99ea070985d46eaa8399b139914a86 (patch)
tree2b44571cd8639a27b1649f97c57c02b5cb5e5395 /lib/song.php
parentb47b6976239b8e35284c9fa84610cec2dd6d4cd4 (diff)
downloadampache-d62207327c99ea070985d46eaa8399b139914a86.tar.gz
ampache-d62207327c99ea070985d46eaa8399b139914a86.tar.bz2
ampache-d62207327c99ea070985d46eaa8399b139914a86.zip
* Added new icons, and speed up icon display
* Fixed ORDER BY `track` on play selected * Started work on editing/flagging albums and artists
Diffstat (limited to 'lib/song.php')
-rw-r--r--lib/song.php33
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/song.php b/lib/song.php
index b1d3579d..8aa24ead 100644
--- a/lib/song.php
+++ b/lib/song.php
@@ -45,6 +45,39 @@ function get_songs($sql, $action=0) {
} // get_songs
/**
+ * get_songs_from_type
+ * This gets an array of songs based on the type and from the results array
+ * can pull songs from an array of albums, artists whatever
+ */
+function get_songs_from_type($type,$results,$artist_id='') {
+
+ // Init the array
+ $songs = array();
+
+ $type = sql_escape($type);
+
+ $sql = "SELECT id FROM song WHERE ";
+
+ foreach ($results as $value) {
+ $value = sql_escape($value);
+ $sql .= "`$type`='$value' OR ";
+ }
+
+ // Run the long query
+ $sql = rtrim($sql,'OR ');
+ $sql .= " ORDER BY `track`";
+
+ $db_results = mysql_query($sql,dbh());
+
+ while ($r = mysql_fetch_assoc($db_results)) {
+ $songs[] = $r['id'];
+ }
+
+ return $songs;
+
+} // get_song_from_type
+
+/**
* 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