summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2005-06-30 14:43:11 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2005-06-30 14:43:11 +0000
commit224f007c59eab093bea69eb227faa64104ed4e15 (patch)
tree44486b935f6d1defaa67e56379a15aab5ec57af9
parent10f8a1ec3378c3540a35f73e986cc284f2e66f1d (diff)
downloadampache-224f007c59eab093bea69eb227faa64104ed4e15.tar.gz
ampache-224f007c59eab093bea69eb227faa64104ed4e15.tar.bz2
ampache-224f007c59eab093bea69eb227faa64104ed4e15.zip
new mpd interface
-rw-r--r--amp-mpd.php78
-rwxr-xr-xdocs/CHANGELOG1
-rw-r--r--index.php4
-rw-r--r--lib/class/update.class.php18
-rw-r--r--lib/mpd.php6
-rw-r--r--modules/init.php2
-rw-r--r--templates/show_mpdpl.inc172
-rw-r--r--templates/show_mpdplay.inc96
8 files changed, 346 insertions, 31 deletions
diff --git a/amp-mpd.php b/amp-mpd.php
index 615b9124..c77f8ef8 100644
--- a/amp-mpd.php
+++ b/amp-mpd.php
@@ -138,6 +138,84 @@ else {
case "show_control":
require (conf('prefix') . "/templates/show_mpdplay.inc");
break;
+ case "mute":
+ if (!$user->has_access(25)) { break; }
+ if ( is_null($myMpd->SetVolume(0)) ) echo "ERROR: " .$myMpd->errStr."\n";
+ mpd_redirect();
+ break;
+ case "condPL":
+ if (!$user->has_access(25)) { break; }
+ $condPL = (conf('condPL')==1 ? 0 : 1);
+ conf(array('condPL' => $condPL),1);
+ $db_results = mysql_query("UPDATE user_preference, preferences SET user_preference.value='$condPL' ".
+ "WHERE preferences.name='condPL' AND preferences.id=user_preference.preference AND user ='$user->id'", dbh());
+ mpd_redirect();
+ break;
+ case "crop":
+ if (!$user->has_access(25)) { break; }
+ $pl = $myMpd->playlist;
+ $cur = $myMpd->current_track_id;
+ foreach ($pl as $id => $entry)
+ {
+ if ($id != $cur)
+ { if ( is_null($myMpd->PLRemove($id < $cur ? 0 : 1))) {echo "ERROR: " .$myMpd->errStr."\n"; } }
+ }
+ mpd_redirect();
+ break;
+ case "plact":
+ if (!$user->has_access(25)) { break; }
+ switch ($_REQUEST['todo'])
+ {
+ case "Delete":
+ $shrunkby =0;
+ foreach ($_REQUEST[song] as $id => $entry) {
+ if ( is_null($myMpd->PLRemove($id-$shrunkby)) ) echo "ERROR: " .$myMpd->errStr."\n";
+ $shrunkby++;
+ }
+ break;
+ case "Crop":
+ $skipped=0;
+ $upto = $myMpd->playlist_count-1;
+ for ($count=0; $count <= $upto; $count++) {
+ if (!isset($_REQUEST[song][$count])) {
+ if ( is_null($myMpd->PLRemove($skipped)) ) echo "ERROR: " .$myMpd->errStr."\n";
+ }
+ else {$skipped++;}
+ }
+ break;
+ case "move Next":
+ /* This does not work yet */
+ $fromabovenp = 0;
+ $frombelownp = 0;
+ $reversed = array_reverse ($_REQUEST[song]);
+ foreach ($reversed as $id => $entry) {
+ echo "id=".$id;
+ if ($id > $myMpd->current_track_id) {
+ echo " fromabovenp=".$fromabovenp." source=".$id+$fromabovenp." dest=".($myMpd->current_track_id+1)."<br>";
+ if (is_null($myMpd->PLMoveTrack($id+$fromabovenp,$myMpd->current_track_id+1))) echo "ERROR: ".$myMpd->errStr."\n";
+ $fromabovenp++;
+ }
+ elseif ($id < $myMpd->current_track_id) {
+ echo " frombelownp=".$frombelownp." source=".$id." dest=".$myMpd->current_track_id+1-frombelownp."<br>";
+ if (is_null($myMpd->PLMoveTrack($id,$myMpd->current_track_id+1-frombelownp))) echo "ERROR: ".$myMpd->errStr."\n";
+ $frombelownp++;
+ }
+ }
+ break;
+ default:
+ echo "todo='".$_REQUEST['todo']."'<br>";
+ foreach ($_REQUEST[song] as $id => $entry)
+ {
+ echo "id=".$id." entry=".$entry."_REQUEST[song][id]=".$_REQUEST[song][$id]."<br>";
+ }
+ }
+ mpd_redirect();
+ break;
+ case "movenext":
+ if (!$user->has_access(25)) { break; }
+ if (is_null($myMpd->PLMoveTrack($_REQUEST[val],$myMpd->current_track_id+1))) echo "ERROR: ".$myMpd->errStr."\n";
+ mpd_redirect();
+ break;
default:
mpd_redirect();
break;
diff --git a/docs/CHANGELOG b/docs/CHANGELOG
index 44477125..9fb348e1 100755
--- a/docs/CHANGELOG
+++ b/docs/CHANGELOG
@@ -12,6 +12,7 @@
- Moved files into more logical areas, added .lib and .class
suffix to library and class files, also started using
phpdoc style documentation
+ - Added Improved MPD interface (Thx Sigger)
--------------------------------------------------------------------------
v.3.3.1 06/21/2005:
diff --git a/index.php b/index.php
index 88431963..4819e3b0 100644
--- a/index.php
+++ b/index.php
@@ -68,6 +68,10 @@ if (conf('refresh_limit') > 0) { show_template('javascript_refresh'); }
</td>
</tr>
<tr><td colspan="2">&nbsp;</td></tr>
+ <tr>
+ <?php if ($user->prefs['play_type'] == 'mpd') { show_mpd_pl(); } ?>
+ </tr>
+ <tr><td colspan="2">&nbsp;</td></tr>
<tr>
<td valign="top" align="right">
<?php
diff --git a/lib/class/update.class.php b/lib/class/update.class.php
index b006b8e7..6af17486 100644
--- a/lib/class/update.class.php
+++ b/lib/class/update.class.php
@@ -924,6 +924,24 @@ class Update {
$sql = "ALTER TABLE `object_count` CHANGE `object_type` `object_type` ENUM( 'album', 'artist', 'song', 'playlist', 'genre', 'catalog' ) NOT NULL DEFAULT 'song'";
$sql = "ALTER TABLE `session` CHANGE `type` `type` ENUM( 'sso', 'mysql', 'ldap', 'http' ) NOT NULL DEFAULT 'mysql'";
+
+ /* Add new preference */
+ $sql = "INSERT INTO `preferences` (`id`,`name`,`value`,`description`,`level`,`type`,`locked`) " .
+ "VALUES ('','condPL','1','Condense Localplay Playlist','0','user','0')";
+
+ $db_results = mysql_query($sql, dbh());
+
+ /* Fix existing preferecnes */
+ $sql = "SELECT DISTINCT(user) FROM user_preference";
+ $db_results = mysql_query($sql, dbh());
+
+ $user = new User(0);
+
+ while ($results = mysql_fetch_array($db_results)) {
+ $user->fix_preferences($results[0]);
+ }
+
+ $this->set_version('db_version','332001');
} // update_332001
diff --git a/lib/mpd.php b/lib/mpd.php
index 166bfe5b..376bbedc 100644
--- a/lib/mpd.php
+++ b/lib/mpd.php
@@ -67,9 +67,13 @@ function addToPlaylist( $myMpd, $song_ids=array()) {
function show_mpd_control() {
$_REQUEST['action'] = 'show_control';
- require_once ('amp-mpd.php');
+ require ('amp-mpd.php');
} // show_mpd_control
+function show_mpd_pl() {
+ require (conf('prefix').'/templates/show_mpdpl.inc');
+} // show_mpd_pl
+
?>
diff --git a/modules/init.php b/modules/init.php
index 41c83670..1813f985 100644
--- a/modules/init.php
+++ b/modules/init.php
@@ -83,7 +83,7 @@ if (!$results['conf']['allow_stream_playback']) {
}
$results['conf']['web_path'] = $http_type . $_SERVER['HTTP_HOST'] . $results['conf']['web_path'];
-$results['conf']['version'] = '3.3.1';
+$results['conf']['version'] = '3.3.2-Alpha1 (Build 001)';
$results['conf']['catalog_file_pattern']= 'mp3|mpc|m4p|m4a|mp4|aac|ogg|rm|wma|asf|flac|spx';
$results['libglue']['local_table'] = 'session';
$results['libglue']['local_sid'] = 'id';
diff --git a/templates/show_mpdpl.inc b/templates/show_mpdpl.inc
new file mode 100644
index 00000000..fdf513a6
--- /dev/null
+++ b/templates/show_mpdpl.inc
@@ -0,0 +1,172 @@
+<?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.
+
+*/
+$web_path = conf('web_path');
+/*
+Instructions on incorporating this code:
+1) You need to add a row with a name of 'condPL' into the table preferences. Initial value is 1 (condensed playlist by default)
+or 0 (not condensed by default).
+2) Insert the following function at the end of /mpd.php and change show_mpd_control() above it to "require" (instead of require_once):
+
+TTD:
+- It would be nice if flagged songs showed up in a flagged color (e.g. red).
+- Accept one or more parameters by which the caller specify which columns are displayed.
+- What is the best way to deal with the play pointer when stopped. MPD doesn't report a "position" but stop restarts at the song
+ that was playing before the stop.
+
+*/
+
+/* The following mpd init code is from amp-mpd.php and should probably go into a mpdinit file that gets executed by initmpd
+since other pages or items on index.php that come before this (like an MPD control in the header!) might need myMpd.
+*/
+
+
+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')); }
+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'";
+
+?>
+<td colspan=2 valign="top">
+
+<form action="<?php echo conf('web_path')."/amp-mpd.php"; ?>" method="post" enctype="multipart/form-data">
+
+<table class="border" border="0" cellpadding="0" cellspacing="1" width="100%">
+<tr><td align="center" class="headrow"><b>MPD Server Playlist</b><br>
+ <i>[<a title="<?php echo _("Refresh the Playlist Window"); ?>" href="<?php echo conf('web_path'); ?>">refresh</a>]
+<?php if ( $myMpd->playlist_count > 0 ) {
+ $un = (conf('condPL')) ? "un" : ""; ?>
+ [<a title="<?php echo _("Click to shuffle (randomize) the playlist"); ?>" href="<?php echo conf('web_path'); ?>/amp-mpd.php?action=shuffle"><?php echo _("shuffle")?></a>]
+ [<a title="<?php echo _("Click to the clear the playlist"); ?>" href="<?php echo conf('web_path'); ?>/amp-mpd.php?action=clear">clear</a>]
+ [<a title="<?php echo 'Click to '.$un.'condense playlist'; ?>" href="<?php echo conf('web_path'); ?>/amp-mpd.php?action=condPL"><?php echo $un?>condense</a>]
+ [<a title="<?php echo _("Click to the remove all except the Now Playing"); ?>"href="<?php echo conf('web_path'); ?>/amp-mpd.php?action=crop">crop</a>]
+<?php } ?> </i></td></tr>
+<tr><td <?php echo $nopad ?>>
+<table cellspacing="0" cellpadding="0" border="0" width="100%"><tr class="table-header">
+ <th <?php echo $minpad ?>><a href="#" onclick="check_songs(); return false;">Flip</a></th>
+ <th align="left"><?php echo _("Song title"); ?></th>
+ <th align="left"><?php echo _("Artist"); ?></th>
+ <th align="left"><?php echo _("Album"); ?></th>
+ <th align="right" <?php echo $minpad ?>><?php echo _("Track"); ?></td>
+ <th align="right" <?php echo $minpad ?>><?php echo _("Time"); ?></th>
+ <th <?php echo $minpad ?>><?php echo _("Genre"); ?></th>
+ <th><?php echo _("Action"); ?></th>
+ </tr>
+ <?php
+ $pl = $myMpd->playlist;
+ if (is_null($pl)) echo "ERROR: ".$myMpd->errStr."\n";
+ else {
+ $maxlen = strlen (count($pl));
+ $condPL = conf('condPL');
+ if ($condPL)
+ {
+ echo "<tr class=\"".flip_class()."\"><td colspan=8 align=\"center\" style=\"padding: 3px 0px 3px 0px\">... Condensed Playlist ...</td></tr>";
+ }
+
+ foreach ($pl as $id=>$entry) {
+
+ if ( ($condPL) and (($id < $myMpd->current_track_id-1) or ($id > $myMpd->current_track_id + 10)) )
+ { continue; }
+
+ unset($text_class);
+
+ $track = $id+1;
+ $len=strlen($track);
+ while ($len < $maxlen)
+ {
+ $track = "0".$track;
+ $len++;
+ }
+
+ // Still needed crap
+ $totalsize += $song->size;
+ $totaltime += $entry['Time'];
+ ?>
+
+ <tr class="<?php echo flip_class(); ?>">
+ <?php if ($id==$myMpd->current_track_id)
+ {$tdstyle = "style='padding: 0px 2px 0px 2px; font-weight: bold'";}
+ else {$tdstyle = $minpad;} ?>
+<?php
+$mpddir = conf('mpd_dir')."/";
+$sql = "SELECT genre.name, song.genre, song.id, song.album, song.artist FROM song, genre WHERE file = \"".$mpddir.$entry['file']."\" AND song.genre=genre.id";
+$db_results = @mysql_query($sql,dbh());
+$count=0;
+$r = @mysql_fetch_object ($db_results);
+?>
+ <td align="center" <?php echo $minpad ?>><input type="checkbox" name="song[<?php echo $entry['Pos']?>]" value="1" id="song_<?php echo $entry['Pos']; ?>"></input></td>
+ <td align="left" <?php echo $tdstyle ?>><?php echo $track.". ";?><a href="<?php echo $web_path; ?>/amp-mpd.php?action=skipto&val=<?php echo $entry['Pos']; ?>" title="<?php echo $entry['Title']; ?>" <?php echo $text_class; ?>><?php echo $entry['Title']; ?> </a></td>
+ <td align="left" <?php echo $tdstyle ?>><a href="<?php echo $web_path; ?>/artists.php?action=show&artist=<?php echo $r->artist; ?>" title="More from <?php echo $entry['Artist']; ?>" <?php echo $text_class; ?>> <?php echo $entry['Artist']; ?> </a></td>
+ <td align="left" <?php echo $tdstyle ?>><a href="<?php echo $web_path; ?>/albums.php?action=show&album=<?php echo $r->album; ?>" title="More on <?php echo $entry['Album']; ?>" <?php echo $text_class; ?>> <?php echo $entry['Album']; ?> </a></td>
+ <td align="right" <?php echo $tdstyle ?>><?php echo $entry['Track']; ?></td>
+ <td align="right" <?php echo $tdstyle ?>><?php echo sprintf ("%d:%02d",$entry['Time']/60,$entry['Time']%60) ?></td>
+
+ <td align="center" <?php echo $tdstyle.">".$r->name ?></td>
+
+ <td <?php echo $tdstyle ?>><?php echo "<a href=".$web_path."/flag.php?song=".$r->id."&action=flag title=\"Flag '".$entry['file']."' by ".$entry['Artist']."\" ".$text_class.">f</a>&nbsp".
+ "<a href=".$web_path."/amp-mpd.php?action=movenext&val=".$entry['Pos']." title=\"Move '".$entry['Title']."' to play next\" ".$text_class.">n</a>&nbsp".
+ // "^&nbsp".
+ // "v&nbsp".
+ "<a href=".$web_path."/amp-mpd.php?action=rem&id=".$entry['Pos']." title=\"Remove '".$entry['Title']."' from playlist\" ".$text_class.">x</a>"; ?></td>
+ <?php if ($id==$myMpd->current_track_id) { echo "</b>"; } ?>
+ </tr>
+
+ <?
+ }// foreach loop
+ if (($condPL) && ($myMpd->current_track_id+10 <= $myMpd->playlistcount))
+ {
+ echo "<tr class=\"".flip_class()."\"><td colspan=8 align=\"center\" style=\"padding: 3px 0px 3px 0px\">... Condensed Playlist ...</td></tr>";
+ }
+ } //else
+
+ $time = floor($totaltime/60) . ":" . sprintf("%02d", ($totaltime%60) );
+ $num = count($pl);
+
+ ?>
+
+ <tr class="table-header" valign=middle>
+ <input type="hidden" name="action" value="plact">
+ <td><button name="submit" value="submit" type="submit" style = "font-family: <?php echo conf('font')?>; font-size: <?php echo conf('font_size')?>px" title="Take Action on the checked songs">Do</button></td>
+ <td valign=middle><select name="todo" style = "font-family: <?php echo conf('font')?>; font-size: <?php echo conf('font_size')?>px" size=1>
+ <option>Delete
+ <!-- <option>move Next This isn't working yet -->
+ <option>Crop</select></td>
+ <td valign=middle><?php echo _("Total"); ?>:</td>
+ <td valign=middle><?php echo $num; ?> song(s)</td>
+ <td></td>
+ <td valign=middle align="right" <?php echo $minpad; ?> nowrap><?php echo $time; ?></td>
+ <td>&nbsp</td>
+ <td>&nbsp</td>
+<?php ?>
+ </tr>
+ </table></td></tr>
+</table>
+<br />
+</form>
+</td/>
+
diff --git a/templates/show_mpdplay.inc b/templates/show_mpdplay.inc
index aa390067..f88620f3 100644
--- a/templates/show_mpdplay.inc
+++ b/templates/show_mpdplay.inc
@@ -26,13 +26,18 @@
this looks a goodbit like local_play
*/
$web_path = conf('web_path');
+
+function fmt_time ($seconds) {return sprintf ("%d:%02d", $seconds/60, $seconds % 60);}
+
+global $condPL;
+
?>
<div align="center">
<table border="0" cellpadding="3" cellspacing="0">
<tr class="table-header">
<td colspan="2"><?php echo _("MPD Play Control"); ?></td>
</tr>
-<tr class="even"> <td>
+<tr class="even"><td>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td>
@@ -48,6 +53,15 @@ $web_path = conf('web_path');
</form>
</td>
</tr>
+<TR><TD CLASS="content">
+ Volume: <B><? echo $myMpd->volume ?>%</B>
+</TD></TR>
+
+ <TR><TD CLASS="content" ALIGN=CENTER>
+ [<A HREF="<?php echo $web_path; ?>/amp-mpd.php?action=setvol&val=0">mute</A>/<A HREF="<?php echo $web_path; ?>/amp-mpd.php?action=adjvol&val=-25">-25</A>/<A HREF="<?php echo $web_path; ?>/amp-mpd.php?action=adjvol&val=-10">-10</A>/<A HREF="<?php echo $web_path; ?>/amp-mpd.php?action=adjvol&val=+10">+10</A>/<A HREF="<?php echo $web_path; ?>/amp-mpd.php?action=adjvol&val=+25">+25</A>]
+ </TD></TR>
+<TR><TD>
+</TD></TR>
<tr>
<td>
<?php echo _("Loop"); ?>:
@@ -81,41 +95,68 @@ $web_path = conf('web_path');
</td>
</tr>
</table>
-</td>
- </tr>
+</tr>
+ </td>
<?php if ( $myMpd->state == MPD_STATE_PLAYING or $myMpd->state == MPD_STATE_PAUSED ) { ?>
<tr><td>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
- <td><?php echo _("Now Playing"); ?>: (<?php echo (round(($myMpd->current_track_position/$myMpd->current_track_length),2)*100) ?>% cmpl.)
- </td>
+ <td><b><?php echo _("Now Playing :")?><b></td>
</tr>
<tr>
- <td align="center"><?php echo $myMpd->playlist[$myMpd->current_track_id]['Artist']." - ".$myMpd->playlist[$myMpd->current_track_id]['Title'] ?></td>
+ <td align="center"><?php echo ($myMpd->current_track_id+1).
+ ". ".$myMpd->playlist[$myMpd->current_track_id]['Artist'].
+ " - ".$myMpd->playlist[$myMpd->current_track_id]['Title'].
+ " - ".$myMpd->playlist[$myMpd->current_track_id]['Album'].
+ " - ".fmt_time($myMpd->playlist[$myMpd->current_track_id]['Time'])
+ ?></td>
+ </tr>
+ <tr>
+ <td align="center"><?php echo fmt_time($myMpd->current_track_position)?> (<?php echo (round(($myMpd->current_track_position/$myMpd->current_track_length),2)*100)."%) played" ?></td>
+ </tr>
+ <tr>
+ <td><b><?php echo _("On Deck ")?><?php echo _("(in ").
+ fmt_time($myMpd->current_track_length - $myMpd->current_track_position).")" ?>
+ </b>
+ </td>
</tr>
- </table>
- </td></tr>
-<?php } ?>
-<tr>
- <td>
- <table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
- <td align="center">[ <a title="<?php echo _("Refresh the Playlist Window"); ?>" href="<?php echo conf('web_path'); if ($GLOBALS['user']->prefs['play_type'] == 'mpd' && conf('localplay_menu')) {echo "/mpd.php";} ?>"><?php echo _("refresh now"); ?></a> ]</td>
+ <td align="center"><?php echo ($myMpd->current_track_id+2).
+ ". ".$myMpd->playlist[($myMpd->current_track_id+1)]['Artist'].
+ " - ".$myMpd->playlist[($myMpd->current_track_id+1)]['Title'].
+ " - ".$myMpd->playlist[($myMpd->current_track_id+1)]['Album'].
+ " - ".fmt_time($myMpd->playlist[($myMpd->current_track_id+1)]['Time']);
+ ?></td>
</tr>
</table>
- </td>
-</tr>
+ </td></tr>
+<?php } ?>
</table>
+<?php /**************** Comment the playlist out now that the big playlist is done
+
<br />
-<table border="0" cellpadding="0" cellspacing="0" width="100%">
+<table border="0" cellpadding="0" cellspacing="0" WIDTH=<?php echo $PG_WIDTH ?>>
<tr><td align="center"><b><?php echo _("Server Playlist"); ?></b></td></tr>
- <tr><td>
+ <tr>
+ <td align="center"><i><a title="<?php echo _("Refresh the Playlist Window"); ?>" href="<?php echo conf('web_path'); ?>"><?php echo _("[refresh]"); ?></a>
+<?php if ( $myMpd->playlist_count > 0 ) { ?>
+ [<a title="<?php echo _("Click to shuffle (randomize) the playlist"); ?>" href="<?php echo conf('web_path'); ?>/amp-mpd.php?action=shuffle"><?php echo _("shuffle"); ?></a>]
+ [<a title="<?php echo _("Click the clear the playlist"); ?>" href="<?php echo conf('web_path'); ?>/amp-mpd.php?action=clear"><?php echo _("clear"); ?></a>]
+ [<a title="<?php echo _("Click the toggle condensed playlist"); ?>" href="<?php echo conf('web_path'); ?>/amp-mpd.php?action=condPL"><?php echo _("condensed"); ?></a>]
+<?php } ?>
+ </i></td>
+ </tr>
+ <tr><td align="left">
<?php
- $pl = $myMpd->GetPlaylist();
+$condPL= conf('condPL');
+ if ($condPL) echo " ... Condensed Playlist ... <br/>";
+ $pl = $myMpd->playlist;
if ( is_null($pl) ) echo "ERROR: " .$myMpd->errStr."\n";
else {
$maxlen = strlen(count($pl));
foreach ($pl as $id => $entry) {
+ if ( (!$condPL) or (($id >= $myMpd->current_track_id -1) && ($id <= $myMpd->current_track_id + 10)) )
+ {
$tblClass = ( $id == $myMpd->current_track_id ? "SongPlaying" : "Song" );
$track = $id+1;
@@ -127,12 +168,16 @@ $web_path = conf('web_path');
$len++;
}
- $song_name = truncate_with_ellipse($entry['Artist'],conf('ellipse_threshold_artist')-3) . " - " . truncate_with_ellipse($entry['Title'],conf('ellipse_threshold_title')-3);
+ $song_name = truncate_with_ellipse($entry['Artist'],conf('ellipse_threshold_artist')-3) . " - " . truncate_with_ellipse($entry['Title'],conf('ellipse_threshold_title')-3) . " - " . $entry['Album'] . " - " . fmt_time($entry['Time']);
echo "\t";
- echo " <a title=\"Click to remove ".htmlspecialchars($entry['Title'])."\" href=\"".conf('web_path')."/amp-mpd.php?action=rem&amp;id=".$id."\">[" . $track . "]</a>";
- echo " <a title=\"Click to jump to ".htmlspecialchars($entry['Title'])."\" href=\"".conf('web_path')."/amp-mpd.php?action=skipto&amp;val=".$id."\">$song_name</a>";
+ if ($myMpd->current_track_id == $id) echo "<b>";
+ echo "<a title=\"Click to remove '".$entry['Title']." '\" href=\"".conf('web_path')."/amp-mpd.php?action=rem&id=".$id."\">" . $track . ".</a>";
+ echo " <a title=\"Click to jump to '".$entry['Title']."'\" href='".conf('web_path')."/amp-mpd.php?action=skipto&val=".$id."'>$song_name</a>";
+ echo " <a title=\"file='".$entry['file']."'\" href=\"".conf('web_path')."\">f</a>";
+ if ($myMpd->current_track_id == $id) echo "</b>";
echo "<br />\n";
+ }
}
}
if ( $myMpd->playlist_count == 0 ) {
@@ -140,13 +185,6 @@ $web_path = conf('web_path');
}
?>
</td></tr>
-<?php if ( $myMpd->playlist_count > 0 ) { ?>
-<tr>
- <td align="center" height="20">
- [<a title="<?php echo _("Click to shuffle (randomize) the playlist"); ?>" href="<?php echo conf('web_path'); ?>/amp-mpd.php?action=shuffle"><?php echo _("shuffle"); ?></a>]
- [<a title="<?php echo _("Click the clear the playlist"); ?>" href="<?php echo conf('web_path'); ?>/amp-mpd.php?action=clear"><?php echo _("clear"); ?></a>]
- </td>
-</tr>
-<?php } ?>
</table>
+<?php *********************/ ?>
</div>