Anpassungen am MPFire
authormaniacikarus <maniacikarus@ea5c0bd1-69bd-2848-81d8-4f18e57aeed8>
Tue, 11 Sep 2007 16:18:48 +0000 (16:18 +0000)
committermaniacikarus <maniacikarus@ea5c0bd1-69bd-2848-81d8-4f18e57aeed8>
Tue, 11 Sep 2007 16:18:48 +0000 (16:18 +0000)
git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@884 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8

config/mpfire/mpd.conf
config/mpfire/mpfire.pl
html/cgi-bin/mpfire.cgi

index b5ab704..685b33b 100644 (file)
@@ -57,36 +57,36 @@ mixer_control               "PCM"
 audio_output {
         type                    "alsa"
         name                    "alsa"
-        device                  "hw:0,0"     # optional
-        format                  "44100:16:2" # optional
+#        device                  "hw:0,0"     # optional
+#        format                  "44100:16:2" # optional
 }
 #
 # An example of an OSS output:
 #
-audio_output {
-        type                    "oss"
-        name                    "My OSS Device"
-        device                  "/dev/dsp"   # optional
-        format                  "44100:16:2" # optional
-}
+#audio_output {
+#        type                    "oss"
+#        name                    "My OSS Device"
+#        device                  "/dev/dsp"   # optional
+#        format                  "44100:16:2" # optional
+#}
 #
 # An example of a shout output (for streaming to Icecast):
 #
-audio_output {
-        type                    "shout"
-        name                    "My Shout Stream"
-        host                    "localhost"
-        port                    "8000"
-        mount                   "/mpd.ogg"
-        password                "hackme"
+#audio_output {
+#        type                    "shout"
+#        name                    "My Shout Stream"
+#        host                    "localhost"
+#        port                    "8000"
+#        mount                   "/mpd.ogg"
+#        password                "hackme"
 #        quality                 "5.0"
-        bitrate                 "128"
-        format                  "44100:16:1"
+#        bitrate                 "128"
+#        format                  "44100:16:1"
 #        user                    "source"                # optional
 #        description             "My Stream Description" # optional
 #        genre                   "jazz"                  # optional
 #        public                  "no"                    # optional
-}
+#}
 #
 # Set this if you have problems 
 # playing audio files.
index e386ecd..6c9b4c1 100644 (file)
@@ -10,6 +10,7 @@ my $debug = 0;
 if ($ARGV[0] eq 'scan') {
   if ($debug){print "Creating Database\n";}
   system("mpd --create-db >/dev/null");
+  system("/etc/init.d/mpd restart");
 }
 elsif ($ARGV[0] eq 'play') {
   &checkmute();
@@ -23,6 +24,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 +48,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 +69,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 +85,8 @@ sub clearplaylist(){
   system("mpc clear >/dev/null");  
   }
 
-sub stop(){
-  system("mpc stop >/dev/null");  
+sub shuffle(){
+  system("mpc shuffle >/dev/null");  
   }
 
 sub checkplaylist(){
index b6e4b8e..f0a9894 100644 (file)
@@ -120,7 +120,18 @@ elsif ( $mpfiresettings{'ACTION'} eq "playweb" ){$message=system("/usr/local/bin
 elsif ( $mpfiresettings{'ACTION'} eq "playlist" ){$message=system("/usr/local/bin/mpfirectrl playlist");}
 elsif ( $mpfiresettings{'ACTION'} eq "emptyplaylist" ){$message=system("/usr/local/bin/mpfirectrl clearplaylist");}
 elsif ( $mpfiresettings{'ACTION'} eq "addtoplaylist" ){$message=system("/usr/local/bin/mpfirectrl","playadd","\"$mpfiresettings{'FILE'}\"");}
-elsif ( $mpfiresettings{'ACTION'} eq "playall" ){$message=system("/usr/local/bin/mpfirectrl playall");}
+elsif ( $mpfiresettings{'ACTION'} eq "playall" ){
+my @temp = ""; my @song = "";
+
+foreach (keys(%songs)){
+  @song = split(/\|/,$songs{$_});push(@temp,$song[0])
+  }
+open(DATEI, ">${General::swroot}/mpfire/playlist.m3u") || die "Could not add playlist";
+print DATEI @temp;
+close(DATEI);  
+
+$message=system("/usr/local/bin/mpfirectrl playlist");
+}
 elsif ( $mpfiresettings{'ACTION'} eq "playalbum" )
 {
 my @temp = ""; my @song = ""; my @select = split(/\|/,$mpfiresettings{'album'});