my $filename = "";
my %songs = "";
-my $debug = 0;
+my $debug = 1;
if ($ARGV[0] eq 'scan') {
my $command = "find ";
if ($ARGV[0] eq 'stop') {
my $PID = `ps -ef | grep mpg123 | grep playlist | head -1 | awk '{ print \$2 }'`;
- if ($debug){print "Stopping $PID\n";}
- system("kill -KILL $PID");
+ if ( $PID ne "" ){
+ if ($debug){print "Stopping $PID\n";}
+ system("kill -KILL $PID");
+ }
+ else {&stopweb();}
}
if ($ARGV[0] eq 'volup') {
system("kill -SIGINT $PID");
}
+if ($ARGV[0] eq 'song') {
+ my $song = `lsof -nX \| grep mpg123 \| grep REG \| grep mem | grep mp3`;
+ my @song = split(/\//,$song);
+ my $i = @song;
+ print $song[$i-1];
+ }
+
+if ($ARGV[0] eq 'playweb') {
+ &General::readhash("${General::swroot}/proxy/settings", \%proxysettings);
+ if ($debug){print "Playing webstream\n";}
+ if ($proxysettings{'UPSTREAM_PROXY'}) {
+ if ($proxysettings{'UPSTREAM_USER'}) {
+ system("wget -qO - `wget -qO - $ARGV[1]` | mpg123 -b 1024 --aggressive -Zq - -p $proxysettings{'UPSTREAM_USER'}:$proxysettings{'UPSTREAM_PASSWORD'}@$proxysettings{'UPSTREAM_PROXY'} 2>/dev/null >/dev/null &");
+ }
+ else { system("wget -qO - `wget -qO - $ARGV[1]` | mpg123 -b 1024 --aggressive -Zq - -p $proxysettings{'UPSTREAM_PROXY'} 2>/dev/null >/dev/null &");}
+ } else {
+ system("wget -qO - `wget -qO - $ARGV[1]` | mpg123 -b 1024 --aggressive -Zq - 2>/dev/null >/dev/null &");
+ }
+ }
+
+if ($ARGV[0] eq 'stopweb') {
+ &stopweb();
+ }
+
+sub stopweb(){
+ my $PID = `ps -ef | grep wget | grep EXTM3U | head -1 | awk '{ print \$2 }'`;
+ if ($debug){print "Stopping $PID\n";}
+ system("kill -KILL $PID");
+ my $PID = `ps -ef | grep "mpg123 -b 1024 --aggressive -Zq -" | head -1 | awk '{ print \$2 }'`;
+ if ($debug){print "Killing Process $PID\n";}
+ system("kill -KILL $PID");
+ }
+
sub getSongInfo(){
my $mp3 = MP3::Tag->new($filename);
my ($title, $track, $artist, $album, $comment, $year, $genre) = $mp3->autoinfo();
--- /dev/null
+http://www.89.0rtl.de/webradio/rtl-high.m3u|89.0 RTL Hitradio
+http://metafiles.gl-systemhaus.de/wdr/channel_einslive.m3u|Einslive
+http://www.deepinside.co.uk/ecoute-deepinside-wmp.m3u|Deepinside Radio European
+http://www.bigfm.de/webradio/bigfm-high.m3u|BigFM
+http://www.brocken.de/webradio/brocken-high.m3u|Hit-Radio Brocken
WARNING: translation string unused: use
WARNING: translation string unused: used memory
WARNING: translation string unused: used swap
-WARNING: translation string unused: user cpu
WARNING: translation string unused: user cpu usage
WARNING: translation string unused: view log
WARNING: translation string unused: vpn on blue
&Header::showhttpheaders();
&Header::getcgihash(\%mpfiresettings);
-&Header::openpage($Lang::tr{'mpfire'}, 1, '');
+&Header::openpage($Lang::tr{'mpfire'}, 1, "<meta http-equiv='refresh' content='120'>");
&Header::openbigbox('100%', 'left', '', $errormessage);
-sub refreshpage{&Header::openbox( 'Waiting', 1, "<meta http-equiv='refresh' content='1;'>" );}
-
############################################################################################################################
######################################## Scanne Verzeichnisse nach Mp3 Dateien #############################################
system("/usr/local/bin/mpfirectrl scan $mpfiresettings{'SCANDIR'} $mpfiresettings{'SCANDIRDEPS'}");
}
-if ( $mpfiresettings{'ACTION'} eq ">" ){system("/usr/local/bin/mpfirectrl","play","\"$mpfiresettings{'FILE'}\""); print $mpfiresettings{'FILE'};}
+if ( $mpfiresettings{'ACTION'} eq ">" ){system("/usr/local/bin/mpfirectrl","play","\"$mpfiresettings{'FILE'}\"");}
if ( $mpfiresettings{'ACTION'} eq "x" ){system("/usr/local/bin/mpfirectrl stop");}
if ( $mpfiresettings{'ACTION'} eq "||" ){system("/usr/local/bin/mpfirectrl pause");}
if ( $mpfiresettings{'ACTION'} eq "|>" ){system("/usr/local/bin/mpfirectrl resume");}
if ( $mpfiresettings{'ACTION'} eq ">>" ){system("/usr/local/bin/mpfirectrl next");}
+if ( $mpfiresettings{'ACTION'} eq "stopweb" ){system("/usr/local/bin/mpfirectrl stopweb");}
+if ( $mpfiresettings{'ACTION'} eq "playweb" ){system("/usr/local/bin/mpfirectrl","playweb","\"$mpfiresettings{'FILE'}\"");}
if ( $mpfiresettings{'ACTION'} eq "+" ){system("/usr/local/bin/mpfirectrl volup 5");}
if ( $mpfiresettings{'ACTION'} eq "-" ){system("/usr/local/bin/mpfirectrl voldown 5");}
if ( $mpfiresettings{'ACTION'} eq "++" ){system("/usr/local/bin/mpfirectrl volup 10");}
if ( $message ne "" ) { print "<font color='red'>$message</font>"; }
&Header::openbox('100%', 'center', $Lang::tr{'mpfire scanning'});
-
+
print <<END
<form method='post' action='$ENV{'SCRIPT_NAME'}'>
<table width='95%' cellspacing='0'>
;
&Header::closebox();
+my $song = qx(/usr/local/bin/mpfirectrl song);
+if ( $song eq "" ){$song = "None";}
+
&Header::openbox('100%', 'center', $Lang::tr{'mpfire controls'});
-print "<table width='95%' cellspacing='0'><tr>";
+print "<table width='95%' cellspacing='0'><tr bgcolor='$color{'color20'}'><td colspan='5' align='center'><marquee behavior='alternate' scrollamount='1' scrolldelay='5'><font color=red>-= $song =-</font></marquee></td></tr><tr><td colspan='5'><br/></td></tr><tr>";
print <<END
<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>
<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>
&Header::openbox('100%', 'center', $Lang::tr{'mpfire playlist'});
-;
-
open(DATEI, "<${General::swroot}/mpfire/playlist") || die "Could not open playlist";
my @playlist = <DATEI>;
close(DATEI);
;
&Header::closebox();
+&Header::openbox('100%', 'center', $Lang::tr{'mpfire webradio'});
+
+open(DATEI, "<${General::swroot}/mpfire/webradio") || die "Could not open playlist";
+my @webradio = <DATEI>;
+close(DATEI);
+
+print <<END
+<table width='95%' cellspacing='0'>
+<tr bgcolor='$color{'color20'}'><td colspan='9' align='left'><b>$Lang::tr{'webradio playlist'}</b></td></tr>
+<tr><td>Stream</td><td colspan='2'></td></tr>
+END
+;
+foreach (@webradio){
+ my @stream = split(/\|/,$_);
+ print <<END
+ <tr><td>$stream[1]</td>
+ <td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'><input type='hidden' name='ACTION' value='stopweb' /><input type='image' alt='$Lang::tr{'stop'}' title='$Lang::tr{'stop'}' src='/images/media-playback-stop.png' /></form></td>
+ <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>
+</tr>
+END
+;
+ }
+print "</table>";
+&Header::closebox();
+
&Header::closebigbox();
&Header::closepage();
print "<img src='/images/updxl-src-avast.gif' alt='Avast'}' /> </td>\n";
} elsif ($metadata[1] eq 'IPFire')
{
- print "<img src='/images/updxl-src-ipfire.gif' alt='IPFire'}' /> </td>\n";
+ print "<img src='/images/IPFire.png' width='18' height='18' alt='IPFire'}' /> </td>\n";
} elsif ($metadata[1] eq 'Linux')
{
- print "<img src='/images/updxl-src-linux.gif' alt='Linux'}' /> </td>\n";
+ print "<img src='/images/tux.png' alt='Linux'}' /> </td>\n";
} else
{
print "<img src='/images/updxl-src-unknown.gif' alt='$Lang::tr{'updxlrtr unknown'}' /> </td>\n";
</tr>
<tr>
<td class='base' colspan='2'> </td>
- <td align='center'><img src='/images/updxl-src-ipfire.gif' alt='IPFire' /></td>
+ <td align='center'><img src='/images/IPFire.png' width='18' height='18' alt='IPFire' /></td>
<td class='base'>IPFire</td>
<td class='base'> </td>
- <td align='center'><img src='/images/updxl-src-linux.gif' alt='Linux' /></td>
+ <td align='center'><img src='/images/tux.png' alt='Linux' /></td>
<td class='base'>Linux</td>
<td class='base'> </td>
<td align='center'><img src='/images/updxl-src-avast.gif' alt='Avast' /></td>
'mpfire playlist' => 'MPFire Playlist',
'mpfire scanning' => 'Nach neuen Dateien suchen',
'mpfire songs' => 'MPFire Songliste',
+'mpfire webradio' => 'MPFire Webradio',
'my new share' => 'Meine neue Freigabe',
'name' => 'Name',
'name is invalid' => 'Name ist ungültig',
'used memory' => 'Genutzter Speicher',
'used swap' => 'Genutzter Swap',
'user' => 'Benutzer',
-'user cpu' => 'Benutzer CPU Nutzung',
-'user cpu usage' => 'Benutzer CPU',
+'user cpu usage' => 'Benutzer CPU Nutzung',
'user log' => 'Benutzer Log',
'user proxy logs' => 'Benutzer Proxy Log',
'username' => 'Benutzername:',
'web proxy' => 'Web-Proxy',
'web proxy configuration' => 'Web-Proxy-Konfiguration',
'web server' => 'Web-Server',
+'webradio playlist' => 'Webradio Playlist',
'website' => 'Website',
'wednesday' => 'Mittwoch',
'week' => 'Woche',
'mpfire playlist' => 'MPFire Playlist',
'mpfire scanning' => 'Scan for new files',
'mpfire songs' => 'MPFire songlist',
+'mpfire webradio' => 'MPFire Webradio',
'my new share' => 'My new share',
'name' => 'Name',
'name is invalid' => 'Name is invalid',
'web proxy' => 'Web proxy',
'web proxy configuration' => 'Web proxy configuration',
'web server' => 'Web server',
+'webradio playlist' => 'Webradio Playlist',
'website' => 'Website',
'wednesday' => 'Wednesday',
'week' => 'Week',
touch /var/ipfire/mpfire/db/songs.db
chown nobody.nobody /var/ipfire/mpfire/{settings,playlist}
install -v -m 755 $(DIR_SRC)/config/mpfire/mpfire.pl /var/ipfire/mpfire/bin
+ install -v -m 644 $(DIR_SRC)/config/mpfire/webradio /var/ipfire/mpfire/
@$(POSTBUILD)
boot_mesg "Starting DHCP Server..."
loadproc /usr/sbin/dhcpd -q ${devices}
- (sleep 20 && chmod 644 /var/run/dhcpd.pid) & # Fix because silly dhcpd creates its pid with mode 640
+ (sleep 5 && chmod 644 /var/run/dhcpd.pid) & # Fix because silly dhcpd creates its pid with mode 640
;;
stop)
my $file = "/var/run/vpn-watch.pid";
my $debug = 0;
-if ( -e $file ){logger("There my be another vpn-watch runnning $file exists, vpn-watch will not start.");exit 1;}
+if ( -e $file ){
+ logger("There my be another vpn-watch runnning because $file exists, vpn-watch will try kill the process.");
+ open(FILE, "<$file");
+ my $PID = <FILE>;
+ close(FILE);
+ system("kill -9 $PID");
+ }
if ($debug){logger("Call of vpn-watch pid not is not existing.");}
system("echo $$ > $file");
sleep(300);
if ($debug){logger("We will wait 300 seconds before next action.");}
- if (open(FILE, "${General::swroot}/vpn/config")) {
+ if (open(FILE, "<${General::swroot}/vpn/config")) {
@vpnsettings = <FILE>;
close(FILE);
unless(@vpnsettings) {exit 1;}