]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/commitdiff
Probleme mit dem Perl Modulen hoffentlich bereinigt
authormaniacikarus <maniacikarus@ea5c0bd1-69bd-2848-81d8-4f18e57aeed8>
Mon, 23 Jul 2007 18:13:41 +0000 (18:13 +0000)
committermaniacikarus <maniacikarus@ea5c0bd1-69bd-2848-81d8-4f18e57aeed8>
Mon, 23 Jul 2007 18:13:41 +0000 (18:13 +0000)
MPFire liest jetzt auch Genre und Jahr aus

git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@716 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8

config/mpfire/mpfire.pl
config/rootfiles/packages/mpfire
html/cgi-bin/mpfire.cgi
lfs/backup

index 876fed4370a347d8a018713cb2d105cb492cd645..b592b463f567638980c627ec9fc3549d66e4f5a3 100644 (file)
@@ -10,6 +10,7 @@ require "${General::swroot}/header.pl";
 my $filename = "";
 my %songs = "";
 my $debug = 1;
+my $temp;
 
 if ($ARGV[0] eq 'scan') {
 my $command = "find ";
@@ -37,6 +38,7 @@ if ($ARGV[0] eq 'getdb') {
   }
 elsif ($ARGV[0] eq 'play') {
   &checkplaylist();
+  &checkmute();
   if ($debug){print "Yes we are called and we will play $ARGV[1]\n";}
   system("/usr/bin/mpg123 -b 1024 --aggressive -q \"$ARGV[1]\" 2>/dev/null >/dev/null &");
   }
@@ -65,6 +67,7 @@ elsif ($ARGV[0] eq 'voldown') {
   }
 elsif ($ARGV[0] eq 'playall') {
   &checkplaylist();
+  &checkmute();
   if ($debug){print "Playing everything\n";}
   system("/usr/bin/mpg123 -b 1024 --aggressive -Zq@ /var/ipfire/mpfire/playlist 2>/dev/null >/dev/null &"); 
   }
@@ -84,6 +87,7 @@ elsif ($ARGV[0] eq 'next') {
   system("kill -SIGINT $PID");
   }
 elsif ($ARGV[0] eq 'song') {
+  &checkmute();
   my $song = `lsof -nX \| grep mpg123 \| grep REG \| grep mem | grep mp3 \| grep -v "sh -c" \| grep -v "grep"`;
   my @song = split(/\//,$song);
   my $i = @song;
@@ -98,6 +102,7 @@ elsif ($ARGV[0] eq 'song') {
   }
 elsif ($ARGV[0] eq 'playweb') {
   &General::readhash("${General::swroot}/proxy/settings", \%proxysettings);
+  &checkmute();
 
                        if ($proxysettings{'UPSTREAM_PROXY'}) {
                          if ($proxysettings{'UPSTREAM_USER'}) {
@@ -115,6 +120,13 @@ elsif ($ARGV[0] eq 'playweb') {
         system("wget -qO - `wget -qO - http://$ARGV[1]` | mpg123 -b 1024 --aggressive -Zq - 2>/dev/null >/dev/null &");
                        }
   }
+elsif ($ARGV[0] eq 'volume') {
+ $temp = "Master - ";
+ $temp .= `amixer get Master \| tail -2 \| awk '{ print \$2" "\$5 }'`;
+ $temp .= "<break>PCM -";
+ $temp .= `amixer get PCM \| tail -2 \| awk '{ print \$2" "\$5 }'`;
+ print $temp;
+}
 
 sub getSongInfo(){
   my $mp3 = MP3::Tag->new($filename);
@@ -140,6 +152,21 @@ sub checkplaylist(){
  if ( $Info[7] eq '' || $Info[7] eq '0' ){print "There is no playlist";exit(1);}
 }
 
+sub checkmute(){
+ $temp = `amixer get Master \| tail -2`;
+  my @Master = split(/ /,$temp);
+ $temp = `amixer get PCM \| tail -2`;
+  my @PCM = split(/ /,$temp);
+ if ( $PCM[7] =~  /off/ ){
+  if ($debug){print "PCM was muted - umuting.\n";}
+  system("amixer set PCM toggle");
+  }
+ if ( $Master[7] =~ /off/ ){
+  if ($debug){print "Master was muted - umuting.\n";}
+  system("amixer set Master toggle");
+  } 
+}
+
 sub checkm3u(){
  my $Datei = system("wget -q --spider http://$ARGV[1]");
  if ( $Datei ne '0' ){print "We are unable to get the stream";exit(1);}
index 0f554dfe931eda2ba7ab2c5a3eb57f142db9d10a..4f85b12a0fcde61bf0811823d334958d0dd1feb8 100644 (file)
@@ -13,3 +13,7 @@ usr/lib/perl5/site_perl/5.8.8/MP3/Tag.pm
 usr/lib/perl5/site_perl/5.8.8/MP3/Tag/File.pm
 usr/lib/perl5/site_perl/5.8.8/MP3/Tag/ID3v1.pm
 usr/lib/perl5/site_perl/5.8.8/MP3/Tag/ID3v2.pm
+usr/lib/perl5/site_perl/5.8.8/MP3/Tag/ParseData.pm
+usr/lib/perl5/site_perl/5.8.8/MP3/Tag/LastResort.pm
+usr/lib/perl5/site_perl/5.8.8/MP3/Tag/Inf.pm
+usr/lib/perl5/site_perl/5.8.8/MP3/Tag/CDDB_File.pm
index a3d81c108aba4c3fa1f2eb01e37b40ee90aacd3e..e2e0e4c086a8e8d8a5d61f3c005c8b9f40ccc5d6 100644 (file)
@@ -99,6 +99,38 @@ print DATEI @temp;
 close(DATEI);
 $message=system("/usr/local/bin/mpfirectrl playall");
 }
+elsif ( $mpfiresettings{'ACTION'} eq "playyear" )
+{
+my @temp = "";
+my @year = split(/\|/,$mpfiresettings{'year'});
+my %hash = map{ $_, 1 }@year;
+
+foreach (@songdb){
+  my @song = split(/\|/,$_);
+  chomp($song[0]);
+    push(@temp,$song[0]."\n") if exists $hash{$song[5]};
+  }
+open(DATEI, ">${General::swroot}/mpfire/playlist") || die "Could not add playlist";
+print DATEI @temp;
+close(DATEI);
+$message=system("/usr/local/bin/mpfirectrl playall");
+}
+elsif ( $mpfiresettings{'ACTION'} eq "playgenre" )
+{
+my @temp = "";
+my @genre = split(/\|/,$mpfiresettings{'genre'});
+my %hash = map{ $_, 1 }@genre;
+
+foreach (@songdb){
+  my @song = split(/\|/,$_);
+  chomp($song[0]);
+    push(@temp,$song[0]."\n") if exists $hash{$song[6]};
+  }
+open(DATEI, ">${General::swroot}/mpfire/playlist") || die "Could not add playlist";
+print DATEI @temp;
+close(DATEI);
+$message=system("/usr/local/bin/mpfirectrl playall");
+}
 elsif ( $mpfiresettings{'ACTION'} eq "playall" )
 {
 my @temp = "";
@@ -112,7 +144,7 @@ print DATEI @temp;
 close(DATEI);
 $message=system("/usr/local/bin/mpfirectrl playall");
 }
-elsif ( $mpfiresettings{'SHOWLIST'} ){delete $mpfiresettings{'__CGI__'};delete $mpfiresettings{'x'};delete $mpfiresettings{'y'};delete $mpfiresettings{'PAGE'};&General::writehash("${General::swroot}/mpfire/settings", \%mpfiresettings);}
+elsif ( $mpfiresettings{'SHOWLIST'} ){delete $mpfiresettings{'__CGI__'};delete $mpfiresettings{'x'};delete $mpfiresettings{'y'};delete $mpfiresettings{'PAGE'};&General::writehash("${General::swroot}/mpfire/settings", \%mpfiresettings);refreshpage();}
 
 ############################################################################################################################
 ################################### Aufbau der HTML Seite fr globale Sambaeinstellungen ####################################
@@ -148,17 +180,15 @@ END
 my $song = qx(/usr/local/bin/mpfirectrl song);
 if ( $song eq "" ){$song = "None";}
 
+my $Volume = `/usr/local/bin/mpfirectrl volume`;
+$Volume=~s/<break>/<br \/>/g;
+
 &Header::openbox('100%', 'center', $Lang::tr{'mpfire controls'});
 print <<END
 
     <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>
-END
-;
-if ( $#songdb > -1 ){
-print"<tr><td colspan='5' align='center'><br/><b>total $#songdb songs</b><br/><br/></td></tr>";
-}
-print <<END
+    <tr><td colspan='5' align='center'><br/><b>total $#songdb songs</b><br/><br/></td></tr>
     <tr>
     <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>
@@ -176,23 +206,27 @@ print <<END
     <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>
     <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>
     </tr>
+<tr><td colspan='5' align='center'>$Volume</td></tr>
 </table>
 END
 ;
 &Header::closebox();
 
-if ( $#songdb > -1 ){
+if ( $#songdb ne '0' ){
 &Header::openbox('100%', 'center', $Lang::tr{'quick playlist'});
 
-my @artist;
-my @album;
+my @artist; my @album;  my @genre;  my @year;
 foreach (@songdb){
   my @song = split(/\|/,$_);
-  push(@artist,$song[1]);push(@album,$song[4]);}
+  push(@artist,$song[1]);   push(@album,$song[4]);  push(@year,$song[5]);   push(@genre,$song[6]);}
   my %hash = map{ $_, 1 }@artist;
   @artist = sort keys %hash;
   my %hash = map{ $_, 1 }@album;
   @album = sort keys %hash;
+  my %hash = map{ $_, 1 }@year;
+  @year = sort keys %hash;
+  my %hash = map{ $_, 1 }@genre;
+  @genre = sort keys %hash;
 print <<END
   <table width='95%' cellspacing='0'>
   <tr><td align='center' bgcolor='$color{'color20'}'><b>$Lang::tr{'artist'} - $#artist</b></td><td align='center' bgcolor='$color{'color20'}'><b>$Lang::tr{'album'} - $#album</b></td></tr>
@@ -201,7 +235,7 @@ print <<END
       <select name='artist' size='8' multiple='multiple' style='width:300px;'>
 END
 ;
-  foreach (@artist){print "<option>$_</option>";}
+  foreach (@artist){if ( $_ ne '' ){print "<option>$_</option>";}}
 print <<END
       </select><br/>
       <input type='hidden' name='ACTION' value='playartist' />
@@ -212,12 +246,36 @@ print <<END
       <select name='album' size='8' multiple='multiple' style='width:300px;'>
 END
 ;
-  foreach (@album){print "<option>$_</option>";}
+  foreach (@album){if ( $_ ne '' ){print "<option>$_</option>";}}
 print <<END
       </select><br/>
       <input type='hidden' name='ACTION' value='playalbum' />
       <input type='image' alt='$Lang::tr{'play'}' title='$Lang::tr{'play'}' src='/images/media-playback-start.png' />
       </form></td>
+      </tr>
+  <tr><td align='center' bgcolor='$color{'color20'}'><b>$Lang::tr{'year'} - $#year</b></td><td align='center' bgcolor='$color{'color20'}'><b>$Lang::tr{'genre'} - $#genre</b></td></tr>
+  <tr><td align='center'>
+      <form method='post' action='$ENV{'SCRIPT_NAME'}'>
+      <select name='year' size='8' multiple='multiple' style='width:300px;'>
+END
+;
+  foreach (@year){if ( $_ ne '' ){print "<option>$_</option>";}}
+print <<END
+      </select><br/>
+      <input type='hidden' name='ACTION' value='playyear' />
+      <input type='image' alt='$Lang::tr{'play'}' title='$Lang::tr{'play'}' src='/images/media-playback-start.png' />
+      </form></td>
+      <td align='center'>
+      <form method='post' action='$ENV{'SCRIPT_NAME'}'>
+      <select name='genre' size='8' multiple='multiple' style='width:300px;'>
+END
+;
+  foreach (@genre){if ( $_ ne '' ){print "<option>$_</option>";}}
+print <<END
+      </select><br/>
+      <input type='hidden' name='ACTION' value='playgenre' />
+      <input type='image' alt='$Lang::tr{'play'}' title='$Lang::tr{'play'}' src='/images/media-playback-start.png' />
+      </form></td>
       </tr></table>
 END
 ;
index 35258ac8189c459d37a9a50fa7d28a106ffca63e..2bcdacef7e12b71ecbc6a574b3b10a8b12328c7e 100644 (file)
@@ -63,4 +63,5 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
        install -v -m 755 $(DIR_SRC)/config/backup/backup.pl /var/ipfire/backup/bin
        install -v -m 644 $(DIR_SRC)/config/backup/include /var/ipfire/backup/
        install -v -m 644 $(DIR_SRC)/config/backup/exclude /var/ipfire/backup/
+       chown nobody:nobody -R /var/ipfire/backup/
        @$(POSTBUILD)