diff options
author | Paul Arthur <paul.arthur@flowerysong.com> | 2013-02-07 14:35:03 -0500 |
---|---|---|
committer | Paul Arthur <paul.arthur@flowerysong.com> | 2013-02-07 14:35:03 -0500 |
commit | 46cb6c81c584b9776aec14c434b3fa4720a87c5e (patch) | |
tree | 36604cd4da0e172105e09f5b472079e17a4bc540 | |
parent | 239ea81fdf2fa2bda8a8556e19412264396fe52a (diff) | |
download | ampache-46cb6c81c584b9776aec14c434b3fa4720a87c5e.tar.gz ampache-46cb6c81c584b9776aec14c434b3fa4720a87c5e.tar.bz2 ampache-46cb6c81c584b9776aec14c434b3fa4720a87c5e.zip |
FS#272 - Adding songs to democratic playlist
This might fix democratic handling. Untested.
-rw-r--r-- | lib/class/democratic.class.php | 4 | ||||
-rw-r--r-- | lib/class/stream_playlist.class.php | 10 |
2 files changed, 8 insertions, 6 deletions
diff --git a/lib/class/democratic.class.php b/lib/class/democratic.class.php index 8b77f786..b6264fb7 100644 --- a/lib/class/democratic.class.php +++ b/lib/class/democratic.class.php @@ -343,7 +343,6 @@ class Democratic extends Tmp_Playlist { * already voted on any of these objects */ public function add_vote($items) { - /* Iterate through the objects if no vote, add to playlist and vote */ foreach ($items as $element) { $type = array_shift($element); @@ -417,8 +416,7 @@ class Democratic extends Tmp_Playlist { $db_results = Dba::write($sql); return true; - - } // add_vote + } /** * remove_vote diff --git a/lib/class/stream_playlist.class.php b/lib/class/stream_playlist.class.php index ae16dfb0..66b19297 100644 --- a/lib/class/stream_playlist.class.php +++ b/lib/class/stream_playlist.class.php @@ -376,13 +376,17 @@ class Stream_Playlist { /** * create_democratic * - * This 'votes' on the songs it inserts them into - * a tmp_playlist with user of -1 (System) + * This 'votes' on the songs; it inserts them into a tmp_playlist with user + * set to -1. */ public function create_democratic() { $democratic = Democratic::get_current_playlist(); $democratic->set_parent(); - $democratic->add_vote($this->urls); + + foreach ($this->urls as $url) { + $data = Stream_URL::parse($url->url); + $democratic->add_vote(array($data['type'], $data['id'])); + } } /** |