From 87c3f8292fd158329cf1abecca6e651a22a7ee89 Mon Sep 17 00:00:00 2001 From: Karl 'vollmerk' Vollmer Date: Mon, 11 Sep 2006 03:41:50 +0000 Subject: fixed up some playlist snafus now appends to playlist and remembers last used --- lib/class/playlist.class.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'lib/class/playlist.class.php') diff --git a/lib/class/playlist.class.php b/lib/class/playlist.class.php index ec5f70b6..866e8ba8 100644 --- a/lib/class/playlist.class.php +++ b/lib/class/playlist.class.php @@ -319,11 +319,20 @@ class Playlist { */ function add_songs($song_ids=array()) { + /* We need to pull the current 'end' track and then use that to + * append, rather then integrate take end track # and add it to + * $song->track add one to make sure it really is 'next' + */ + $sql = "SELECT `track` FROM playlist_data WHERE `playlist`='" . $this->id . "' ORDER BY `track` DESC LIMIT 1"; + $db_results = mysql_query($sql, dbh()); + $data = mysql_fetch_assoc($db_results); + $base_track = $data['track']; + foreach ($song_ids as $song_id) { /* We need the songs track */ $song = new Song($song_id); - - $track = sql_escape($song->track); + + $track = sql_escape($song->track+$base_track); $id = sql_escape($song->id); $pl_id = sql_escape($this->id); -- cgit