2007-12-28 15:27:42 +00:00
|
|
|
#!/bin/sh /etc/rc.common
|
|
|
|
# Copyright (C) 2007 OpenWrt.org
|
|
|
|
START=93
|
|
|
|
|
|
|
|
start() {
|
2008-05-17 10:06:55 +00:00
|
|
|
#create mpd directories
|
|
|
|
md=`grep music_directory /etc/mpd.conf | cut -d "\"" -f 2 | sed "s/~/\/root/g"`
|
|
|
|
if [ ! -d $md ]; then
|
|
|
|
mkdir -p $md
|
|
|
|
fi
|
|
|
|
pld=`grep playlist_directory /etc/mpd.conf | cut -d "\"" -f 2 | sed "s/~/\/root/g"`
|
|
|
|
if [ ! -d $pld ]; then
|
|
|
|
mkdir -p $pld
|
|
|
|
fi
|
2007-12-28 15:27:42 +00:00
|
|
|
#create mpd db
|
|
|
|
/usr/bin/mpd --stdout --create-db
|
|
|
|
|
|
|
|
#optional export for mpc
|
2008-02-02 01:48:22 +00:00
|
|
|
#export MPD_HOST=127.0.0.1
|
2007-12-28 15:27:42 +00:00
|
|
|
|
|
|
|
#start mpd
|
|
|
|
/usr/bin/mpd
|
|
|
|
|
|
|
|
#generate playlist and start to play
|
|
|
|
/usr/bin/mpc listall | /usr/bin/mpc add -
|
|
|
|
/usr/bin/mpc play
|
2008-02-02 01:48:22 +00:00
|
|
|
/usr/bin/mpc repeat
|
2007-12-28 15:27:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
stop() {
|
|
|
|
killall mpd
|
|
|
|
}
|
2008-05-17 10:06:55 +00:00
|
|
|
|