summaryrefslogtreecommitdiffstats
path: root/lib/class
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-11-12 07:36:52 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-11-12 07:36:52 +0000
commitf435ca753c1d6ce8f657c3374ae71daec6daf2be (patch)
tree47fcefdbfb3b3ffd71c8bc27b35af0255df62e83 /lib/class
parent7b303176665062673f07f451ddbf571f8a2c3c80 (diff)
downloadampache-f435ca753c1d6ce8f657c3374ae71daec6daf2be.tar.gz
ampache-f435ca753c1d6ce8f657c3374ae71daec6daf2be.tar.bz2
ampache-f435ca753c1d6ce8f657c3374ae71daec6daf2be.zip
more democratic play work, still not working going to need db change to make it work how I want, will do later
Diffstat (limited to 'lib/class')
-rw-r--r--lib/class/democratic.class.php27
-rw-r--r--lib/class/playlist.class.php4
2 files changed, 16 insertions, 15 deletions
diff --git a/lib/class/democratic.class.php b/lib/class/democratic.class.php
index f1955aed..276a74e1 100644
--- a/lib/class/democratic.class.php
+++ b/lib/class/democratic.class.php
@@ -22,20 +22,9 @@
/**
* Democratic
* This class handles democratic play, which is a fancy
- * name for voting based playback. This uses the tmp playlist
- * heavily
+ * name for voting based playback. This extends the tmpplaylist
*/
-class Democratic {
-
- /**
- * Constructor
- * This doesn't do anything currently
- */
- public function __construct() {
-
- return true;
-
- } // Constructor
+class Democratic extends tmpPlaylist {
/**
* get_playlists
@@ -44,7 +33,19 @@ class Democratic {
*/
public static function get_playlists() {
+ // Pull all tmp playlsits with a session of < 0 (as those are fake)
+ // This is kind of hackish, should really think about tweaking the db
+ // and doing this right.
+ $sql = "SELECT `id` FROM `tmp_playlist` WHERE `session`< '0'";
+ $db_results = Dba::query($sql);
+
+ $results = array();
+
+ while ($row = Dba::fetch_assoc($db_results)) {
+ $results[] = $row['id'];
+ }
+ return $results;
} // get_playlists
diff --git a/lib/class/playlist.class.php b/lib/class/playlist.class.php
index b36cf268..f186785f 100644
--- a/lib/class/playlist.class.php
+++ b/lib/class/playlist.class.php
@@ -220,7 +220,7 @@ class Playlist {
* This simply returns a int of how many song elements exist in this playlist
* For now let's consider a dyn_song a single entry
*/
- function get_song_count() {
+ public function get_song_count() {
$sql = "SELECT COUNT(`id`) FROM `playlist_data` WHERE `playlist`='" . Dba::escape($this->id) . "'";
$db_results = Dba::query($sql);
@@ -427,7 +427,7 @@ class Playlist {
* and numbers them in a liner fashion, not allowing for
* the same track # twice, this is an optional funcition
*/
- function normalize_tracks() {
+ public function normalize_tracks() {
/* First get all of the songs in order of their tracks */
$sql = "SELECT `id` FROM `playlist_data` WHERE `playlist`='" . Dba::escape($this->id) . "' ORDER BY `track` ASC";