]> git.ipfire.org Git - ipfire-2.x.git/blobdiff - config/mpfire/mpfire.pl
Korrekturen damit der Build wieder laeuft
[ipfire-2.x.git] / config / mpfire / mpfire.pl
index e386ecdd3fe90c80a3cd44b44f5aa2ec8c9f7c03..e72b2fcae65785bc867c391c4c5690d64a280130 100644 (file)
@@ -7,9 +7,14 @@ require "${General::swroot}/header.pl";
 my $filename = "";
 my $debug = 0; 
 
+if (  `/etc/init.d/mpd status` =~/not running/ ){
+system("/etc/init.d/mpd start >/dev/null");
+}
+
 if ($ARGV[0] eq 'scan') {
   if ($debug){print "Creating Database\n";}
   system("mpd --create-db >/dev/null");
+  system("/etc/init.d/mpd restart >/dev/null");
 }
 elsif ($ARGV[0] eq 'play') {
   &checkmute();
@@ -23,6 +28,7 @@ elsif ($ARGV[0] eq 'playadd') {
   }
 elsif ($ARGV[0] eq 'playlist') {
   &checkmute();
+  &shuffle();
   &clearplaylist();
   if ($debug){print "Yes we are called and we will play your Playlist\n";}
   system("mpc load playlist >/dev/null && mpc play >/dev/null");
@@ -46,10 +52,6 @@ elsif ($ARGV[0] eq 'voldown') {
   system("/usr/bin/amixer set Master $ARGV[1]%- 2>/dev/null >/dev/null");
   system("/usr/bin/amixer set PCM $ARGV[1]%- 2>/dev/null >/dev/null");
   }
-elsif ($ARGV[0] eq 'playall') {
-  if ($debug){print "Playing everything\n";}
-  system("mpc play >/dev/null"); 
-  }
 elsif ($ARGV[0] eq 'toggle') {
   system("mpc toggle >/dev/null");
   }
@@ -71,10 +73,9 @@ elsif ($ARGV[0] eq 'stats') {
   }
 elsif ($ARGV[0] eq 'playweb') {
   &checkmute();
-  &stop(); 
   &clearplaylist();
   if ($debug){print "Playing webstream $ARGV[1] \n";}
-     system("mpc add \"http://$ARGV[1]\" >/dev/null && mpc play >/dev/null && sleep 1");
+     system("mpc add http://$ARGV[1] >/dev/null && mpc play >/dev/null && sleep 1");
   }
 elsif ($ARGV[0] eq 'volume') {
  $temp = "Master - ";
@@ -88,8 +89,8 @@ sub clearplaylist(){
   system("mpc clear >/dev/null");  
   }
 
-sub stop(){
-  system("mpc stop >/dev/null");  
+sub shuffle(){
+  system("mpc random >/dev/null");  
   }
 
 sub checkplaylist(){
@@ -105,10 +106,10 @@ sub checkmute(){
   my @PCM = split(/ /,$temp);
  if ( $PCM[7] =~  /off/ ){
   if ($debug){print "PCM was muted - umuting.\n";}
-  system("amixer set PCM toggle");
+  system("amixer set PCM toggle >/dev/null");
   }
  if ( $Master[7] =~ /off/ ){
   if ($debug){print "Master was muted - umuting.\n";}
-  system("amixer set Master toggle");
+  system("amixer set Master toggle >/dev/null");
   } 
 }