1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
|
<?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');
function fmt_time ($seconds) {return sprintf ("%d:%02d", $seconds/60, $seconds % 60);}
global $condPL;
?>
<div align="center">
<table border="0" cellpadding="3" cellspacing="0" class="tabledata">
<tr class="table-header">
<td colspan="2"><?php echo _("MPD Play Control"); ?></td>
</tr>
<tr class="even"><td>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td>
<?php
${$myMpd->state} = "style=\"background-color: black;color:white;\"";
?>
<form action="<?php echo $web_path; ?>/amp-mpd.php" method="post" name="playcontrol" style="display:inline; white-space: nowrap">
<input class="button" type="submit" title="<?php echo _("Prev"); ?>" name="action" value="|< " />
<input class="button" type="submit" title="<?php echo _("Stop"); ?>" name="action" value=" X " <?php echo $stop; ?> />
<input class="button" type="submit" title="<?php echo _("Play"); ?>" name="action" value=" > " <?php echo $play; ?> />
<input class="button" type="submit" title="<?php echo _("Pause"); ?>" name="action" value=" | | " <?php echo $pause; ?> />
<input class="button" type="submit" title="<?php echo _("Next"); ?>" name="action" value= " >|" />
</form>
</td>
</tr>
<tr><td class="content">
Volume: <b><?php 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"); ?>:
<form action="<?php echo $web_path; ?>/amp-mpd.php?action=loop" method="post" name="repeatcontrol" style="display:inline;">
<?php
$repeat_name = "repeat_" . intval($myMpd->repeat);
${$repeat_name} = "style=\"background-color: black;color:white;\"";
?>
<input class="button" type="submit" title="<?php echo _("On"); ?>" name="val" value="On" <?php echo $repeat_1; ?> />
<input class="button" type="submit" title="<?php echo _("Off"); ?>" name="val" value="Off" <?php echo $repeat_0; ?> />
</form>
</td>
</tr>
<tr>
<td>
<?php echo _("Random"); ?>:
<form action="<?php echo $web_path; ?>/amp-mpd.php?action=random" method="post" name="randomcontrol" style="display:inline;">
<?php
$random_name = "random_" . intval($myMpd->random);
${$random_name} = "style=\"background-color: black;color:white;\"";
?>
<input class="button" type="submit" title="<?php echo _("On"); ?>" name="val" value="On" <?php echo $random_1; ?> />
<input class="button" type="submit" title="<?php echo _("Off"); ?>" name="val" value="Off" <?php echo $random_0; ?> />
</form>
</td>
</tr>
<tr>
<td class="content">
</td>
</tr>
</table>
</td></tr>
<?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 class="npsong"><b><?php echo _("Now Playing :")?></b></td>
</tr>
<tr>
<td align="center" class="npsong"><?php
if (!$myMpd->playlist[($myMpd->current_track_id)]['Title']) {
list($tmp, $id, $tmp) = preg_split("/(song=|&)/", $myMpd->playlist[($myMpd->current_track_id)]['file']);
$r = new Song($id);
$myMpd->playlist[($myMpd->current_track_id)]['Title'] = $r->title;
$myMpd->playlist[($myMpd->current_track_id)]['Artist'] = $r->get_artist_name();
$myMpd->playlist[($myMpd->current_track_id)]['Album'] = $r->get_album_name();
}
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" class="npsong"><span id="mpd_cur_track_pos"><?php echo fmt_time($myMpd->current_track_position)?></span> (<?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 ").
"<span id = 'mpd_on_deck_in'>".fmt_time($myMpd->current_track_length - $myMpd->current_track_position)."</span>)"?>
</b>
</td>
</tr>
<tr>
<td align="center"><?php
if (!$myMpd->playlist[($myMpd->current_track_id+1)]['Title']) {
list($tmp, $id, $tmp) = preg_split("/(song=|&)/", $myMpd->playlist[($myMpd->current_track_id+1)]['file']);
$r = new Song($id);
$myMpd->playlist[($myMpd->current_track_id+1)]['Title'] = $r->title;
$myMpd->playlist[($myMpd->current_track_id+1)]['Artist'] = $r->get_artist_name();
$myMpd->playlist[($myMpd->current_track_id+1)]['Album'] = $r->get_album_name();
}
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>
<?php } ?>
</table>
<?php
echo '<script language="JavaScript" type="text/javascript"> var mpd_elapsed = '. $myMpd->current_track_position.' </script>';
echo '<script language="JavaScript" type="text/javascript"> var mpd_song_length = '. $myMpd->current_track_length .' </script>';
echo '<script language="JavaScript" type="text/javascript"> var mpd_state = "'. $myMpd->state .'" </script>';
?>
</div>
|