summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2005-07-16 02:42:41 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2005-07-16 02:42:41 +0000
commit4a9909a8a193a781d72a647b81e9de75a57428c6 (patch)
treeb4d8a065245ad0cb53ca2c179ff235b557a3dcaf
parentc024808430c781b03dab0e9b49016ac4cb868fb1 (diff)
downloadampache-4a9909a8a193a781d72a647b81e9de75a57428c6.tar.gz
ampache-4a9909a8a193a781d72a647b81e9de75a57428c6.tar.bz2
ampache-4a9909a8a193a781d72a647b81e9de75a57428c6.zip
fixed the mpd problems once and for all...
-rw-r--r--amp-mpd.php2
-rw-r--r--index.php4
-rw-r--r--lib/mpd.php9
-rw-r--r--templates/show_mpdpl.inc6
4 files changed, 9 insertions, 12 deletions
diff --git a/amp-mpd.php b/amp-mpd.php
index f49151cc..6dcb19a6 100644
--- a/amp-mpd.php
+++ b/amp-mpd.php
@@ -24,7 +24,9 @@
require_once("modules/init.php");
+
/* We need to create a MPD object here */
+
$myMpd = init_mpd();
if (is_object($myMpd)) {
diff --git a/index.php b/index.php
index 15010eee..a69c0cd7 100644
--- a/index.php
+++ b/index.php
@@ -28,9 +28,7 @@
require_once("modules/init.php");
/* We need to attempt to init the mpd object */
-if (conf('mpd_method') == 'file' OR $user->prefs['play_type'] == 'mpd') {
- $myMpd = init_mpd();
-}
+$myMpd = init_mpd();
show_template('header');
show_menu_items('Home');
diff --git a/lib/mpd.php b/lib/mpd.php
index 330817d0..d4ee10d1 100644
--- a/lib/mpd.php
+++ b/lib/mpd.php
@@ -80,7 +80,7 @@ function show_mpd_control() {
*/
function show_mpd_pl() {
- $myMpd = $GLOBALS['myMpd'];
+ $myMpd = init_mpd();
require (conf('prefix').'/templates/show_mpdpl.inc');
} // show_mpd_pl
@@ -111,8 +111,11 @@ function mpd_redirect() {
*/
function init_mpd() {
- if (!class_exists('mpd')) { require_once(conf('prefix')."/modules/mpd/mpd.class.php"); }
- if (!is_object($GLOBALS['myMpd'])) {
+ static $myMpd;
+
+ if (!conf('allow_mpd_playback')) { return false; }
+
+ if (!is_object($myMpd)) {
$myMpd = new mpd(conf('mpd_host'),conf('mpd_port'));
}
diff --git a/templates/show_mpdpl.inc b/templates/show_mpdpl.inc
index b87bb396..8d8bc222 100644
--- a/templates/show_mpdpl.inc
+++ b/templates/show_mpdpl.inc
@@ -30,12 +30,6 @@ TTD:
*/
-if (!$myMpd->connected)
- {
- echo "<font class=\"error\">" . _("Error Connecting") . ": " . $myMpd->errStr . "</font><br />\n";
- log_event ($_SESSION['userdata']['username'],' connection_failed ',"Error: unable to connect to MPD, ".$myMpd->errStr);
- return;
- }
$nopad = "style='padding: 0px 0px 0px 0px'";
$minpad = "style='padding: 0px 2px 0px 2px'";