From 79a890b7bf7bd9b31e6879c64d5651cef02975f3 Mon Sep 17 00:00:00 2001 From: Karl 'vollmerk' Vollmer Date: Sun, 9 Apr 2006 05:24:08 +0000 Subject: updated localplay buttons again as well as mpd controller updates from sigger --- admin/modules.php | 15 ++++++ docs/CHANGELOG | 2 +- images/localplay/next.gif | Bin 1057 -> 1057 bytes images/localplay/pause.gif | Bin 1063 -> 1063 bytes images/localplay/play.gif | Bin 652 -> 1052 bytes images/localplay/prev.gif | Bin 1062 -> 1062 bytes images/localplay/stop.gif | Bin 635 -> 1035 bytes images/localplay/voldn.gif | Bin 1062 -> 1062 bytes images/localplay/volup.gif | Bin 1063 -> 1063 bytes lib/localplay.lib.php | 98 +++++------------------------------ modules/localplay/mpd.controller.php | 59 ++++++++++++++++++--- templates/show_localplay.inc | 25 --------- templates/show_localplay.inc.php | 25 +++++++++ templates/show_modules.inc.php | 12 +++-- templates/show_mpdminicontrol.inc | 95 --------------------------------- 15 files changed, 116 insertions(+), 215 deletions(-) delete mode 100644 templates/show_localplay.inc create mode 100644 templates/show_localplay.inc.php delete mode 100644 templates/show_mpdminicontrol.inc diff --git a/admin/modules.php b/admin/modules.php index ea2fb6f0..9c64e271 100644 --- a/admin/modules.php +++ b/admin/modules.php @@ -42,6 +42,21 @@ switch ($action) { $body = ''; show_confirmation($title,$body,$url); break; + case 'confirm_remove_localplay_preferences': + $type = scrub_in($_REQUEST['type']); + $url = conf('web_path') . '/admin/modules.php?action=remove_localplay_preferences&' . $type; + $title = _('Are you sure you want to remove this module?'); + $body = ''; + show_confirmation($title,$body,$url,1); + break; + case 'remove_localplay_preferences': + $type = scrub_in($_REQUEST['type']); + remove_localplay_preferences($type); + $url = conf('web_path') . '/admin/modules.php'; + $title = _('Module Deactivated'); + $body = ''; + show_confirmation($title,$body,$url); + break; default: require_once (conf('prefix') . '/templates/show_modules.inc.php'); break; diff --git a/docs/CHANGELOG b/docs/CHANGELOG index 8325883c..95354d55 100755 --- a/docs/CHANGELOG +++ b/docs/CHANGELOG @@ -4,7 +4,7 @@ -------------------------------------------------------------------------- v.3.3.2-Beta3 - - Fixed a glitch that was causing m3u's to be build on every + - Fixed a glitch that was causing m3u's to be built on every catalog add, rather then just on creation - Full re-write of Localplay, MPD controller added - Tweaked Preferences once more diff --git a/images/localplay/next.gif b/images/localplay/next.gif index 98ba533a..367b6d90 100755 Binary files a/images/localplay/next.gif and b/images/localplay/next.gif differ diff --git a/images/localplay/pause.gif b/images/localplay/pause.gif index f052cba0..ce70915b 100755 Binary files a/images/localplay/pause.gif and b/images/localplay/pause.gif differ diff --git a/images/localplay/play.gif b/images/localplay/play.gif index 053ef744..6c106621 100755 Binary files a/images/localplay/play.gif and b/images/localplay/play.gif differ diff --git a/images/localplay/prev.gif b/images/localplay/prev.gif index c9ffcb00..56700e53 100755 Binary files a/images/localplay/prev.gif and b/images/localplay/prev.gif differ diff --git a/images/localplay/stop.gif b/images/localplay/stop.gif index 440d6a02..74210c82 100755 Binary files a/images/localplay/stop.gif and b/images/localplay/stop.gif differ diff --git a/images/localplay/voldn.gif b/images/localplay/voldn.gif index 760c7d41..eb6a0ff7 100644 Binary files a/images/localplay/voldn.gif and b/images/localplay/voldn.gif differ diff --git a/images/localplay/volup.gif b/images/localplay/volup.gif index 05fc56b4..4e7288e4 100644 Binary files a/images/localplay/volup.gif and b/images/localplay/volup.gif differ diff --git a/lib/localplay.lib.php b/lib/localplay.lib.php index c0ef6e32..c4a0976a 100644 --- a/lib/localplay.lib.php +++ b/lib/localplay.lib.php @@ -20,90 +20,6 @@ */ -/*! - @function addToPlaylist() - @discussion adds a bunch of songs to the mpd playlist - this takes a mpd object, and an array of songs -*/ -function addToPlaylist( $myMpd, $song_ids=array()) { - - foreach( $song_ids as $song_id ) { - - /* There are two ways to do this, filename or URL */ - if (conf('mpd_method') == 'url') { - // We just need to generate a standard stream URL and pass that - $song = new Song($song_id); - $sess_id = session_id(); - if ($song->type == ".flac") { $song->type = ".ogg"; } - if ($GLOBALS['user']->prefs['play_type'] == 'downsample') { - $ds = $GLOBALS['user']->prefs['sample_rate']; - } - $song_url = conf('web_path') . "/play/index.php?song=$song_id&uid=" . $_SESSION['userdata']['username'] . "&sid=$sess_id&ds=$ds&name=." . $song->type; - if (is_null( $myMpd->PlAdd($song_url) ) ) { - $log_line = _("Error") . ": " . _("Could not add") . ": " . $song_url . " : " . $myMpd->errStr; - echo "$log_line
\n"; - if (conf('debug')) { log_event($GLOBALS['user']->username,'add',$log_line); } - } // if it's null - } // if we want urls - else { - $song = new Song( $song_id ); - $song_filename = $song->get_rel_path(); - if( is_null( $myMpd->PLAdd( $song_filename ) ) ) { - $log_line = _("Error") . ": " . _("Could not add") . ": " . $song_filename . " : " . $myMpd->errStr; - echo "$log_line
\n"; - if (conf('debug')) { log_event($_SESSION['userdata']['username'],'add',$log_line); } - } // end if it's null - // We still need to count if they use the file method - else { - $GLOBALS['user']->update_stats( $song_id ); - } // end else - - } // end else not url method - } // end foreach - -} // addToPlaylist - -/*! - @function show_mpd_control - @discussion shows the mpd controls -*/ -function show_mpd_control() { - - $_REQUEST['action'] = 'show_control'; - require (conf('prefix').'/amp-mpd.php'); - - -} // show_mpd_control - -/** - * show_mpd_pl - * Shows the MPD playlist - * @package Local Play - * @catagory MPD - */ -function show_mpd_pl() { - - $myMpd = init_mpd(); - - require (conf('prefix').'/templates/show_mpdpl.inc'); -} // show_mpd_pl - -/** - * mpd_redirect - * Redriect mojo - * @package Local Play - * @catagory MPD - * @param $page is the URL after conf('web_path') . '/' - */ -function mpd_redirect( $page = 'mpd.php' ) { - if (conf('localplay_menu')) { - header ("Location: " . conf('web_path') . '/' . $page); - } - else { - header ("Location: " . conf('web_path')); - } -} // mpd_redirect - /** * verify_localplay_prefrences * This takes a type of localplay and then @@ -175,6 +91,20 @@ function insert_localplay_preferences($type) { } // insert_localplay_preferences +/** + * remove_localplay_preferences + * This function has two uses, if it is called with a specific type then it + * just removes the preferences for that type, however it if its called with + * nothing then it removes any set of preferences where the module no longer + * exists + */ +function remove_localplay_preferences($type=0) { + + + + + +} // remove_localplay_preferences /** * get_localplay_controllers diff --git a/modules/localplay/mpd.controller.php b/modules/localplay/mpd.controller.php index f05447d0..991d778a 100644 --- a/modules/localplay/mpd.controller.php +++ b/modules/localplay/mpd.controller.php @@ -65,10 +65,16 @@ class AmpacheMpd { $map['status'] = 'get_status'; $map['connect'] = 'connect'; - /* Optional Functions */ + /* Recommended Functions */ $map['next'] = 'next'; $map['prev'] = 'prev'; $map['pause'] = 'pause'; + $map['volume'] = 'volume'; + $map['loop'] = 'loop'; + $map['random'] = 'random'; + + /* Optional Functions */ + $map['move'] = 'move'; return $map; @@ -151,7 +157,6 @@ class AmpacheMpd { function play() { if (is_null($this->_mpd->Play())) { return false; } - return true; } // play @@ -164,7 +169,6 @@ class AmpacheMpd { function stop() { if (is_null($this->_mpd->Stop())) { return false; } - return true; } // stop @@ -177,7 +181,6 @@ class AmpacheMpd { function next() { if (is_null($this->_mpd->Next())) { return false; } - return true; } // next @@ -189,7 +192,6 @@ class AmpacheMpd { function prev() { if (is_null($this->_mpd->Previous())) { return false; } - return true; } // prev @@ -201,11 +203,56 @@ class AmpacheMpd { function pause() { if (is_null($this->_mpd->Pause())) { return false; } - return true; } // pause + + /** + * volume + * This tells MPD to set the volume to the parameter + */ + function volume($volume) { + + if (is_null($this->_mpd->SetVolume($volume))) { return false; } + return true; + + } // volume + + /** + * 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; + + } // loop + + + /** + * random + * This tells MPD to turn on or off the playing of songs from the playlist in random order + */ + function random($onoff) { + + if (is_null($this->_mpd->SetRandom($onoff))) { return false; } + return true; + + } // random + + /** + * move + * This tells MPD to move song from SrcPos to DestPos + */ + function move($SrcPos, $DestPos) { + + if (is_null($this->_mpd->PLMoveTrack($SrcPos, $DestPos))) { return false; } + + return true; + } // move + /** * get_songs * This functions returns an array containing information about diff --git a/templates/show_localplay.inc b/templates/show_localplay.inc deleted file mode 100644 index ece7ecde..00000000 --- a/templates/show_localplay.inc +++ /dev/null @@ -1,25 +0,0 @@ - diff --git a/templates/show_localplay.inc.php b/templates/show_localplay.inc.php new file mode 100644 index 00000000..ece7ecde --- /dev/null +++ b/templates/show_localplay.inc.php @@ -0,0 +1,25 @@ + diff --git a/templates/show_modules.inc.php b/templates/show_modules.inc.php index 23c1d593..8b0b139f 100644 --- a/templates/show_modules.inc.php +++ b/templates/show_modules.inc.php @@ -30,25 +30,29 @@ $localplay_modules = get_localplay_controllers(); $web_path = conf('web_path'); ?> - + +
" . _('Activate') . ""; } + else { + $action = "" . + _('Deactivate') . ""; + } ?> - + - + diff --git a/templates/show_mpdminicontrol.inc b/templates/show_mpdminicontrol.inc deleted file mode 100644 index 2319348f..00000000 --- a/templates/show_mpdminicontrol.inc +++ /dev/null @@ -1,95 +0,0 @@ - - -
-
- - - -
- - - - - - - - - - - -
- state} = "class='selected_button'"; - if (true) /* rigged to do AJAX for now; change to conf('AJAX') later*/ { ?> - - - id="stop_button" value=" X " onclick="startRequest('action=stop');"/> - id="play_button" value=" > " onclick="startRequest('action=play');"/> - id="pause_button" value=" | | " onclick="startRequest('action=pause');"/> - - -
- - " name="action" value="|< " /> - " name="action" value=" X " /> - " name="action" value=" > " /> - " name="action" value=" | | " /> - " name="action" value= " >|" /> -
- -
- Played current_track_position)?> - (current_track_position/$myMpd->current_track_length),2)*100)."%) of " . - format_time($myMpd->current_track_length); ?> - - Vol: volume ?>% - -
- - - - - - - - [mute - -25 - -10 - +10 - +25] '; - -
-
- -- cgit