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