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