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