summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-04-09 07:55:50 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-04-09 07:55:50 +0000
commit5aeac3b17e31d0cc88321a614469c4f3f1a9c0dc (patch)
treeff7ceb1767ce45ab9dc9e5e192ed36bc69e3db90 /lib
parent79a890b7bf7bd9b31e6879c64d5651cef02975f3 (diff)
downloadampache-5aeac3b17e31d0cc88321a614469c4f3f1a9c0dc.tar.gz
ampache-5aeac3b17e31d0cc88321a614469c4f3f1a9c0dc.tar.bz2
ampache-5aeac3b17e31d0cc88321a614469c4f3f1a9c0dc.zip
added an ugly localplay view page, and made it so you can remove songs from your mpd playlist... its ugly.. I know.. ooh yea you can also deactivate modules now
Diffstat (limited to 'lib')
-rw-r--r--lib/class/localplay.class.php15
-rw-r--r--lib/localplay.lib.php30
2 files changed, 43 insertions, 2 deletions
diff --git a/lib/class/localplay.class.php b/lib/class/localplay.class.php
index 232e9158..1cc9eccb 100644
--- a/lib/class/localplay.class.php
+++ b/lib/class/localplay.class.php
@@ -137,6 +137,7 @@ class Localplay {
$this->_function_map['volume_set'] = $data['volume_set'];
$this->_function_map['volume_up'] = $data['volume_up'];
$this->_function_map['volume_down'] = $data['volume_down'];
+ $this->_function_map['delete_all'] = $data['delete_all'];
} // _map_functions
@@ -241,6 +242,8 @@ class Localplay {
* get
* This calls the get function of the player and then returns
* the array of current songs for display or whatever
+ * Null is returned on failure here because the PHP count()
+ * function will return 1 on a value of 'false'
*/
function get() {
@@ -248,9 +251,9 @@ class Localplay {
$data = $this->_player->$function();
- if (!count($data)) {
+ if (!count($data) OR !is_array($data)) {
debug_event('localplay','Error Unable to get song info, check ' . $this->type . ' controller','1');
- return false;
+ return NULL;
}
return $data;
@@ -312,7 +315,15 @@ class Localplay {
*/
function delete($songs) {
+ $function = $this->_function_map['delete'];
+
+ if (!$this->_player->$function($songs)) {
+ debug_event('localplay','Error: Unable to remove songs, check ' . $this->type . ' controller','1');
+ return false;
+ }
+
+ return true;
} // delete
diff --git a/lib/localplay.lib.php b/lib/localplay.lib.php
index c4a0976a..2aa42772 100644
--- a/lib/localplay.lib.php
+++ b/lib/localplay.lib.php
@@ -100,8 +100,38 @@ function insert_localplay_preferences($type) {
*/
function remove_localplay_preferences($type=0) {
+ /* If we've gotten a type wipe and go! */
+ if ($type) {
+ $sql = "DELETE FROM preferences WHERE name LIKE 'localplay_" . sql_escape($type) . "_%'";
+ $db_results = mysql_query($sql, dbh());
+ return true;
+ }
+
+
+ /* Select everything but our two built-in ones
+ $sql = "SELECT * FROM preferences WHERE name != 'localplay_level' AND name != 'localplay_controller' AND name LIKE 'localplay_%'";
+ $db_results = mysql_query($sql, dbh());
+
+ $results = array();
+ /* We need to organize by module to make it easy
+ * to figure out which modules no longer exist
+ * and wack the preferences... unless we've
+ * specified a name then just wack those
+ * preferences
+ */
+ while ($r = mysql_fetch_assoc($db_results)) {
+
+ $name = $r['name'];
+ preg_match("/localplay_([\w\d\-\]+)_.+/",$name,$matches);
+ $key = $matches['1'];
+
+ $results[$key] = $r;
+
+ } // end while
+ /* If we've got a type */
+ //FIXME!!!
} // remove_localplay_preferences