summaryrefslogtreecommitdiffstats
path: root/modules/localplay/mpd.controller.php
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-04-08 05:58:05 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-04-08 05:58:05 +0000
commit2b55e30467f5ccdf9324b0377c419c5681f4c215 (patch)
tree16c2f63178ff762a673face6abb7fe584b680b36 /modules/localplay/mpd.controller.php
parent941afedab85ffd77a83188ca09a888e0603fae72 (diff)
downloadampache-2b55e30467f5ccdf9324b0377c419c5681f4c215.tar.gz
ampache-2b55e30467f5ccdf9324b0377c419c5681f4c215.tar.bz2
ampache-2b55e30467f5ccdf9324b0377c419c5681f4c215.zip
This update includes a full rewrite of the Localplay code, only update
to this version if you don't care about losing a lot of functionality while I am still finishing it up. Also the only working localplay method is currently MPD. UPDATE AT YOUR OWN RISK!
Diffstat (limited to 'modules/localplay/mpd.controller.php')
-rw-r--r--modules/localplay/mpd.controller.php61
1 files changed, 55 insertions, 6 deletions
diff --git a/modules/localplay/mpd.controller.php b/modules/localplay/mpd.controller.php
index 160e3e6e..f05447d0 100644
--- a/modules/localplay/mpd.controller.php
+++ b/modules/localplay/mpd.controller.php
@@ -56,12 +56,19 @@ class AmpacheMpd {
$map = array();
+ /* Required Functions */
$map['add'] = 'add_songs';
$map['delete'] = 'delete_songs';
$map['play'] = 'play';
$map['stop'] = 'stop';
$map['get'] = 'get_songs';
+ $map['status'] = 'get_status';
$map['connect'] = 'connect';
+
+ /* Optional Functions */
+ $map['next'] = 'next';
+ $map['prev'] = 'prev';
+ $map['pause'] = 'pause';
return $map;
@@ -79,9 +86,9 @@ class AmpacheMpd {
$preferences = array();
- $preferences[] = array('name'=>'hostname','default'=>'localhost','type'=>'string');
- $preferences[] = array('name'=>'port','default'=>'6600','type'=>'integer');
- $preferences[] = array('name'=>'password','default'=>'','type'=>'string');
+ $preferences[] = array('name'=>'hostname','default'=>'localhost','type'=>'string','description'=>'MPD Hostname');
+ $preferences[] = array('name'=>'port','default'=>'6600','type'=>'integer','description'=>'MPD Port');
+ $preferences[] = array('name'=>'password','default'=>'','type'=>'string','description'=>'MPD Password');
return $preferences;
@@ -164,6 +171,42 @@ class AmpacheMpd {
/**
+ * next
+ * This just tells MPD to skip to the next song
+ */
+ function next() {
+
+ if (is_null($this->_mpd->Next())) { return false; }
+
+ return true;
+
+ } // next
+
+ /**
+ * prev
+ * This just tells MPD to skip to the prev song
+ */
+ function prev() {
+
+ if (is_null($this->_mpd->Previous())) { return false; }
+
+ return true;
+
+ } // prev
+
+ /**
+ * pause
+ * This tells MPD to pause the current song
+ */
+ function pause() {
+
+ if (is_null($this->_mpd->Pause())) { return false; }
+
+ return true;
+
+ } // pause
+
+ /**
* get_songs
* This functions returns an array containing information about
* The songs that MPD currently has in it's playlist. This must be
@@ -174,8 +217,7 @@ class AmpacheMpd {
/* Get the Current Playlist */
$playlist = $this->_mpd->playlist;
- foreach ($playlist as $key=>$entry) {
-
+ foreach ($playlist as $entry) {
$data = array();
/* Required Elements */
@@ -189,6 +231,8 @@ class AmpacheMpd {
} // foreach playlist items
+ return $results;
+
} // get_songs
/**
@@ -198,8 +242,13 @@ class AmpacheMpd {
*/
function get_status() {
+ /* Construct the Array */
+ $array['state'] = $this->_mpd->state;
+ $array['volume'] = $this->_mpd->volume;
+ $array['repeat'] = $this->_mpd->repeat;
+ $array['random'] = $this->_mpd->random;
-
+ return $array;
} // get_status