From 1cf69f04be778cdf377c53ca9ab2182d27756f94 Mon Sep 17 00:00:00 2001 From: Karl 'vollmerk' Vollmer Date: Tue, 14 Nov 2006 05:38:17 +0000 Subject: some minor MPD changes and bug fixes for localplay --- docs/CHANGELOG | 8 +++ docs/README | 1 + lib/init.php | 2 +- localplay.php | 8 ++- modules/localplay/mpd.controller.php | 6 +- modules/mpd/mpd.class.php | 104 ++++++++++++++++++++--------------- templates/show_localplay.inc.php | 1 - 7 files changed, 82 insertions(+), 48 deletions(-) diff --git a/docs/CHANGELOG b/docs/CHANGELOG index c341e18d..1c166a64 100755 --- a/docs/CHANGELOG +++ b/docs/CHANGELOG @@ -2,6 +2,14 @@ --------- Ampache -- CHANGELOG --------- -------------------------------------------------------------------------- +-------------------------------------------------------------------------- + v.3.3.3-Beta1 + - Added new Flash Player with full support for Non-US Char and + colors. (Thx PB1DFT/Enrico Lai http://www.enricolai.com) + - Tweaked how MPD is handled, if MPD is stopped a new play action + will clear old playlist, otherwise Play appends. + (Thx henrik) + -------------------------------------------------------------------------- v.3.3.3-Alpha2 11/12/2006 - Added Export to Itunes DB function (Thx PB1DFT) diff --git a/docs/README b/docs/README index 601e5257..4b68dab6 100755 --- a/docs/README +++ b/docs/README @@ -104,6 +104,7 @@ Contents: Maan Bsat (random fixes) latka (from media.tangent.org site) for orphaned song ideas Lamar Hansford (README/INSTALL improvements) & Upload + Enrico Lai http://www.enricolai.com for the XSPF Flash Player And many many more... 2. Getting all the components diff --git a/lib/init.php b/lib/init.php index a74d9ac4..6418c826 100644 --- a/lib/init.php +++ b/lib/init.php @@ -67,7 +67,7 @@ if (!$results = read_config($configfile,0)) { } /** This is the version.... fluf nothing more... **/ -$results['version'] = '3.3.3-Alpha2'; +$results['version'] = '3.3.3-Beta1 (Build 001)'; $results['raw_web_path'] = $results['web_path']; $results['web_path'] = $http_type . $_SERVER['HTTP_HOST'] . $results['web_path']; diff --git a/localplay.php b/localplay.php index 0f593946..d91ea86e 100644 --- a/localplay.php +++ b/localplay.php @@ -71,7 +71,13 @@ switch ($action) { require_once (conf('prefix') . '/templates/show_localplay.inc.php'); break; default: - require_once (conf('prefix') . '/templates/show_localplay.inc.php'); + if ($localplay = init_localplay()) { + require_once (conf('prefix') . '/templates/show_localplay.inc.php'); + } + else { + $GLOBALS['error']->add_error('general',_('Localplay Init Failed')); + $GLOBALS['error']->print_error('general'); + } break; } // end switch action diff --git a/modules/localplay/mpd.controller.php b/modules/localplay/mpd.controller.php index b81b6a95..1d850b48 100644 --- a/modules/localplay/mpd.controller.php +++ b/modules/localplay/mpd.controller.php @@ -109,8 +109,10 @@ class AmpacheMpd { * and then add them to MPD */ function add_songs($songs) { - /* Clear the playlist first */ - $this->clean_playlist(); + + if (is_null($this->_mpd->ClearPLIfStopped())) { + debug_event('mpd_add', 'Error: Unable to clear the MPD playlist ' . $this->_mpd->errStr,'1'); + } foreach ($songs as $song_id) { $song = new Song($song_id); diff --git a/modules/mpd/mpd.class.php b/modules/mpd/mpd.class.php index 1191f39a..ca853936 100644 --- a/modules/mpd/mpd.class.php +++ b/modules/mpd/mpd.class.php @@ -1,25 +1,27 @@ -_parseFileListResponse($resp); if ( $this->debugging ) echo "mpd->GetPlaylist() / return ".print_r($playlist)."\n"; return $playlist; - } - - /* ----------------- Command compatibility tables --------------------- */ - var $COMPATIBILITY_MIN_TBL = array( - MPD_CMD_SEEK => "0.9.1" , - MPD_CMD_PLMOVE => "0.9.1" , - MPD_CMD_RANDOM => "0.9.1" , - MPD_CMD_PLSWAPTRACK => "0.9.1" , - MPD_CMD_PLMOVETRACK => "0.9.1" , - MPD_CMD_PASSWORD => "0.10.0" , - MPD_CMD_SETVOL => "0.10.0" - ); - - var $COMPATIBILITY_MAX_TBL = array( - MPD_CMD_VOLUME => "0.10.0" - ); - -} // ---------------------------- end of class ------------------------------ - - -?> + } + + /* ClearPLIfStopped() + * + * This function clears the mpd playlist ONLY IF the mpd state is MPD_STATE_STOPPED + */ + function ClearPLIfStopped() { + + if ( $this->debugging ) echo "mpd->ClearPLIfStopped()\n"; + $this->RefreshInfo(); + if ($resp = ($this->state == MPD_STATE_STOPPED)) { + $this->PLClear(); + } + if ( $this->debugging ) echo "mpd->ClearPLIfStopped() / return\n"; + return $resp; + + } // ClearPLIfStopped + + /* ----------------- Command compatibility tables --------------------- */ + var $COMPATIBILITY_MIN_TBL = array( + MPD_CMD_SEEK => "0.9.1" , + MPD_CMD_PLMOVE => "0.9.1" , + MPD_CMD_RANDOM => "0.9.1" , + MPD_CMD_PLSWAPTRACK => "0.9.1" , + MPD_CMD_PLMOVETRACK => "0.9.1" , + MPD_CMD_PASSWORD => "0.10.0" , + MPD_CMD_SETVOL => "0.10.0" + ); + + var $COMPATIBILITY_MAX_TBL = array( + MPD_CMD_VOLUME => "0.10.0" + ); + +} // ---------------------------- end of class ------------------------------ + + +?> diff --git a/templates/show_localplay.inc.php b/templates/show_localplay.inc.php index 0ad5938c..a6d6ce08 100644 --- a/templates/show_localplay.inc.php +++ b/templates/show_localplay.inc.php @@ -22,7 +22,6 @@ $web_path = conf('web_path'); $localplay = init_localplay(); -$songs = $localplay->get(); ?> type) . ' ' . _('Localplay')); ?> -- cgit