summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/class/localplay.class.php79
-rw-r--r--modules/localplay/mpd.controller.php23
-rw-r--r--templates/show_localplay.inc.php7
-rw-r--r--templates/show_localplay_control.inc.php26
4 files changed, 129 insertions, 6 deletions
diff --git a/lib/class/localplay.class.php b/lib/class/localplay.class.php
index 11510f30..5f616114 100644
--- a/lib/class/localplay.class.php
+++ b/lib/class/localplay.class.php
@@ -281,6 +281,85 @@ class Localplay {
} // get
/**
+ * volume_set
+ * This isn't a required function, it sets the volume to a specified value
+ * as passed in the variable it is a 0 - 100 scale the controller is
+ * responsible for adjusting the scale if nessecary
+ */
+ function volume_set($value) {
+
+ /* Make sure it's int and 0 - 100 */
+ $value = int($value);
+
+ /* Make sure that it's between 0 and 100 */
+ if ($value > 100 OR $value < 0) { return false; }
+
+ $function = $this->_function_map['volume_set'];
+
+ if (!$this->_player->$function($value)) {
+ debug_event('localplay','Error: Unable to set volume, check ' . $this->type . ' controller','1');
+ return false;
+ }
+
+ return true;
+
+ } // volume_set
+
+ /**
+ * volume_up
+ * This function isn't required. It tells the daemon to increase the volume
+ * by a pre-defined amount controlled by the controller
+ */
+ function volume_up() {
+
+ $function = $this->_function_map['volume_up'];
+
+ if (!$this->_player->$function()) {
+ debug_event('localplay','Error: Unable to increase volume, check ' . $this->type . ' controller','1');
+ return false;
+ }
+
+ return true;
+
+ } // volume_up
+
+ /**
+ * volume_down
+ * This function isn't required. It tells the daemon to decrese the volume
+ * by a pre-defined amount controlled by the controller.
+ */
+ function volume_down() {
+
+ $function = $this->_function_map['volume_down'];
+
+ if (!$this->_player->$function()) {
+ debug_event('localplay','Error: Unable to decrese volume, check ' . $this->type . ' controller','1');
+ return false;
+ }
+
+ return true;
+
+ } // volume_down
+
+ /**
+ * volume_mute
+ * This function isn't required, It tells the daemon to mute all output
+ * It's up to the controller to decide what that actually entails
+ */
+ function volume_mute() {
+
+ $function = $this->_function_map['volume_mute'];
+
+ if (!$this->_player->$function()){
+ debug_event('localplay','Error: Unable to mute volume, check ' . $this->type . ' controller','1');
+ return false;
+ }
+
+ return true;
+
+ } // volume_mute
+
+ /**
* skip
* This isn't a required function, it tells the daemon to skip to the specified song
*/
diff --git a/modules/localplay/mpd.controller.php b/modules/localplay/mpd.controller.php
index 81bf3adf..189e9b74 100644
--- a/modules/localplay/mpd.controller.php
+++ b/modules/localplay/mpd.controller.php
@@ -70,7 +70,8 @@ class AmpacheMpd {
$map['next'] = 'next';
$map['prev'] = 'prev';
$map['pause'] = 'pause';
- $map['volume'] = 'volume';
+ $map['volume_up'] = 'volume_up';
+ $map['volume_down'] = 'volume_down';
$map['loop'] = 'loop';
$map['random'] = 'random';
@@ -199,6 +200,26 @@ class AmpacheMpd {
} // skip
/**
+ * This tells MPD to increase the volume by 5
+ */
+ function volume_up() {
+
+ if (is_null($this->_mpd->AdjustVolume('5'))) { return false; }
+ return true;
+
+ } // volume_up
+
+ /**
+ * This tells MPD to decrese the volume by 5
+ */
+ function volume_down() {
+
+ if (is_null($this->_mpd->AdjustVolume('-5'))) { return false; }
+ return true;
+
+ } // volume_down
+
+ /**
* next
* This just tells MPD to skip to the next song
*/
diff --git a/templates/show_localplay.inc.php b/templates/show_localplay.inc.php
index 9329a114..aa124503 100644
--- a/templates/show_localplay.inc.php
+++ b/templates/show_localplay.inc.php
@@ -35,6 +35,13 @@ $songs = $localplay->get();
</div>
<br />
<div class="text-box">
+<h2>Debug Status Information (Temp!)</h2>
+<pre>
+<?php print_r($localplay->status()); ?>
+</pre>
+</div>
+<br />
+<div class="text-box">
<table class="border" cellspacing="0" border="0">
<tr class="table-header">
<th><?php echo _('Track'); ?></th>
diff --git a/templates/show_localplay_control.inc.php b/templates/show_localplay_control.inc.php
index 47aebac1..2c8d74b5 100644
--- a/templates/show_localplay_control.inc.php
+++ b/templates/show_localplay_control.inc.php
@@ -29,24 +29,40 @@ $ajax_url = $web_path . '/server/ajax.server.php';
?>
<div class="localplaycontrol" style="display:table-cell;cursor:pointer;border:1px solid black;padding:2px;">
<?php if ($localplay->has_function('prev')) { ?>
-<span id="prev_button" onclick="ajaxPut('<?php echo $ajax_url; ?>','action=localplay&amp;cmd=prev<?php echo $required_info; ?>','localplay_state');return true;">
+<span id="prev_button" onclick="ajaxPut('<?php echo $ajax_url; ?>?action=localplay&amp;cmd=prev<?php echo $required_info; ?>','localplay_state');return true;">
<img src="<?php echo $web_path; ?>/images/localplay/prev.gif" alt="prev" />
</span>
<?php } ?>
-<span id="stop_button" onclick="ajaxPut('<?php echo $ajax_url; ?>','action=localplay&amp;cmd=stop<?php echo $required_info; ?>','localplay_state');return true;">
+<span id="stop_button" onclick="ajaxPut('<?php echo $ajax_url; ?>?action=localplay&amp;cmd=stop<?php echo $required_info; ?>','localplay_state');return true;">
<img src="<?php echo $web_path; ?>/images/localplay/stop.gif" alt="stop" />
</span>
<?php if ($localplay->has_function('pause')) { ?>
-<span id="pause_button" onclick="ajaxPut('<?php echo $ajax_url; ?>','action=localplay&amp;cmd=pause<?php echo $requird_info; ?>','localplay_state');return true;">
+<span id="pause_button" onclick="ajaxPut('<?php echo $ajax_url; ?>?action=localplay&amp;cmd=pause<?php echo $requird_info; ?>','localplay_state');return true;">
<img src="<?php echo $web_path; ?>/images/localplay/pause.gif" alt="pause" />
</span>
<?php } ?>
-<span id="play_button" onclick="ajaxPut('<?php echo $ajax_url; ?>','action=localplay&amp;cmd=play<?php echo $required_info; ?>','localplay_state');return true;">
+<span id="play_button" onclick="ajaxPut('<?php echo $ajax_url; ?>?action=localplay&amp;cmd=play<?php echo $required_info; ?>','localplay_state');return true;">
<img src="<?php echo $web_path; ?>/images/localplay/play.gif" alt="play" />
</span>
<?php if ($localplay->has_function('next')) { ?>
-<span id="next_button" onclick="ajaxPut('<?php echo $ajax_url; ?>','action=localplay&amp;cmd=next<?php echo $required_info; ?>','localplay_state');return true;">
+<span id="next_button" onclick="ajaxPut('<?php echo $ajax_url; ?>?action=localplay&amp;cmd=next<?php echo $required_info; ?>','localplay_state');return true;">
<img src="<?php echo $web_path; ?>/images/localplay/next.gif" alt="next" />
</span>
<?php } ?>
+<br />
+<?php if ($localplay->has_function('volume_up')) { ?>
+<span id="up_button" onclick="ajaxPut('<?php echo $ajax_url; ?>?action=localplay&amp;cmd=volume_up<?php echo $required_info; ?>','localplay_state');return true;">
+ <img src="<?php echo $web_path; ?>/images/localplay/volup.gif" alt="volume up" />
+</span>
+<?php } ?>
+<?php if ($localplay->has_function('volume_down')) { ?>
+<span id="down_button" onclick="ajaxPut('<?php echo $ajax_url; ?>?action=localplay&amp;cmd=volume_down<?php echo $required_info; ?>','localplay_state');return true;">
+ <img src="<?php echo $web_path; ?>/images/localplay/voldn.gif" alt="volume down" />
+</span>
+<?php } ?>
+<?php if ($localplay->has_function('volume_mute')) { ?>
+<span id="mute_button" onclick="ajaxPut('<?php echo $ajax_url; ?>?action=localplay&amp;cmd=volume_mute<?php echo $required_info; ?>','localplay_state');return true;">
+ <img src="<?php echo $web_path; ?>/images/localplay/volmute.gif" alt="volume mute" />
+</span>
+<?php } ?>
</div>