summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2005-06-10 04:47:24 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2005-06-10 04:47:24 +0000
commit5d09d233c7efea368f8b04f915d51bd9a7ebc538 (patch)
tree258fde746cec1084b073176aa7e4d86c6685b406
parentab8c8b63c65f3c3aa01b7ae64900d764718ff986 (diff)
downloadampache-5d09d233c7efea368f8b04f915d51bd9a7ebc538.tar.gz
ampache-5d09d233c7efea368f8b04f915d51bd9a7ebc538.tar.bz2
ampache-5d09d233c7efea368f8b04f915d51bd9a7ebc538.zip
localplay_menu patch from nedko
-rw-r--r--amp-mpd.php37
-rw-r--r--config/ampache.cfg.php.dist8
-rwxr-xr-xdocs/CHANGELOG3
-rw-r--r--index.php2
-rw-r--r--templates/menu.inc10
5 files changed, 42 insertions, 18 deletions
diff --git a/amp-mpd.php b/amp-mpd.php
index 1fb4743e..615b9124 100644
--- a/amp-mpd.php
+++ b/amp-mpd.php
@@ -24,6 +24,15 @@
require_once("modules/init.php");
+function mpd_redirect() {
+ if (conf('localplay_menu')) {
+ header ("Location: " . conf('web_path') . "/mpd.php");
+ }
+ else {
+ header ("Location: " . conf('web_path'));
+ }
+}
+
// Connect to the MPD
if (!class_exists('mpd')) { require_once(conf('prefix') . "/modules/mpd/mpd.class.php"); }
if (!is_object($myMpd)) { $myMpd = new mpd(conf('mpd_host'),conf('mpd_port')); }
@@ -43,76 +52,76 @@ else {
case "rem":
if (!$user->has_access(25)) { break; }
if ( is_null($myMpd->PLRemove($_REQUEST[id])) ) echo "ERROR: " .$myMpd->errStr."\n";
- header ("Location: " . conf('web_path'));
+ mpd_redirect();
break;
case ' > ':
case "play":
if (!$user->has_access(25)) { break; }
if ( is_null($myMpd->Play()) ) echo "ERROR: " .$myMpd->errStr."\n";
- header ("Location: " . conf('web_path'));
+ mpd_redirect();
break;
case "stop":
case ' X ':
if (!$user->has_access(25)) { break; }
if ( is_null($myMpd->Stop()) ) echo "ERROR: " .$myMpd->errStr."\n";
- header ("Location: " . conf('web_path'));
+ mpd_redirect();
break;
case ' = ':
case "pause":
if (!$user->has_access(25)) { break; }
if ( is_null($myMpd->Pause()) ) echo "ERROR: " .$myMpd->errStr."\n";
- header ("Location: " . conf('web_path'));
+ mpd_redirect();
break;
case '|< ':
case "Prev":
if (!$user->has_access(25)) { break; }
if ( is_null($myMpd->Previous()) ) echo "ERROR: " . $myMpd->errStr."\n";
- header ("Location: " . conf('web_path'));
+ mpd_redirect();
break;
case ' >|';
case "Next":
if (!$user->has_access(25)) { break; }
if ( is_null($myMpd->Next()) ) echo "ERROR: " . $myMpd->errStr."\n";
- header ("Location: " . conf('web_path'));
+ mpd_redirect();
break;
case "shuffle":
if (!$user->has_access(25)) { break; }
if ( is_null($myMpd->PLShuffle()) ) echo "ERROR: " .$myMpd->errStr."\n";
- header ("Location: " . conf('web_path'));
+ mpd_redirect();
break;
case "clear":
if (!$user->has_access(25)) { break; }
if ( is_null($myMpd->PLClear()) ) echo "ERROR: " .$myMpd->errStr."\n";
- header ("Location: " . conf('web_path'));
+ mpd_redirect();
break;
case "loop":
if (!$user->has_access(25)) { break; }
if ($_REQUEST['val'] == "On") { $_REQUEST['val'] = '1'; }
else { $_REQUEST['val'] = '0'; }
if ( is_null($myMpd->SetRepeat($_REQUEST['val'])) ) echo "ERROR: " .$myMpd->errStr."\n";
- header ("Location: " . conf('web_path'));
+ mpd_redirect();
break;
case "random":
if (!$user->has_access(25)) { break; }
if ($_REQUEST['val'] == "On") { $_REQUEST['val'] = '1'; }
else { $_REQUEST['val'] = '0'; }
if ( is_null($myMpd->SetRandom($_REQUEST['val']))) echo "ERROR: " .$myMpd->errStr."\n";
- header ("Location: " . conf('web_path'));
+ mpd_redirect();
break;
case "adjvol":
if (!$user->has_access(25)) { break; }
if ( is_null($myMpd->AdjustVolume($_REQUEST[val])) ) echo "ERROR: " .$myMpd->errStr."\n";
- header ("Location: " . conf('web_path'));
+ mpd_redirect();
break;
case "setvol":
if (!$user->has_access(25)) { break; }
if ( is_null($myMpd->SetVolume($_REQUEST[val])) ) echo "ERROR: " .$myMpd->errStr."\n";
- header ("Location: " . conf('web_path'));
+ mpd_redirect();
break;
case "skipto":
if (!$user->has_access(25)) { break; }
if ( is_null($myMpd->SkipTo($_REQUEST[val])) ) echo "ERROR: " .$myMpd->errStr."\n";
- header ("Location: " . conf('web_path'));
+ mpd_redirect();
break;
case "pladd":
if (!$user->has_access(25)) { break; }
@@ -130,7 +139,7 @@ else {
require (conf('prefix') . "/templates/show_mpdplay.inc");
break;
default:
- header ("Location: " . conf('web_path'));
+ mpd_redirect();
break;
} // end switch
diff --git a/config/ampache.cfg.php.dist b/config/ampache.cfg.php.dist
index 74ed1583..bf727079 100644
--- a/config/ampache.cfg.php.dist
+++ b/config/ampache.cfg.php.dist
@@ -458,4 +458,12 @@ rss_song_description = <![CDATA[$song->f_title @ $album played by $user->fullna
#mpd_method = "file"
+# If set to true MPD is not displayed on the main page, but on it's
+# own distinct page. This is called localplay, because eventually
+# it will control all "LOCAL" style play methods including localplay
+# and the slimserver
+# DEFAULT: false
+#localplay_menu = true
+
+
#####################################################
diff --git a/docs/CHANGELOG b/docs/CHANGELOG
index 99641656..04f7e080 100755
--- a/docs/CHANGELOG
+++ b/docs/CHANGELOG
@@ -9,6 +9,9 @@
- Fixed refresh javascript for main page.
- Fixed <html lang=> tag so that it validates (Thx XGizzmo)
- Added show_footer_menu() funciton and preference (Thx XGizzmo)
+ - Added localplay_menu config option that puts MPD on it's own
+ page, will eventually control icecast,localplay,slimserver
+ as well (Thx Nedko)
--------------------------------------------------------------------------
diff --git a/index.php b/index.php
index f2c2966a..4b4c7e46 100644
--- a/index.php
+++ b/index.php
@@ -119,7 +119,7 @@ if (conf('refresh_limit') > 0) { show_template('javascript_refresh'); }
if($user->prefs['play_type'] == 'local_play') {
show_local_control();
echo "<br />";
- } elseif ($user->prefs['play_type'] == 'mpd') {
+ } elseif ($user->prefs['play_type'] == 'mpd' && !conf('localplay_menu')) {
show_mpd_control();
echo "<br />";
} else {
diff --git a/templates/menu.inc b/templates/menu.inc
index c98658dd..5ca40c9e 100644
--- a/templates/menu.inc
+++ b/templates/menu.inc
@@ -26,9 +26,13 @@
*/
-$items = array(
- _("Home") => htmlspecialchars(conf('web_path') . "/index.php"),
- _("Albums") => htmlspecialchars(conf('web_path') . "/albums.php"),
+$items = array(_("Home") => htmlspecialchars(conf('web_path') . "/index.php"));
+
+if ($GLOBALS['user']->prefs['play_type'] == 'mpd' && conf('localplay_menu')) {
+ $items += array(_("Local Play") => htmlspecialchars(conf('web_path') . "/mpd.php"));
+}
+
+$items += array(_("Albums") => htmlspecialchars(conf('web_path') . "/albums.php"),
_("Artists") => htmlspecialchars(conf('web_path') . "/artists.php"),
_("Playlists") => htmlspecialchars(conf('web_path') . "/playlist.php"),
_("Search") => htmlspecialchars(conf('web_path') . "/search.php"),