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 c3153a3..b5ab704 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 fae4cd0..e386ecd 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 dd57e70..68ebf07 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 cc2237a..b6e4b8e 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 edd32b3..46b99d8 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 13789ac..1a6724d 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 7e446a1..4ceb82c 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