summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-01-14 03:00:05 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-01-14 03:00:05 +0000
commitc19f5121801b2d0d8d922ccb68bfca8162d0df9c (patch)
tree8e940a3ec6af1dea5531d1e21f5a69a1a091ac7c /modules
parent29420520e96437e6738744d96049b6f2a025e623 (diff)
downloadampache-c19f5121801b2d0d8d922ccb68bfca8162d0df9c.tar.gz
ampache-c19f5121801b2d0d8d922ccb68bfca8162d0df9c.tar.bz2
ampache-c19f5121801b2d0d8d922ccb68bfca8162d0df9c.zip
* Added new functions to HttpQ controller
* Fixed Catalog cleaning issues and album art issues * Fixed a minor javascript error with the localplay stuff * Started work on write_playlists.php.inc (https://ampache.bountysource.com/task/show/542)
Diffstat (limited to 'modules')
-rw-r--r--modules/httpq/httpqplayer.class.php110
-rw-r--r--modules/localplay/httpq.controller.php54
2 files changed, 122 insertions, 42 deletions
diff --git a/modules/httpq/httpqplayer.class.php b/modules/httpq/httpqplayer.class.php
index 82685a51..094626bc 100644
--- a/modules/httpq/httpqplayer.class.php
+++ b/modules/httpq/httpqplayer.class.php
@@ -97,23 +97,50 @@ class HttpQPlayer {
} // clear
- /*!
- @function next
- @discussion go to next song
+ /**
+ * next
+ * go to next song
*/
function next() {
+
$args = array();
- $this->sendCommand("next", $args);
- }
+ $results = $this->sendCommand("next", $args);
+
+ if ($results == '0') { return null; }
- /*!
- @function prev
- @discussion go to previous song
+ return true;
+
+ } // next
+
+ /**
+ * prev
+ * go to previous song
*/
function prev() {
+
$args = array();
- $this->sendCommand("prev", $args);
- }
+ $results = $this->sendCommand("prev", $args);
+
+ if ($results == '0') { return null; }
+
+ return true;
+
+ } // prev
+
+ /**
+ * skip
+ * This skips to POS in the playlist
+ */
+ function skip($pos) {
+
+ $args = array('index'=>$pos);
+ $results = $this->sendCommand('sendplaylistpos',$args);
+
+ if ($results == '0') { return null; }
+
+ return true;
+
+ } // skip
/**
* play
@@ -241,6 +268,69 @@ class HttpQPlayer {
} // get_volume
+ /**
+ * volume_up
+ * This increases the volume by Wimamp's defined amount
+ */
+ function volume_up() {
+
+ $args = array();
+ $results = $this->sendCommand('volumeup',$args);
+
+ if ($results == '0') { return null; }
+
+ return true;
+
+ } // volume_up
+
+ /**
+ * volume_down
+ * This decreases the volume by Winamp's defined amount
+ */
+ function volume_down() {
+
+ $args = array();
+ $results = $this->sendCommand('volumedown',$args);
+
+ if ($results == '0') { return null; }
+
+ return true;
+
+ } // volume_down
+
+ /**
+ * set_volume
+ * This sets the volume as best it can, we go from a resolution
+ * of 100 --> 255 so it's a little fuzzy
+ */
+ function set_volume($value) {
+
+ // Convert it to base 255
+ $value = $value*2.55;
+ $args = array('level'=>$value);
+ $results = $this->sendCommand('setvolume',$args);
+
+ if ($results == '0') { return null; }
+
+ return true;
+
+ } // set_volume
+
+ /**
+ * clear_playlist
+ * this flushes the playlist cache (I hope this means clear)
+ */
+ function clear_playlist() {
+
+ $args = array();
+ $results = $this->sendcommand('flushplaylist',$args);
+
+ if ($results == '0') { return null; }
+
+ return true;
+
+ } // clear_playlist
+
/**
* get_repeat
* This returns the current state of the repeat
diff --git a/modules/localplay/httpq.controller.php b/modules/localplay/httpq.controller.php
index a3f69665..9c391bc6 100644
--- a/modules/localplay/httpq.controller.php
+++ b/modules/localplay/httpq.controller.php
@@ -65,18 +65,17 @@ class AmpacheHttpq {
$map['connect'] = 'connect';
/* Recommended Functions */
- //$map['skip'] = 'skip';
- //$map['next'] = 'next';
- //$map['prev'] = 'prev';
+ $map['skip'] = 'skip';
+ $map['next'] = 'next';
+ $map['prev'] = 'prev';
$map['pause'] = 'pause';
- //$map['volume_up'] = 'volume_up';
- //$map['volume_down'] = 'volume_down';
+ $map['volume_up'] = 'volume_up';
+ $map['volume_down'] = 'volume_down';
$map['random'] = 'random';
$map['repeat'] = 'loop';
/* Optional Functions */
- //$map['move'] = 'move';
- //$map['delete_all'] = 'clear_playlist';
+ $map['delete_all'] = 'clear_playlist';
$map['add_url'] = 'add_url';
return $map;
@@ -205,31 +204,31 @@ class AmpacheHttpq {
/**
* skip
- * This tells MPD to skip to the specified song
+ * This tells HttpQ to skip to the specified song
*/
function skip($song) {
- if (is_null($this->_mpd->SkipTo($song))) { return false; }
+ if (is_null($this->_httpq->skip($song))) { return false; }
return true;
} // skip
/**
- * This tells MPD to increase the volume by 5
+ * This tells Httpq to increase the volume by WinAmps default amount
*/
function volume_up() {
- if (is_null($this->_mpd->AdjustVolume('5'))) { return false; }
+ if (is_null($this->_httpq->volume_up())) { return false; }
return true;
} // volume_up
/**
- * This tells MPD to decrese the volume by 5
+ * This tells HttpQ to decrease the volume by Winamps default amount
*/
function volume_down() {
- if (is_null($this->_mpd->AdjustVolume('-5'))) { return false; }
+ if (is_null($this->_httpq->volume_down())) { return false; }
return true;
} // volume_down
@@ -240,7 +239,8 @@ class AmpacheHttpq {
*/
function next() {
- if (is_null($this->_mpd->Next())) { return false; }
+ if (is_null($this->_httpq->next())) { return false; }
+
return true;
} // next
@@ -251,7 +251,8 @@ class AmpacheHttpq {
*/
function prev() {
- if (is_null($this->_mpd->Previous())) { return false; }
+ if (is_null($this->_httpq->prev())) { return false; }
+
return true;
} // prev
@@ -269,18 +270,19 @@ class AmpacheHttpq {
/**
* volume
- * This tells MPD to set the volume to the parameter
+ * This tells HttpQ to set the volume to the specified amount this
+ * is 0-100
*/
function volume($volume) {
- if (is_null($this->_mpd->SetVolume($volume))) { return false; }
+ if (is_null($this->_httpq->set_volume($volume))) { return false; }
return true;
} // volume
/**
* loop
- * This tells MPD to set the repeating the playlist (i.e. loop) to either on or off
+ * This tells HttpQ to set the repeating the playlist (i.e. loop) to either on or off
*/
function loop($state) {
@@ -289,10 +291,9 @@ class AmpacheHttpq {
} // loop
-
/**
* random
- * This tells MPD to turn on or off the playing of songs from the playlist in random order
+ * This tells HttpQ to turn on or off the playing of songs from the playlist in random order
*/
function random($onoff) {
@@ -301,21 +302,10 @@ class AmpacheHttpq {
} // random
- /**
- * move
- * This tells MPD to move song from SrcPos to DestPos
- */
- function move($SrcPos, $DestPos) {
-
- if (is_null($this->_mpd->PLMoveTrack($SrcPos, $DestPos))) { return false; }
-
- return true;
- } // move
-
/**
* get_songs
* This functions returns an array containing information about
- * The songs that MPD currently has in it's playlist. This must be
+ * The songs that HttpQ currently has in it's playlist. This must be
* done in a standardized fashion
*/
function get_songs() {