]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/commitdiff
MPFire nochmal konrrigiert
authormaniacikarus <maniacikarus@ea5c0bd1-69bd-2848-81d8-4f18e57aeed8>
Tue, 4 Sep 2007 09:03:55 +0000 (09:03 +0000)
committermaniacikarus <maniacikarus@ea5c0bd1-69bd-2848-81d8-4f18e57aeed8>
Tue, 4 Sep 2007 09:03:55 +0000 (09:03 +0000)
git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@876 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8

config/mpfire/mpd.conf
config/mpfire/mpfire.pl
config/rootfiles/packages/mpd
html/cgi-bin/mpfire.cgi
lfs/mpfire
src/initscripts/init.d/mpd [new file with mode: 0644]
src/paks/alsa/install.sh
src/paks/mpfire/install.sh

index c3153a3291c3ba82ec0d0cb461854654ab6ed700..b5ab704e721ce9f14892e5c00b936d5597ca9d6c 100644 (file)
@@ -152,7 +152,7 @@ buffer_before_play  "25%"
 # this value, then  mpd will drop root priveleges
 # and runs as the user specified.
 #
-user "nobody"
+#user "nobody"
 #
 # Set this value if you only have one 
 # address you want to allow connection to. 
index fae4cd09e28871d30c1107088d5140e1fd6c954b..e386ecdd3fe90c80a3cd44b44f5aa2ec8c9f7c03 100644 (file)
@@ -7,10 +7,6 @@ require "${General::swroot}/header.pl";
 my $filename = "";
 my $debug = 0; 
 
