From: maniacikarus Date: Tue, 4 Sep 2007 09:03:55 +0000 (+0000) Subject: MPFire nochmal konrrigiert X-Git-Tag: v2.3-beta1~396 X-Git-Url: http://git.ipfire.org/?p=people%2Fpmueller%2Fipfire-2.x.git;a=commitdiff_plain;h=9a6214e02721a4bc9cbef8b6531b972afd1d7602 MPFire nochmal konrrigiert git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@876 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8 --- diff --git a/config/mpfire/mpd.conf b/config/mpfire/mpd.conf index c3153a3291..b5ab704e72 100644 --- a/config/mpfire/mpd.conf +++ b/config/mpfire/mpd.conf @@ -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. diff --git a/config/mpfire/mpfire.pl b/config/mpfire/mpfire.pl index fae4cd09e2..e386ecdd3f 100644 --- a/config/mpfire/mpfire.pl +++ b/config/mpfire/mpfire.pl @@ -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); diff --git a/config/rootfiles/packages/mpd b/config/rootfiles/packages/mpd index dd57e70f48..68ebf07d4f 100644 --- a/config/rootfiles/packages/mpd +++ b/config/rootfiles/packages/mpd @@ -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 diff --git a/html/cgi-bin/mpfire.cgi b/html/cgi-bin/mpfire.cgi index cc2237ab01..b6e4b8e140 100644 --- a/html/cgi-bin/mpfire.cgi +++ b/html/cgi-bin/mpfire.cgi @@ -48,26 +48,27 @@ open(DATEI, "<${General::swroot}/mpfire/db/mpd.db") || die "No Database found"; my @songdb = ; 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; diff --git a/lfs/mpfire b/lfs/mpfire index edd32b350d..46b99d8705 100644 --- a/lfs/mpfire +++ b/lfs/mpfire @@ -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 index 0000000000..aa7b53689f --- /dev/null +++ b/src/initscripts/init.d/mpd @@ -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 diff --git a/src/paks/alsa/install.sh b/src/paks/alsa/install.sh index 13789ac28d..1a6724d562 100644 --- a/src/paks/alsa/install.sh +++ b/src/paks/alsa/install.sh @@ -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 diff --git a/src/paks/mpfire/install.sh b/src/paks/mpfire/install.sh index 7e446a1982..4ceb82c989 100644 --- a/src/paks/mpfire/install.sh +++ b/src/paks/mpfire/install.sh @@ -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