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