diff options
-rw-r--r-- | lib/class/catalog.class.php | 3 | ||||
-rw-r--r-- | lib/class/localplay.class.php | 28 | ||||
-rw-r--r-- | localplay.php | 1 | ||||
-rw-r--r-- | modules/localplay/mpd.controller.php | 6 | ||||
-rw-r--r-- | server/localplay.ajax.php | 20 | ||||
-rw-r--r-- | templates/show_localplay_status.inc.php | 55 |
6 files changed, 49 insertions, 64 deletions
diff --git a/lib/class/catalog.class.php b/lib/class/catalog.class.php index cfab9321..79203977 100644 --- a/lib/class/catalog.class.php +++ b/lib/class/catalog.class.php @@ -1351,6 +1351,9 @@ class Catalog { /* Define the Arrays we will need */ $dead_files = array(); + // Added set time limit because this runs out of time for some people + set_time_limit(0); + require_once Config::get('prefix') . '/templates/show_clean_catalog.inc.php'; flush(); diff --git a/lib/class/localplay.class.php b/lib/class/localplay.class.php index 7b2ffbd6..02276b13 100644 --- a/lib/class/localplay.class.php +++ b/lib/class/localplay.class.php @@ -304,9 +304,7 @@ class Localplay { */ public function repeat($state) { - $function = $this->_function_map['repeat']; - - $data = $this->_player->$function($state); + $data = $this->_player->repeat($state); if (!$data) { debug_event('localplay',"Error Unable to set Repeat to $state",'1'); @@ -323,9 +321,7 @@ class Localplay { */ public function random($state) { - $function = $this->_function_map['random']; - - $data = $this->_player->$function($state); + $data = $this->_player->random($state); if (!$data) { debug_event('localplay',"Error Unable to set Random to $state",'1'); @@ -342,9 +338,7 @@ class Localplay { */ public function status() { - $function = $this->_function_map['status']; - - $data = $this->_player->$function(); + $data = $this->_player->status(); if (!count($data)) { debug_event('localplay','Error Unable to get status, check ' . $this->type . ' controller','1'); @@ -388,9 +382,7 @@ class Localplay { /* 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)) { + if (!$this->_player->volume($value)) { debug_event('localplay','Error: Unable to set volume, check ' . $this->type . ' controller','1'); return false; } @@ -406,9 +398,7 @@ class Localplay { */ public function volume_up() { - $function = $this->_function_map['volume_up']; - - if (!$this->_player->$function()) { + if (!$this->_player->volume_up()) { debug_event('localplay','Error: Unable to increase volume, check ' . $this->type . ' controller','1'); return false; } @@ -424,9 +414,7 @@ class Localplay { */ public function volume_down() { - $function = $this->_function_map['volume_down']; - - if (!$this->_player->$function()) { + if (!$this->_player->volume_down()) { debug_event('localplay','Error: Unable to decrese volume, check ' . $this->type . ' controller','1'); return false; } @@ -442,9 +430,7 @@ class Localplay { */ public function volume_mute() { - $function = $this->_function_map['volume_mute']; - - if (!$this->_player->$function()){ + if (!$this->_player->volume(0)){ debug_event('localplay','Error: Unable to mute volume, check ' . $this->type . ' controller','1'); return false; } diff --git a/localplay.php b/localplay.php index 2855d0c3..d2fc1217 100644 --- a/localplay.php +++ b/localplay.php @@ -61,6 +61,7 @@ switch ($_REQUEST['action']) { // Pull the current playlist and require the template $objects = $localplay->get(); + require_once Config::get('prefix') . '/templates/show_localplay_status.inc.php'; require_once Config::get('prefix') . '/templates/show_localplay_playlist.inc.php'; break; case 'delete_song': diff --git a/modules/localplay/mpd.controller.php b/modules/localplay/mpd.controller.php index 41374f9d..9a668219 100644 --- a/modules/localplay/mpd.controller.php +++ b/modules/localplay/mpd.controller.php @@ -402,15 +402,15 @@ class AmpacheMpd extends localplay_controller { } // volume /** - * loop + * repeat * This tells MPD to set the repeating the playlist (i.e. loop) to either on or off */ - function loop($state) { + function repeat($state) { if (is_null($this->_mpd->SetRepeat($state))) { return false; } return true; - } // loop + } // repeat /** diff --git a/server/localplay.ajax.php b/server/localplay.ajax.php index eb7923b1..cd3ed212 100644 --- a/server/localplay.ajax.php +++ b/server/localplay.ajax.php @@ -58,6 +58,9 @@ switch ($_REQUEST['action']) { case 'stop': case 'play': case 'pause': + case 'volume_up': + case 'volume_down': + case 'volume_mute': $command = scrub_in($_REQUEST['command']); $localplay->$command(); break; @@ -94,6 +97,23 @@ switch ($_REQUEST['action']) { $key = 'localplay_instance_' . $_REQUEST['instance']; $results[$key] = ''; break; + case 'repeat': + // Make sure that they have access to do this again no clue + + // Scrub her in + $localplay = new Localplay($GLOBALS['user']->prefs['localplay_controller']); + $localplay->connect(); + $localplay->repeat(make_bool($_REQUEST['value'])); + break; + case 'random': + // Make sure that they have access to do this again no clue... seems + // to be a pattern here + + // Scrub her in + $localplay = new Localplay($GLOBALS['user']->prefs['localplay_controller']); + $localplay->connect(); + $localplay->random(make_bool($_REQUEST['value'])); + break; default: $results['rfc3514'] = '0x1'; break; diff --git a/templates/show_localplay_status.inc.php b/templates/show_localplay_status.inc.php index 7a172a6d..058b6f98 100644 --- a/templates/show_localplay_status.inc.php +++ b/templates/show_localplay_status.inc.php @@ -1,13 +1,13 @@ <?php /* - Copyright (c) 2001 - 2006 Ampache.org + Copyright (c) 2001 - 2007 Ampache.org All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. + as published by the Free Software Foundation; version 2 + of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -19,47 +19,22 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -$web_path = conf('web_path'); -$localplay = init_localplay(); - -$required_info = "&user_id=" . $GLOBALS['user']->id . "&sessid=" . session_id(); -$ajax_url = $web_path . '/server/ajax.server.php'; -$status = $localplay->status(); - +$status = $localplay->status(); ?> -<span style="font-weight:bold;" id="lp_state"><?php echo $localplay->get_user_state($status['state']) ?></span><br /> - <span id="lp_playing"><?php echo $localplay->get_user_playing(); ?></span> -<div class="lp_box_ctrl"><?php require (conf('prefix') . '/templates/show_localplay_control.inc.php'); ?></div> -<div class="lp_box_vol"> - <?php if ($localplay->has_function('volume_up')) { ?> - <span class="up_button" onclick="ajaxPut('<?php echo $ajax_url; ?>?action=localplay&cmd=volume_up<?php echo $required_info; ?>','lp_v');return true;"> - <?php echo get_user_icon('volumeup'); ?> - </span> - <?php } ?> - <?php if ($localplay->has_function('volume_down')) { ?> - <span class="down_button" onclick="ajaxPut('<?php echo $ajax_url; ?>?action=localplay&cmd=volume_down<?php echo $required_info; ?>','lp_v');return true;"> - <?php echo get_user_icon('volumedn'); ?> - </span> - <?php } ?> - <?php if ($localplay->has_function('volume_mute')) { ?> - <span class="mute_button" onclick="ajaxPut('<?php echo $ajax_url; ?>?action=localplay&cmd=volume_mute<?php echo $required_info; ?>','lp_v');return true;"> - <?php echo get_user_icon('volumemute'); ?> - </span> - <?php } ?> +<?php show_box_top(_('Localplay Control')); ?> +<span id="lp_state"><?php echo $localplay->get_user_state($status['state']) ?></span><br /> +<div id="lp_box_vol"> + <?php echo Ajax::button('?page=localplay&action=command&command=volume_up','volumeup',_('Increase Volume'),'localplay_volume_up'); ?> + <?php echo Ajax::button('?page=localplay&action=command&command=volume_down','volumedn',_('Decrease Volume'),'localplay_volume_dn'); ?> + <?php echo Ajax::button('?page=localplay&action=command&command=volume_mute','volumemute',_('Mute'),'localplay_mute'); ?> <?php echo _('Volume'); ?>:<span id="lp_volume"><?php echo $status['volume']; ?></span> </div> <br /> -<?php if ($localplay->has_function('repeat')) { ?> <?php echo _('Repeat') . ":" . print_boolean($status['repeat']); ?> | - <a href="<?php echo $web_path; ?>/localplay.php?action=repeat&value=<?php echo invert_boolean($status['repeat']); ?>"> - <?php echo print_boolean(invert_boolean($status['repeat'])); ?> - </a><br /> - <?php } ?> -<?php if ($localplay->has_function('random')) { ?> + <?php echo Ajax::text('?page=localplay&action=repeat&value=' . invert_boolean($status['repeat']),print_boolean(invert_boolean($status['repeat'])),'localplay_repeat'); ?> + <br /> <?php echo _('Random') . ":" . print_boolean($status['random']); ?> | - <a href="<?php echo $web_path; ?>/localplay.php?action=random&value=<?php echo invert_boolean($status['random']); ?>"> - <?php echo print_boolean(invert_boolean($status['random'])); ?> - </a><br /> -<?php } ?> + <?php echo Ajax::text('?page=localplay&action=random&value=' . invert_boolean($status['random']),print_boolean(invert_boolean($status['random'])),'localplay_random'); ?> + <br /> +<?php show_box_bottom(); ?> |