summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-04-09 05:24:08 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-04-09 05:24:08 +0000
commit79a890b7bf7bd9b31e6879c64d5651cef02975f3 (patch)
tree1b675839bf9f2de56f6adcb8c2067c354ecaf1ca
parent7b1e57d0ccdda52881645f7c16f42ceb5da15881 (diff)
downloadampache-79a890b7bf7bd9b31e6879c64d5651cef02975f3.tar.gz
ampache-79a890b7bf7bd9b31e6879c64d5651cef02975f3.tar.bz2
ampache-79a890b7bf7bd9b31e6879c64d5651cef02975f3.zip
updated localplay buttons again as well as mpd controller updates from sigger
-rw-r--r--admin/modules.php15
-rwxr-xr-xdocs/CHANGELOG2
-rwxr-xr-ximages/localplay/next.gifbin1057 -> 1057 bytes
-rwxr-xr-ximages/localplay/pause.gifbin1063 -> 1063 bytes
-rwxr-xr-ximages/localplay/play.gifbin652 -> 1052 bytes
-rwxr-xr-ximages/localplay/prev.gifbin1062 -> 1062 bytes
-rwxr-xr-ximages/localplay/stop.gifbin635 -> 1035 bytes
-rw-r--r--images/localplay/voldn.gifbin1062 -> 1062 bytes
-rw-r--r--images/localplay/volup.gifbin1063 -> 1063 bytes
-rw-r--r--lib/localplay.lib.php98
-rw-r--r--modules/localplay/mpd.controller.php59
-rw-r--r--templates/show_localplay.inc.php (renamed from templates/show_localplay.inc)0
-rw-r--r--templates/show_modules.inc.php12
-rw-r--r--templates/show_mpdminicontrol.inc95
14 files changed, 91 insertions, 190 deletions
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&amp;' . $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
--- a/images/localplay/next.gif
+++ b/images/localplay/next.gif
Binary files differ
diff --git a/images/localplay/pause.gif b/images/localplay/pause.gif
index f052cba0..ce70915b 100755
--- a/images/localplay/pause.gif
+++ b/images/localplay/pause.gif
Binary files differ
diff --git a/images/localplay/play.gif b/images/localplay/play.gif
index 053ef744..6c106621 100755
--- a/images/localplay/play.gif
+++ b/images/localplay/play.gif
Binary files differ
diff --git a/images/localplay/prev.gif b/images/localplay/prev.gif
index c9ffcb00..56700e53 100755
--- a/images/localplay/prev.gif
+++ b/images/localplay/prev.gif
Binary files differ
diff --git a/images/localplay/stop.gif b/images/localplay/stop.gif
index 440d6a02..74210c82 100755
--- a/images/localplay/stop.gif
+++ b/images/localplay/stop.gif
Binary files differ
diff --git a/images/localplay/voldn.gif b/images/localplay/voldn.gif
index 760c7d41..eb6a0ff7 100644
--- a/images/localplay/voldn.gif
+++ b/images/localplay/voldn.gif
Binary files differ
diff --git a/images/localplay/volup.gif b/images/localplay/volup.gif
index 05fc56b4..4e7288e4 100644
--- a/images/localplay/volup.gif
+++ b/images/localplay/volup.gif
Binary files 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 "<font class=\"error\">$log_line</font><br />\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 "<font class=\"error\">$log_line</font><br />\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.php
index ece7ecde..ece7ecde 100644
--- a/templates/show_localplay.inc
+++ b/templates/show_localplay.inc.php
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');
?>
-<table class="text-box">
+<span class="header2"><?php echo _('Modules'); ?></span>
+<table class="border" border="0" cellspacing="0">
<tr class="table-header">
<th><?php echo _('Module Name'); ?></th>
<th><?php echo _('Action'); ?></th>
</tr>
<?php
foreach ($localplay_modules as $module) {
- $action = _('Active');
if (!verify_localplay_preferences($module)) {
$action = "<a href=\"" . $web_path . "/admin/modules.php?action=insert_localplay_preferences&amp;type=" . $module . "\">" .
_('Activate') . "</a>";
}
+ else {
+ $action = "<a href=\"" . $web_path . "/admin/modules.php?action=confirm_remove_localplay_preferences&amp;type=" . $module . "\">" .
+ _('Deactivate') . "</a>";
+ }
?>
-<tr>
+<tr class="<?php echo flip_class(); ?>">
<td><?php echo scrub_out($module); ?></td>
<td><?php echo $action; ?></td>
</tr>
<?php } if (!count($localplay_modules)) { ?>
-<tr>
+<tr class="<?php echo flip_class(); ?>">
<td colspan="2"><span class="error"><?php echo _('No Records Found'); ?></span></td>
</tr>
<?php } ?>
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 @@
-<?php
-/*
-
- Copyright (c) 2001 - 2005 Ampache.org
- All rights reserved.
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 2
- of the License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-*/
-
-/*!
- @header Show mpd controls, this doesn't
- include the playlist, status and what have you.
- this looks a goodbit like local_play
-*/
-$web_path = conf('web_path');
-require_once ("javascript_refresh.inc");
-?>
-
-<div align="center"><!-- Is this div neccesary??? or is the below table not needed???-->
-<table border="0" cellpadding="3" cellspacing="0"><!-- MPD Control table -->
-<tr>
-<td>
- <table id="mpd_control" border="0" cellpadding="0" cellspacing="0" class="even" align="center">
-<!-- <th class="table-header"><?php echo _("MPD Play Control"); ?></th> -->
- <tr>
- <td>
- <?php ${$myMpd->state} = "class='selected_button'";
- if (true) /* rigged to do AJAX for now; change to conf('AJAX') later*/ { ?>
- <!-- for testing <input type="button" value="times" onclick="timestuff();"/> -->
- <input type="button" value="|&lt; " onclick="startRequest('action=Prev');"/>
- <input type="button" <?php echo $stop ?> id="stop_button" value=" X " onclick="startRequest('action=stop');"/>
- <input type="button" <?php echo $play ?> id="play_button" value=" &gt; " onclick="startRequest('action=play');"/>
- <input type="button" <?php echo $pause ?> id="pause_button" value=" | | " onclick="startRequest('action=pause');"/>
- <input type="button" value=" &gt;|" onclick="startRequest('action=Next');"/>
- <?php
- }
- else { ?>
- <form action="<?php echo $web_path; ?>/amp-mpd.php" method="post" name="playcontrol" style="display:inline; white-space: nowrap">
- <!-- these used to have class="button" -->
- <input type="submit" title="<?php echo _("Prev"); ?>" name="action" value="|&lt; " />
- <input type="submit" title="<?php echo _("Stop"); ?>" name="action" value=" X " <?php echo $stop; ?> />
- <input type="submit" title="<?php echo _("Play"); ?>" name="action" value=" &gt; " <?php echo $play; ?> />
- <input type="submit" title="<?php echo _("Pause"); ?>" name="action" value=" | | " <?php echo $pause; ?> />
- <input type="submit" title="<?php echo _("Next"); ?>" name="action" value= " &gt;|" />
- </form>
- <?php } ?>
- </td>
- </tr>
- <tr>
- <td class="content">
- Played <b><span id="mpd_cur_track_pos"><?php echo format_time($myMpd->current_track_position)?></span></b>
- (<span id="mpd_pctplayed"><?php echo (round(($myMpd->current_track_position/$myMpd->current_track_length),2)*100)."</span>%) of " .
- format_time($myMpd->current_track_length); ?>
- - Vol: <b><span id='volume'><?php echo $myMpd->volume ?></span>%</b>
-
-</td>
- </tr>
- <tr>
- <td class="content">
- <?php
- if (true) /* rigged to do AJAX for now; change to conf('AJAX') later */ { ?>
- <input type="button" value="0" onclick="startRequest('action=setvol&amp;param1=0');"/>
- <input type="button" value="-25" onclick="startRequest('action=adjvol&amp;param1=-25');"/>
- <input type="button" value="-10" onclick="startRequest('action=adjvol&amp;param1=-10');"/>
- <input type="button" value="+10" onclick="startRequest('action=adjvol&amp;param1=10');"/>
- <input type="button" value="+25" onclick="startRequest('action=adjvol&amp;param1=25');"/>
- <?php
- }
- else { ?>
- [<a href="<?php echo $web_path; ?>/amp-mpd.php?action=setvol&amp;val=0">mute</a>
- <a href="<?php echo $web_path; ?>/amp-mpd.php?action=adjvol&amp;val=-25">-25</a>
- <a href="<?php echo $web_path; ?>/amp-mpd.php?action=adjvol&amp;val=-10">-10</a>
- <a href="<?php echo $web_path; ?>/amp-mpd.php?action=adjvol&amp;val=+10">+10</a>
- <a href="<?php echo $web_path; ?>/amp-mpd.php?action=adjvol&amp;val=+25">+25</a>] ';
- <?php } ?>
- </td>
- </tr>
- </table>
-</td>
-</tr>
-</table>
-</div>