diff options
-rwxr-xr-x | docs/CHANGELOG | 4 | ||||
-rw-r--r-- | install.php | 6 | ||||
-rw-r--r-- | lib/class/localplay.class.php | 61 | ||||
-rw-r--r-- | lib/general.lib.php | 15 | ||||
-rw-r--r-- | localplay.php | 10 | ||||
-rw-r--r-- | modules/localplay/mpd.controller.php | 10 | ||||
-rw-r--r-- | templates/default.css | 1 | ||||
-rw-r--r-- | templates/show_localplay.inc.php | 21 | ||||
-rw-r--r-- | templates/show_localplay_control.inc.php | 18 | ||||
-rw-r--r-- | templates/show_localplay_status.inc.php | 39 |
10 files changed, 151 insertions, 34 deletions
diff --git a/docs/CHANGELOG b/docs/CHANGELOG index d3c58f6e..6fdfd26b 100755 --- a/docs/CHANGELOG +++ b/docs/CHANGELOG @@ -4,6 +4,10 @@ -------------------------------------------------------------------------- v.3.3.2 + - Added check for MySQL support to first install page, redirects + to /test.php if mysql support is non-existant + - Added ability to turn Random/Repeat on and off in localplay + and also improved localplay page a tiny bit. - Fixed a problem with pagination on the admin/users.php page - Added ability to turn on User/IP/Date Login history tracking viewable only by Administrators diff --git a/install.php b/install.php index 44c4d17d..031654e4 100644 --- a/install.php +++ b/install.php @@ -224,6 +224,12 @@ switch ($action) { break; default: + /* Do some basic tests here... most common error, no mysql */ + if (!function_exists('mysql_query')) { + header ("Location: test.php"); + } + + /* Show the language options first */ require_once('templates/show_install_lang.inc.php'); break; diff --git a/lib/class/localplay.class.php b/lib/class/localplay.class.php index 4d027579..488714ea 100644 --- a/lib/class/localplay.class.php +++ b/lib/class/localplay.class.php @@ -242,6 +242,43 @@ class Localplay { } // add + /** + * repeat + * This turns the repeat feature of a localplay method on or + * off, takes a 0/1 value + */ + function repeat($state) { + + $function = $this->_function_map['repeat']; + + $data = $this->_player->$function($state); + + if (!$data) { + debug_event('localplay',"Error Unable to set Repeat to $state",'1'); + } + + return $data; + + } // repeat + + /** + * random + * This turns on the random feature of a localplay method + * It takes a 0/1 value + */ + function random($state) { + + $function = $this->_function_map['random']; + + $data = $this->_player->$function($state); + + if (!$data) { + debug_event('localplay',"Error Unable to set Random to $state",'1'); + } + + return $data; + + } // random /** * status @@ -485,6 +522,30 @@ class Localplay { } // delete_all + /** + * get_user_state + * This function returns a user friendly version + * of the current player state + */ + function get_user_state($state) { + + switch ($state) { + case 'play': + return _('Now Playing'); + break; + case 'stop': + return _('Stopped'); + break; + case 'pause': + return _('Paused'); + break; + default: + return _('Unknown'); + break; + } // switch on state + + } // get_user_state + } //end localplay class ?> diff --git a/lib/general.lib.php b/lib/general.lib.php index 7fcb86e9..13951642 100644 --- a/lib/general.lib.php +++ b/lib/general.lib.php @@ -944,4 +944,19 @@ function print_boolean($value) { } // print_boolean +/** + * invert_boolean + * This returns the opposite of what you've got + */ +function invert_boolean($value) { + + if (make_bool($value)) { + return '0'; + } + else { + return '1'; + } + +} // invert_boolean + ?> diff --git a/localplay.php b/localplay.php index adf2c2c9..0f593946 100644 --- a/localplay.php +++ b/localplay.php @@ -60,6 +60,16 @@ switch ($action) { $body = ''; show_confirmation($title,$body,$url); break; + case 'repeat': + $localplay = init_localplay(); + $localplay->repeat(make_bool($_REQUEST['value'])); + require_once (conf('prefix') . '/templates/show_localplay.inc.php'); + break; + case 'random': + $localplay = init_localplay(); + $localplay->random(make_bool($_REQUEST['value'])); + require_once (conf('prefix') . '/templates/show_localplay.inc.php'); + break; default: require_once (conf('prefix') . '/templates/show_localplay.inc.php'); break; diff --git a/modules/localplay/mpd.controller.php b/modules/localplay/mpd.controller.php index 3c99e63f..b195744e 100644 --- a/modules/localplay/mpd.controller.php +++ b/modules/localplay/mpd.controller.php @@ -72,8 +72,8 @@ class AmpacheMpd { $map['pause'] = 'pause'; $map['volume_up'] = 'volume_up'; $map['volume_down'] = 'volume_down'; - $map['loop'] = 'loop'; $map['random'] = 'random'; + $map['repeat'] = 'loop'; /* Optional Functions */ $map['move'] = 'move'; @@ -268,10 +268,10 @@ class AmpacheMpd { * loop * This tells MPD to set the repeating the playlist (i.e. loop) to either on or off */ - function loop($onoff) { - - if (is_null($this->_mpd->SetRepeat($onoff))) { return false; } - return true; + function loop($state) { + + if (is_null($this->_mpd->SetRepeat($state))) { return false; } + return true; } // loop diff --git a/templates/default.css b/templates/default.css index 656a3cbf..bf7cce65 100644 --- a/templates/default.css +++ b/templates/default.css @@ -584,6 +584,7 @@ li.current-rating{ .np_row { padding-top: 3px; padding-bottom: 3px; + display: block; } .np_cell { display: inline; diff --git a/templates/show_localplay.inc.php b/templates/show_localplay.inc.php index 72fa4c51..0ad5938c 100644 --- a/templates/show_localplay.inc.php +++ b/templates/show_localplay.inc.php @@ -24,15 +24,22 @@ $web_path = conf('web_path'); $localplay = init_localplay(); $songs = $localplay->get(); ?> - <?php show_box_top(ucfirst($localplay->type) . ' ' . _('Localplay')); ?> -<ul class="text-action"> -<?php if ($localplay->has_function('delete_all')) { ?> - <li><a href="<?php echo $web_path; ?>/localplay.php?action=delete_all"><?php echo _('Clear Playlist'); ?></a></li> -<?php } ?> -</ul> -<?php require_once(conf('prefix') . '/templates/show_localplay_status.inc.php'); ?> +<table> +<tr> + <td valign="top"> + <strong><?php echo _('Actions'); ?>:</strong><br /> + <?php if ($localplay->has_function('delete_all')) { ?> + <a href="<?php echo $web_path; ?>/localplay.php?action=delete_all"><?php echo _('Clear Playlist'); ?></a> + <?php } ?> + </td><td> + <?php require_once(conf('prefix') . '/templates/show_localplay_status.inc.php'); ?> + </td> +</tr> +</table> <?php show_box_bottom(); ?> + + <?php show_box_top(_('Current Playlist')); ?> <table class="border" cellspacing="0" border="0"> <tr class="table-header"> diff --git a/templates/show_localplay_control.inc.php b/templates/show_localplay_control.inc.php index b9558ade..fa11c700 100644 --- a/templates/show_localplay_control.inc.php +++ b/templates/show_localplay_control.inc.php @@ -27,7 +27,7 @@ $required_info = "&user_id=" . $GLOBALS['user']->id . "&sessid=" . sess $ajax_url = $web_path . '/server/ajax.server.php'; ?> -<div class="localplaycontrol" style="display:table-cell;cursor:pointer;border:1px solid black;padding:2px;"> +<div class="localplaycontrol" style="display:table-cell;cursor:pointer;padding:2px;"> <?php if ($localplay->has_function('prev')) { ?> <span id="prev_button" onclick="ajaxPut('<?php echo $ajax_url; ?>?action=localplay&cmd=prev<?php echo $required_info; ?>','localplay_state');return true;"> <img src="<?php echo $web_path; ?>/images/localplay/prev.gif" alt="prev" /> @@ -49,20 +49,4 @@ $ajax_url = $web_path . '/server/ajax.server.php'; <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&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&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&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> diff --git a/templates/show_localplay_status.inc.php b/templates/show_localplay_status.inc.php index c4352323..28918a35 100644 --- a/templates/show_localplay_status.inc.php +++ b/templates/show_localplay_status.inc.php @@ -36,9 +36,38 @@ $track_name = $status['track_artist'] . ' - ' . $status['track_album'] . ' - ' . $track_name = ltrim(ltrim($track_name,' - ')); ?> -<?php echo _('State') .": ". ucfirst($status['state']); ?><br /> -<?php echo _('Repeat') . ":" . print_boolean($status['repeat']); ?> | -<?php echo _('Random') . ":" . print_boolean($status['random']); ?><br /> -<?php echo _('Volume') . ":" . $status['volume']; ?><br /> +<strong><?php echo $localplay->get_user_state($status['state']) ?></strong><br /> + <?php echo '[' . $status['track'] . '] - ' . $track_name . '<br />'; ?> +<div align="center"><?php require (conf('prefix') . '/templates/show_localplay_control.inc.php'); ?></div> +<div align="center"> + <?php if ($localplay->has_function('volume_up')) { ?> + <span id="up_button" onclick="ajaxPut('<?php echo $ajax_url; ?>?action=localplay&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&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&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 } ?> + <br /> + <?php echo _('Volume') . ":" . $status['volume']; ?> +</div> <br /> -<span class="header2"><?php echo _('Now Playing') . '</span><br />[' . $status['track'] . '] - ' . $track_name . '<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 _('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 } ?> |