termux-packages/packages/mpd/mpd-script.sh
Oliver Schmidhauser 86538f555e Stop making ~/music when mpd starts.
The default music directory has been changed to /sdcard/music anyway, so
it is no longer required and actually more confusing to people, since
they will think they should put their music into ~/music, which will not
work with the default configuration of mpd.
2017-07-17 23:58:18 +02:00

29 lines
744 B
Bash

mpd_test=$(pgrep -f /data/data/com.termux/files/usr/libexec/mpd)
CmdArgs=$(echo "$@")
#echo $mpd_test
mkdir -p ~/.mpd
mkdir -p ~/.mpd/playlists
touch ~/.mpd/state
touch ~/.mpd/log
touch ~/.mpd/pid
if [ "x$CmdArgs" = x ] ; then
if [ -z "$MULTIPLE_MPDS" ] ; then
if [ -n "$mpd_test" ] ; then
echo -n "restart music player daemon (y/n)? "
read answer
if echo "$answer" | grep -iq "^y" ;then
echo "restarting music player daemon"
pgrep -f /data/data/com.termux/files/usr/libexec/mpd | while read line; do kill "$line"; done
else
echo "doing nothing"
exit
fi
else
echo "starting mpd the music player daemon"
fi
sleep 0.5;
chmod +rw ~/.mpd/* 2>&1 > /dev/null
rm -rf ~/.mpd/pid 2>&1 > /dev/null
fi
fi