CGIs angepasst
[people/pmueller/ipfire-2.x.git] / html / cgi-bin / mpfire.cgi
1 #!/usr/bin/perl
2 ###############################################################################
3 # #
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2007 Michael Tremer & Christian Schmidt #
6 # #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
11 # #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
16 # #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
19 # #
20 ###############################################################################
21
22 use strict;
23 # enable only the following on debugging purpose
24 #use warnings;
25 #use CGI::Carp 'fatalsToBrowser';
26
27 require '/var/ipfire/general-functions.pl';
28 require "${General::swroot}/lang.pl";
29 require "${General::swroot}/header.pl";
30
31 my %color = ();
32 my %mainsettings = ();
33 my %mpfiresettings = ();
34 my %checked = ();
35 my $message = '0';
36 my $errormessage = "";
37
38 &General::readhash("${General::swroot}/main/settings", \%mainsettings);
39 &General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color);
40
41 if ( $ENV{'QUERY_STRING'} =~ /title/){
42 my $song = `/usr/local/bin/mpfirectrl song 2>/dev/null`;
43 if ( $song eq "" ){$song = "None";}
44 if ( length($song) > 125 ) {$song = substr($song,0,125)."...";}
45 &Header::showhttpheaders();
46 print"<meta http-equiv='refresh' content='30'>";
47 print <<END
48 <div class="body"><table width='95%' cellspacing='0'>
49 <tr bgcolor='$color{'color20'}'><td align='center'><font color=red><marquee behavior='alternate' scrollamount='1' scrolldelay='5'>-= $song =-</marquee></font></td></tr>
50 </table>
51 END
52 ;
53 }
54 else{
55
56 &Header::showhttpheaders();
57
58 sub refreshpage{&Header::openbox( 'Waiting', 1, "<meta http-equiv='refresh' content='1;' />" );print "<center><img src='/images/clock.gif' alt='' /><br/><font color='red'>$Lang::tr{'pagerefresh'}</font></center>";&Header::closebox();}
59
60 $mpfiresettings{'PAGE'} = "1";
61
62 open(DATEI, "<${General::swroot}/mpfire/db/mpd.db") || die "No Database found";
63 my @songdb = <DATEI>;
64 close(DATEI);
65
66 my @artist; my @album; my @genre; my @year; my $linecount = 0; my %songs;
67 my $key;my $file;my $Time;my $Artist;my $Title;my $Album;my $Track;my $Date;my $Genre;
68 foreach (@songdb){
69
70 if ( $_ =~ /mtime: / ){
71 $songs{$key}="$file|$Time|$Artist|$Title|$Album|$Track|$Date|$Genre";
72 push(@artist,$Artist);push(@album,$Album);push(@year,$Date);push(@genre,$Genre);
73 $key="";$file="";$Time="";$Artist="";$Title="";$Album="";$Track="";$Date="";$Genre="";
74 }
75 elsif ( $_ =~ /key: / ){my @temp = split(/: /,$_);$key=$temp[1];}
76 elsif ( $_ =~ /file: / ){my @temp = split(/: /,$_);$file=$temp[1];}
77 elsif ( $_ =~ /Time: / ){my @temp = split(/: /,$_);$Time=$temp[1];}
78 elsif ( $_ =~ /Artist: / ){my @temp = split(/: /,$_);$Artist=$temp[1];}
79 elsif ( $_ =~ /Title: / ){my @temp = split(/: /,$_);$Title=$temp[1];}
80 elsif ( $_ =~ /Album: / ){my @temp = split(/: /,$_);$Album=$temp[1];}
81 elsif ( $_ =~ /Track: / ){my @temp = split(/: /,$_);$Track=$temp[1];}
82 elsif ( $_ =~ /Date: / ){my @temp = split(/: /,$_);$Date=$temp[1];}
83 elsif ( $_ =~ /Genre: / ){my @temp = split(/: /,$_);$Genre=$temp[1];}
84 else {next;}
85 }
86
87 my %hash = map{ $_, 1 }@artist;
88 @artist = sort keys %hash;
89 my %hash = map{ $_, 1 }@album;
90 @album = sort keys %hash;
91 my %hash = map{ $_, 1 }@year;
92 @year = sort keys %hash;
93 my %hash = map{ $_, 1 }@genre;
94 @genre = sort keys %hash;
95
96 my $artistcount = $#artist+1;
97 my $albumcount = $#album+1;
98 my $yearcount = $#year+1;
99 my $genrecount = $#genre+1;
100
101 &Header::getcgihash(\%mpfiresettings);
102 &Header::openpage($Lang::tr{'mpfire'}, 1,);
103 &Header::openbigbox('100%', 'left', '', $errormessage);
104
105 ############################################################################################################################
106 ######################################## Scanne Verzeichnisse nach Mp3 Dateien #############################################
107
108 if ( $mpfiresettings{'ACTION'} eq "scan" )
109 {
110 delete $mpfiresettings{'__CGI__'};delete $mpfiresettings{'x'};delete $mpfiresettings{'y'};delete $mpfiresettings{'PAGE'};
111 &General::writehash("${General::swroot}/mpfire/settings", \%mpfiresettings);
112 open(DATEI, "<${General::swroot}/mpfire/mpd.conf") || die "Datei nicht gefunden";
113 my @Zeilen = <DATEI>;
114 close(DATEI);
115 open(DATEI, ">${General::swroot}/mpfire/mpd.conf") || die "Datei nicht gefunden";
116 foreach (@Zeilen){
117 if ( $_ =~ /music_directory/){print DATEI "music_directory \"".$mpfiresettings{'MUSICDIR'}."\"\n";}
118 else {print DATEI $_;}
119 }
120 close(DATEI);
121
122 $message=system("/usr/local/bin/mpfirectrl scan 2>/dev/null");
123 refreshpage();
124 }
125 elsif ( $mpfiresettings{'ACTION'} eq ">" ){$message=system("/usr/local/bin/mpfirectrl","play","\"$mpfiresettings{'FILE'}\"","2>/dev/null");}
126 elsif ( $mpfiresettings{'ACTION'} eq "x" ){$message=system("/usr/local/bin/mpfirectrl stop 2>/dev/null");}
127 elsif ( $mpfiresettings{'ACTION'} eq "|>" ){$message=system("/usr/local/bin/mpfirectrl toggle 2>/dev/null");}
128 elsif ( $mpfiresettings{'ACTION'} eq "<<" ){$message=system("/usr/local/bin/mpfirectrl prev 2>/dev/null");}
129 elsif ( $mpfiresettings{'ACTION'} eq ">>" ){$message=system("/usr/local/bin/mpfirectrl next 2>/dev/null");}
130 elsif ( $mpfiresettings{'ACTION'} eq "+" ){$message=system("/usr/local/bin/mpfirectrl volup 5 2>/dev/null");}
131 elsif ( $mpfiresettings{'ACTION'} eq "-" ){$message=system("/usr/local/bin/mpfirectrl voldown 5 2>/dev/null");}
132 elsif ( $mpfiresettings{'ACTION'} eq "++" ){$message=system("/usr/local/bin/mpfirectrl volup 10 2>/dev/null");}
133 elsif ( $mpfiresettings{'ACTION'} eq "--" ){$message=system("/usr/local/bin/mpfirectrl voldown 10 2>/dev/null");}
134 elsif ( $mpfiresettings{'ACTION'} eq "playweb" ){$message=system("/usr/local/bin/mpfirectrl","playweb","\"$mpfiresettings{'FILE'}\"","2>/dev/null");}
135 elsif ( $mpfiresettings{'ACTION'} eq "playlist" ){$message=system("/usr/local/bin/mpfirectrl playlist 2>/dev/null");}
136 elsif ( $mpfiresettings{'ACTION'} eq "emptyplaylist" ){$message=system("/usr/local/bin/mpfirectrl clearplaylist 2>/dev/null");}
137 elsif ( $mpfiresettings{'ACTION'} eq "addtoplaylist" ){$message=system("/usr/local/bin/mpfirectrl","playadd","\"$mpfiresettings{'FILE'}\"","2>/dev/null");}
138 elsif ( $mpfiresettings{'ACTION'} eq "playall" ){
139 my @temp = ""; my @song = "";
140
141 foreach (keys(%songs)){
142 @song = split(/\|/,$songs{$_});push(@temp,$song[0])
143 }
144 open(DATEI, ">${General::swroot}/mpfire/playlist.m3u") || die "Could not add playlist";
145 print DATEI @temp;
146 close(DATEI);
147
148 $message=system("/usr/local/bin/mpfirectrl playlist 2>/dev/null");
149 }
150 elsif ( $mpfiresettings{'ACTION'} eq "playalbum" )
151 {
152 my @temp = ""; my @song = ""; my @select = split(/\|/,$mpfiresettings{'album'});
153
154 foreach (keys(%songs)){
155 @song = split(/\|/,$songs{$_});$song[4] =~ s/\W/ /g;
156
157 foreach (@select){
158 $_ =~ s/\W/ /g;
159 if ( $song[4] =~ /$_/ ){push(@temp,$song[0]);}
160 }
161 }
162
163 open(DATEI, ">${General::swroot}/mpfire/playlist.m3u") || die "Could not add playlist";
164 print DATEI @temp;
165 close(DATEI);
166 $message=system("/usr/local/bin/mpfirectrl playlist 2>/dev/null");
167 }
168 elsif ( $mpfiresettings{'ACTION'} eq "playartist" )
169 {
170 my @temp = ""; my @song = ""; my @select = split(/\|/,$mpfiresettings{'artist'});
171
172 foreach (keys(%songs)){
173 @song = split(/\|/,$songs{$_});$song[2] =~ s/\W/ /g;
174
175 foreach (@select){
176 $_ =~ s/\W/ /g;
177 if ( $song[2] =~ /$_/ ){push(@temp,$song[0]);}
178 }
179 }
180
181 open(DATEI, ">${General::swroot}/mpfire/playlist.m3u") || die "Could not add playlist";
182 print DATEI @temp;
183 close(DATEI);
184 $message=system("/usr/local/bin/mpfirectrl playlist 2>/dev/null");
185 }
186 elsif ( $mpfiresettings{'ACTION'} eq "playyear" )
187 {
188 my @temp = ""; my @song = ""; my @select = split(/\|/,$mpfiresettings{'year'});
189
190 foreach (keys(%songs)){
191 @song = split(/\|/,$songs{$_});$song[6] =~ s/\W/ /g;
192
193 foreach (@select){
194 $_ =~ s/\W/ /g;
195 if ( $song[6] =~ /$_/ ){push(@temp,$song[0]);}
196 }
197 }
198
199 open(DATEI, ">${General::swroot}/mpfire/playlist.m3u") || die "Could not add playlist";
200 print DATEI @temp;
201 close(DATEI);
202 $message=system("/usr/local/bin/mpfirectrl playlist 2>/dev/null");
203 }
204 elsif ( $mpfiresettings{'ACTION'} eq "playgenre" )
205 {
206 my @temp = ""; my @song = ""; my @select = split(/\|/,$mpfiresettings{'genre'});
207
208 foreach (keys(%songs)){
209 @song = split(/\|/,$songs{$_});$song[7] =~ s/\W/ /g;
210
211 foreach (@select){
212 $_ =~ s/\W/ /g;
213 if ( $song[7] =~ /$_/ ){push(@temp,$song[0]);}
214 }
215 }
216
217 open(DATEI, ">${General::swroot}/mpfire/playlist.m3u") || die "Could not add playlist";
218 print DATEI @temp;
219 close(DATEI);
220 $message=system("/usr/local/bin/mpfirectrl playlist 2>/dev/null");
221 }
222 elsif ( $mpfiresettings{'SHOWLIST'} ){delete $mpfiresettings{'__CGI__'};delete $mpfiresettings{'x'};delete $mpfiresettings{'y'};delete $mpfiresettings{'PAGE'};&General::writehash("${General::swroot}/mpfire/settings", \%mpfiresettings);refreshpage();}
223
224 ############################################################################################################################
225 ################################### Aufbau der HTML Seite fr globale Sambaeinstellungen ####################################
226
227 $mpfiresettings{'MUSICDIR'} = "/";
228
229 &General::readhash("${General::swroot}/mpfire/settings", \%mpfiresettings);
230
231 ############################################################################################################################
232 ########################################### rekursiv nach neuen Mp3s Scannen ##############################################รค
233
234 if ( $message ne '0' ) { print "<font color='red'>An Error occured while launching the command</font>"; }
235 elsif ( $message ne "" && $message ne '0' ) { print "<font color='red'>$message</font>"; }
236
237 &Header::openbox('100%', 'center', $Lang::tr{'mpfire scanning'});
238
239 print <<END
240 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
241 <table width='95%' cellspacing='0'>
242 <tr bgcolor='$color{'color20'}'><td colspan='2' align='left'><b>$Lang::tr{'Scan for Files'}</b></td></tr>
243 <tr><td align='left' width='40%'>$Lang::tr{'Scan from Directory'}</td><td align='left'><input type='text' name='MUSICDIR' value='$mpfiresettings{'MUSICDIR'}' size="50" /></td></tr>
244 <tr><td align='center' colspan='2'><input type='hidden' name='ACTION' value='scan' />
245 <input type='image' alt='$Lang::tr{'Scan for Files'}' title='$Lang::tr{'Scan for Files'}' src='/images/edit-find.png' /></td></tr>
246 </table>
247 </form>
248 END
249 ;
250 &Header::closebox();
251
252 my $Volume = `/usr/local/bin/mpfirectrl volume 2>/dev/null`;
253 $Volume=~s/<break>/<br \/>/g;
254 my $stats = `mpc stats | tail -4 2>/dev/null`;
255 $stats=~s/\\/<br \/>/g
256
257 &Header::openbox('100%', 'center', $Lang::tr{'mpfire controls'});
258 print <<END
259
260 <table width='95%' cellspacing='0'>
261 <iframe height='30' width='100%' src='/cgi-bin/mpfire.cgi?title' scrolling='no' frameborder='no' ></iframe>
262 END
263 ;
264 my $countsongs=`/usr/local/bin/mpfirectrl stats 2>/dev/null`;
265 print "<tr><td colspan='5' align='center'><br/><b>".$countsongs."</b><br/><br/></td></tr>";
266 print <<END
267 <tr>
268 <td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='x' /><input type='image' alt='$Lang::tr{'stop'}' title='$Lang::tr{'stop'}' src='/images/media-playback-stop.png' /></form></td>
269 <td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='<<' /><input type='image' alt='$Lang::tr{'prev'}' title='$Lang::tr{'prev'}' src='/images/media-skip-backward.png' /></form></td>
270 <td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='|>' /><input type='image' alt='$Lang::tr{'toggle'}' title='$Lang::tr{'toggle'}' src='/images/media-resume.png' /></form></td>
271 <td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='playall' /><input type='image' alt='$Lang::tr{'play'}' title='$Lang::tr{'play'}' src='/images/media-playback-start.png' /></form></td>
272 <td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='>>' /><input type='image' alt='$Lang::tr{'next'}' title='$Lang::tr{'next'}' src='/images/media-skip-forward.png' /></form></td>
273 </tr>
274 END
275 ;
276 if ( $mpfiresettings{'SHOWLIST'} eq "on" ){print"<tr><td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='SHOWLIST' value='off' /><input type='image' alt='$Lang::tr{'off'}' title='$Lang::tr{'off'}' src='/images/audio-x-generic.png' /></form></td>";}
277 else { print"<tr><td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='SHOWLIST' value='on' /><input type='image' alt='$Lang::tr{'on'}' title='$Lang::tr{'on'}' src='/images/audio-x-generic-red.png' /></form></td>";}
278 print <<END
279 <td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='--' /><input type='image' alt='$Lang::tr{'voldown10'}' title='$Lang::tr{'voldown10'}' src='/images/audio-volume-low-red.png' /></form></td>
280 <td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='-' /><input type='image' alt='$Lang::tr{'voldown5'}' title='$Lang::tr{'voldown5'}' src='/images/audio-volume-low.png' /></form></td>
281 <td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='+' /><input type='image' alt='$Lang::tr{'volup5'}' title='$Lang::tr{'volup5'}' src='/images/audio-volume-high.png' /></form></td>
282 <td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='++' /><input type='image' alt='$Lang::tr{'volup10'}' title='$Lang::tr{'volup10'}' src='/images/audio-volume-high-red.png' /></form></td>
283 </tr>
284 <tr><td colspan='5' align='center'>$Volume</td></tr>
285 <tr><td colspan='5' align='center'><br />$stats</td></tr>
286 </table>
287 END
288 ;
289 &Header::closebox();
290
291 &Header::openbox('100%', 'center', $Lang::tr{'quick playlist'});
292
293 print "<table width='95%' cellspacing='0'>";
294 if ( $#songdb eq '-1' ) {print "<tr><td align='center' bgcolor='$color{'color20'}'><b>$Lang::tr{'artist'}</b></td><td align='center' bgcolor='$color{'color20'}'><b>$Lang::tr{'album'}</b></td></tr>";}
295 else {print "<tr><td align='center' bgcolor='$color{'color20'}'><b>$Lang::tr{'artist'} - ".$artistcount."</b></td><td align='center' bgcolor='$color{'color20'}'><b>$Lang::tr{'album'} - ".$albumcount."</b></td></tr>";}
296 print <<END
297 <tr><td align='center'>
298 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
299 <select name='artist' size='8' multiple='multiple' style='width:300px;'>
300 END
301 ;
302 foreach (@artist){if ( $_ ne '' ){print "<option>$_</option>";}}
303 print <<END
304 </select><br/>
305 <input type='hidden' name='ACTION' value='playartist' />
306 <input type='image' alt='$Lang::tr{'play'}' title='$Lang::tr{'play'}' src='/images/media-playback-start.png' />
307 </form></td>
308 <td align='center'>
309 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
310 <select name='album' size='8' multiple='multiple' style='width:300px;'>
311 END
312 ;
313 foreach (@album){if ( $_ ne '' ){print "<option>$_</option>";}}
314 print <<END
315 </select><br/>
316 <input type='hidden' name='ACTION' value='playalbum' />
317 <input type='image' alt='$Lang::tr{'play'}' title='$Lang::tr{'play'}' src='/images/media-playback-start.png' />
318 </form></td>
319 </tr>
320 END
321 ;
322 if ( $#songdb eq '-1' ) {print "<tr><td align='center' bgcolor='$color{'color20'}'><b>$Lang::tr{'year'}</b></td><td align='center' bgcolor='$color{'color20'}'><b>$Lang::tr{'genre'}</b></td></tr>";}
323 else {print "<tr><td align='center' bgcolor='$color{'color20'}'><b>$Lang::tr{'year'} - ".$yearcount."</b></td><td align='center' bgcolor='$color{'color20'}'><b>$Lang::tr{'genre'} - ".$genrecount."</b></td></tr>";}
324 print <<END
325 <tr><td align='center'>
326 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
327 <select name='year' size='8' multiple='multiple' style='width:300px;'>
328 END
329 ;
330 foreach (@year){if ( $_ ne '' ){print "<option>$_</option>";}}
331 print <<END
332 </select><br/>
333 <input type='hidden' name='ACTION' value='playyear' />
334 <input type='image' alt='$Lang::tr{'play'}' title='$Lang::tr{'play'}' src='/images/media-playback-start.png' />
335 </form></td>
336 <td align='center'>
337 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
338 <select name='genre' size='8' multiple='multiple' style='width:300px;'>
339 END
340 ;
341 foreach (@genre){if ( $_ ne '' ){print "<option>$_</option>";}}
342 print <<END
343 </select><br/>
344 <input type='hidden' name='ACTION' value='playgenre' />
345 <input type='image' alt='$Lang::tr{'play'}' title='$Lang::tr{'play'}' src='/images/media-playback-start.png' />
346 </form></td>
347 </tr></table>
348 END
349 ;
350 &Header::closebox();
351
352 if ( $mpfiresettings{'SHOWLIST'} eq "on" ){
353
354 &Header::openbox('100%', 'center', $Lang::tr{'mpfire songs'});
355 print <<END
356 <a name="$Lang::tr{'mpfire songs'}"</a>
357 <table width='95%' cellspacing='5'>
358 <tr bgcolor='$color{'color20'}'><td colspan='9' align='left'><b>$Lang::tr{'Existing Files'}</b></td></tr>
359 <tr><td align='center' colspan='9'><br/>$Lang::tr{'Pages'}<br/><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='submit' name='PAGE' value='all' /><br/>
360 END
361 ;
362 my $pages =(int(keys(%songs)/100)+1);
363 for(my $i = 1; $i <= $pages; $i++) {
364 print "<input type='submit' name='PAGE' value='$i' />";
365 if (!($i % 205)){print"<br/>";}
366 }
367 print <<END
368 </form></td></tr>
369 <tr><td align='center'></td>
370 <td align='center'><b>$Lang::tr{'artist'}<br/>$Lang::tr{'title'}</b></td>
371 <td align='center'><b>$Lang::tr{'number'}</b></td>
372 <td align='center'><b>$Lang::tr{'album'}</b></td>
373 <td align='center'><b>$Lang::tr{'year'}</b></td>
374 <td align='center'><b>$Lang::tr{'genre'}</b></td>
375 <td align='center'><b>$Lang::tr{'length'}</b></td></tr>
376 END
377 ;
378 my $lines=0;my $i=0;my $begin;my $end;
379 if ( $mpfiresettings{'PAGE'} eq 'all' ){
380 $begin=0;
381 $end=keys(%songs);
382 }
383 else{
384 $begin=(($mpfiresettings{'PAGE'}-1) * 100);
385 $end=(($mpfiresettings{'PAGE'} * 100)-1);
386 }
387 foreach (keys(%songs)){
388 if (!($i >= $begin && $i <= $end)){
389 # print $begin."->".$i."<-".$end."\n";
390 $i++;next;}
391 my @song = split(/\|/,$songs{$_});
392 my $minutes = sprintf ("%.0f", $song[1] / 60 );
393 my $seconds = $song[1] % 60;
394
395 if ($lines % 2) {print "<tr bgcolor='$color{'color20'}'>";} else {print "<tr bgcolor='$color{'color22'}'>";}
396 print <<END
397 <td align='center' style="white-space:nowrap;"><form method='post' action='$ENV{'SCRIPT_NAME'}#$Lang::tr{'mpfire songs'}'><input type='hidden' name='ACTION' value='addtoplaylist' /><input type='hidden' name='FILE' value="$song[0]" /><input type='image' alt='$Lang::tr{'add'}' title='$Lang::tr{'add'}' src='/images/list-add.png' /></form><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='>' /><input type='hidden' name='FILE' value="$song[0]" /><input type='image' alt='$Lang::tr{'play'}' title='$Lang::tr{'play'}' src='/images/media-playback-start.png' /></form></td>
398 <td align='center'>$song[2]<br/>$song[3]</td>
399 <td align='center'>$song[5]</td>
400 <td align='center'>$song[4]</td>
401 <td align='center'>$song[6]</td>
402 <td align='center'>$song[7]</td>
403 <td align='center'>$minutes:$seconds</td></tr>
404 END
405 ;
406 $lines++;
407 $i++;
408 }
409 print "</table>";
410 &Header::closebox();
411 }
412
413 &Header::openbox('100%', 'center', $Lang::tr{'mpfire playlist'});
414
415 my @playlist = `mpc playlist 2>/dev/null`;
416
417 print <<END
418 <table width='95%' cellspacing='0'>
419 <tr bgcolor='$color{'color20'}'><td colspan='2' align='left'><b>$Lang::tr{'current playlist'}</b></td></tr>
420 <tr><td align='center' colspan='2' ><textarea cols='100' rows='10' name='playlist' style='font-size:11px;width:650px;' readonly='readonly'>
421 END
422 ;
423 foreach (@playlist){print $_;}
424 print <<END
425 </textarea></td></tr><tr>
426 <td align='right'>
427 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
428 <input type='hidden' name='ACTION' value='emptyplaylist' />
429 <input type='image' alt='$Lang::tr{'clear playlist'}' title='$Lang::tr{'clear playlist'}' src='/images/user-trash.png' />
430 </form>
431 </td>
432 <td align='left'>
433 <form method='post' action='$ENV{'SCRIPT_NAME'}'>
434 <input type='hidden' name='ACTION' value='playlist' />
435 <input type='image' alt='$Lang::tr{'play'}' title='$Lang::tr{'play'}' src='/images/media-playback-start.png' />
436 </form>
437 </td></tr>
438 </table>
439 END
440 ;
441 &Header::closebox();
442
443 &Header::openbox('100%', 'center', $Lang::tr{'mpfire webradio'});
444
445 open(DATEI, "<${General::swroot}/mpfire/webradio") || die "Could not open playlist";
446 my @webradio = <DATEI>;
447 close(DATEI);
448
449 print <<END
450 <table width='95%' cellspacing='0'>
451 <tr bgcolor='$color{'color20'}'><td colspan='9' align='left'><b>$Lang::tr{'webradio playlist'}</b></td></tr>
452 <tr><td>Stream</td><td colspan='2'></td></tr>
453 END
454 ;
455 foreach (@webradio){
456 my @stream = split(/\|/,$_);
457 print <<END
458 <tr><td><a href="$stream[2]" target="_blank">$stream[1]</a></td>
459 <td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='FILE' value='$stream[0]' /><input type='hidden' name='ACTION' value='playweb' /><input type='image' alt='$Lang::tr{'play'}' title='$Lang::tr{'play'}' src='/images/media-playback-start.png' /></form></td>
460 </tr>
461 END
462 ;
463 }
464 print "</table>";
465 &Header::closebox();
466
467 &Header::closebigbox();
468 &Header::closepage();
469 }