packages/sound/mpd/files/mpd.init
florian 6b0b3e78d2 [package] update mpd to 0.15.2, cleanup init script (#6207)
git-svn-id: svn://svn.openwrt.org/openwrt/packages@18508 3c298f89-4303-0410-b956-a3cf2f4a3e73
2009-11-23 22:11:40 +00:00

33 lines
644 B
Bash

#!/bin/sh /etc/rc.common
# Copyright (C) 2007 OpenWrt.org
START=93
start() {
#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
#create mpd db
/usr/bin/mpd --stdout --create-db
#optional export for mpc
#export MPD_HOST=127.0.0.1
#start mpd
/usr/bin/mpd
#generate playlist and start to play
/usr/bin/mpc listall | /usr/bin/mpc add -
/usr/bin/mpc play
/usr/bin/mpc repeat
}
stop() {
killall mpd
}