summaryrefslogtreecommitdiffstats
path: root/lib/class
diff options
context:
space:
mode:
authorPaul Arthur <paul.arthur@flowerysong.com>2013-02-07 14:35:03 -0500
committerPaul Arthur <paul.arthur@flowerysong.com>2013-02-07 14:35:03 -0500
commit46cb6c81c584b9776aec14c434b3fa4720a87c5e (patch)
tree36604cd4da0e172105e09f5b472079e17a4bc540 /lib/class
parent239ea81fdf2fa2bda8a8556e19412264396fe52a (diff)
downloadampache-46cb6c81c584b9776aec14c434b3fa4720a87c5e.tar.gz
ampache-46cb6c81c584b9776aec14c434b3fa4720a87c5e.tar.bz2
ampache-46cb6c81c584b9776aec14c434b3fa4720a87c5e.zip
FS#272 - Adding songs to democratic playlist
This might fix democratic handling. Untested.
Diffstat (limited to 'lib/class')
-rw-r--r--lib/class/democratic.class.php4
-rw-r--r--lib/class/stream_playlist.class.php10
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']));
+ }
}
/**