-if ( ! -e /var/run/mpd.pid){
-  system("mpd >/dev/null");
-}
-
 if ($ARGV[0] eq 'scan') {
   if ($debug){print "Creating Database\n";}
   system("mpd --create-db >/dev/null");
@@ -75,9 +71,10 @@ 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 - ";
@@ -91,6 +88,10 @@ sub clearplaylist(){
   system("mpc clear >/dev/null");  
   }
 
+sub stop(){
+  system("mpc stop >/dev/null");  
+  }
+
 sub checkplaylist(){
  my $Datei = "/var/ipfire/mpfire/playlist.m3u";
  my @Info = stat($Datei);
index dd57e70f482900fb2c48f5a28471a7f6a61486e9..68ebf07d4f30d4ec997c3d229d20115b76635afc 100644 (file)
@@ -1,4 +1,7 @@
+etc/rc.d/init.d/mpd
 usr/bin/mpd
+var/log/mpd.error.log
+var/log/mpd.log
 #usr/share/doc/mpd
 #usr/share/doc/mpd/COMMANDS
 #usr/share/doc/mpd/README
index cc2237ab01566f34212907c2138ea8681dc6e576..b6e4b8e140a5599e4b8964bbfef5653c8c021632 100644 (file)
@@ -48,26 +48,27 @@ open(DATEI, "<${General::swroot}/mpfire/db/mpd.db") || die "No Database found";
 my @songdb = <DATEI>;
 close(DATEI);
 
-my @artist; my @album;  my @genre;  my @year; my $linecount = 0; my @currentsong = ""; my %songs;
+my @artist; my @album;  my @genre;  my @year; my $linecount = 0; my %songs;
+my $key;my $file;my $Time;my $Artist;my $Title;my $Album;my $Track;my $Date;my $Genre;
 foreach (@songdb){
   
   if ( $_ =~ /mtime: / ){
-   $songs{$currentsong[1]}="$currentsong[2]|$currentsong[3]|$currentsong[4]|$currentsong[5]|$currentsong[6]|$currentsong[7]|$currentsong[8]|$currentsong[9]";
-   push(@artist,$currentsong[4]);
-   push(@album,$currentsong[6]);
-   push(@year,$currentsong[8]);
-   push(@genre,$currentsong[9]);
-   @currentsong = "";
-   }
-  elsif ( $_ =~ /key: / || $_ =~ /file: / || $_ =~ /Time: / || $_ =~ /Artist: / || $_ =~ /Title: / || $_ =~ /Album: / || $_ =~ /Track: / || $_ =~ /Date: / || $_ =~ /Genre: / ){
-   my @temp = split(/: /,$_);
-   push(@currentsong,$temp[1]);
-   }
-  else {
-   next;
+   $songs{$key}="$file|$Time|$Artist|$Title|$Album|$Track|$Date|$Genre";
+   push(@artist,$Artist);push(@album,$Album);push(@year,$Date);push(@genre,$Genre);
+   $key="";$file="";$Time="";$Artist="";$Title="";$Album="";$Track="";$Date="";$Genre="";
    }
+  elsif ( $_ =~ /key: / ){my @temp = split(/: /,$_);$key=$temp[1];}
+  elsif ( $_ =~ /file: / ){my @temp = split(/: /,$_);$file=$temp[1];}
+  elsif ( $_ =~ /Time: / ){my @temp = split(/: /,$_);$Time=$temp[1];}
+  elsif ( $_ =~ /Artist: / ){my @temp = split(/: /,$_);$Artist=$temp[1];}
+  elsif ( $_ =~ /Title: / ){my @temp = split(/: /,$_);$Title=$temp[1];}
+  elsif ( $_ =~ /Album: / ){my @temp = split(/: /,$_);$Album=$temp[1];}
+  elsif ( $_ =~ /Track: / ){my @temp = split(/: /,$_);$Track=$temp[1];}
+  elsif ( $_ =~ /Date: / ){my @temp = split(/: /,$_);$Date=$temp[1];}
+  elsif ( $_ =~ /Genre: / ){my @temp = split(/: /,$_);$Genre=$temp[1];}
+  else {next;}
  }
-  
   my %hash = map{ $_, 1 }@artist;
   @artist = sort keys %hash;
   my %hash = map{ $_, 1 }@album;
index edd32b350d68ecd5552350b3f7895d7ece75953c..46b99d870537fa465431de0adf55e3cdb3d080e2 100644 (file)
@@ -32,7 +32,7 @@ TARGET     = $(DIR_INFO)/$(THISAPP)
 PROG       = mpfire
 PAK_VER    = 2
 
-DEPS       = "mpd mpc alsa libshout libogg libmad libid3tag"
+DEPS       = "mpd mpc alsa libshout libogg libmad libid3tag libvorbis"
 
 ###############################################################################
 # Top-level Rules
@@ -65,5 +65,6 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
        install -v -m 755 $(DIR_SRC)/config/mpfire/mpfire.pl /var/ipfire/mpfire/bin
        install -v -m 644 $(DIR_SRC)/config/mpfire/mpd.conf /var/ipfire/mpfire/
        install -v -m 644 $(DIR_SRC)/config/mpfire/webradio /var/ipfire/mpfire/
-       chown nobody.nobody /var/ipfire/mpfire/{settings,playlist.m3u,webradio,mpd.conf}
+       chown root.nobody /var/ipfire/mpfire/{settings,playlist.m3u,webradio,mpd.conf}
+       chown root.nobody /var/ipfire/mpfire/db/mpd.db
        @$(POSTBUILD)
diff --git a/src/initscripts/init.d/mpd b/src/initscripts/init.d/mpd
new file mode 100644 (file)
index 0000000..aa7b536
--- /dev/null
@@ -0,0 +1,33 @@
+#!/bin/sh
+# Begin $rc_base/init.d/mpd
+
+# Based on sysklogd script from LFS-3.1 and earlier.
+# Rewritten by Gerard Beekmans  - gerard@linuxfromscratch.org
+# ALSA specific parts by Mark Hymers - markh@linuxfromscratch.org
+# Stores mixer settings in the default location: /etc/asound.state
+
+. /etc/sysconfig/rc
+. $rc_functions
+
+case "$1" in
+       start)
+               boot_mesg "Starting MPD..."
+               /bin/nice --20 /usr/bin/mpd
+    evaluate_retval
+               ;;
+       stop)
+               boot_mesg "Stopping MPD..."
+               /usr/bin/mpd --kill
+    evaluate_retval
+               ;;
+       status)
+               statusproc /usr/bin/mpd
+               ;;
+
+       *)
+               echo "Usage: $0 (start|stop|status)"
+               exit 1
+               ;;
+esac
+
+# End $rc_base/init.d/alsa
index 13789ac28dff3e3128d93e65047d5541d9543885..1a6724d562c988b784d27332a3aaa5ec865a9055 100644 (file)
@@ -4,6 +4,6 @@
 extract_files
 
 touch /etc/asound.state
-ln -svf  ../init.d/alsa /etc/rc.d/rc3.d/S65alsa
-ln -svf  ../init.d/alsa /etc/rc.d/rc0.d/K35alsa
-ln -svf  ../init.d/alsa /etc/rc.d/rc6.d/K35alsa
+ln -svf  /etc/init.d/alsa /etc/rc.d/rc3.d/S65alsa
+ln -svf  /etc/init.d/alsa /etc/rc.d/rc0.d/K35alsa
+ln -svf  /etc/init.d/alsa /etc/rc.d/rc6.d/K35alsa
index 7e446a198264c43b1d6fb282994d2f46f00075ea..4ceb82c989b4d667e7ec2e6e7fa8113866ec4d7b 100644 (file)
@@ -2,5 +2,9 @@
 . /opt/pakfire/lib/functions.sh
 
 extract_files
-
 chown nobody.nobody -Rv /var/ipfire/mpfire
+ln -svf  /etc/init.d/mpd /etc/rc.d/rc3.d/S65mpd
+ln -svf  /etc/init.d/mpd /etc/rc.d/rc0.d/K35mpd
+ln -svf  /etc/init.d/mpd /etc/rc.d/rc6.d/K35mpd
+touch /var/log/mpd.error.log
+touch /var/log/mpd.log