summaryrefslogtreecommitdiffstats
path: root/lib/class
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2005-08-13 04:30:26 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2005-08-13 04:30:26 +0000
commite7fea90327419214531371543662056c1398470d (patch)
tree8b7642b5cac62994ff55f80e733dedbff22105bf /lib/class
parent3836a33d1c210a806c13f9bb172724394fb3fd80 (diff)
downloadampache-e7fea90327419214531371543662056c1398470d.tar.gz
ampache-e7fea90327419214531371543662056c1398470d.tar.bz2
ampache-e7fea90327419214531371543662056c1398470d.zip
new mpd mojo from rosensama and rperkins
Diffstat (limited to 'lib/class')
-rw-r--r--lib/class/playlist.class.php12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/class/playlist.class.php b/lib/class/playlist.class.php
index b17eadc6..7fa55492 100644
--- a/lib/class/playlist.class.php
+++ b/lib/class/playlist.class.php
@@ -186,18 +186,26 @@ class Playlist {
/*!
@function add_songs
@discussion Reads an array of song_ids to add to the playlist
+ @param $song_ids the array of song_ids
+ @param $is_ordered boolean, if true insert in order submitted, not by track number
*/
- function add_songs($song_ids) {
+ function add_songs($song_ids, $is_ordered = false) {
$dbh = dbh();
if ($this->id && isset($song_ids) && is_array($song_ids)) {
+ $count = 0;
foreach ($song_ids as $song_id) {
+ if( $is_ordered ) {
+ $track_num = $count++;
+ } else {
+ $track_num = $song->track;
+ }
$song = new Song($song_id);
if (isset($song->id)) {
$sql = "INSERT INTO playlist_data" .
" (playlist, song, track)" .
- " VALUES ('$this->id', '$song->id', '$song->track')";
+ " VALUES ('$this->id', '$song->id', '$track_num')";
$db_results = mysql_query($sql, $dbh);
}
}