1
0

mpd.init 682 B

123456789101112131415161718192021222324252627282930
  1. #!/bin/sh /etc/rc.common
  2. # Copyright (C) 2007-2014 OpenWrt.org
  3. START=93
  4. USE_PROCD=1
  5. PROG=/usr/bin/mpd
  6. CONFIGFILE=/etc/mpd.conf
  7. NICEPRIO=-10
  8. #TODO: Add uci config - nice, config
  9. start_service() {
  10. #create mpd directories from config
  11. local pld=`grep ^playlist_directory "$CONFIGFILE" | cut -d "\"" -f 2 | sed "s/~/\/root/g"`
  12. if [ ! -d $pld ]; then
  13. mkdir -m 0755 -p $pld
  14. fi
  15. local lport=`grep ^port "$CONFIGFILE" | cut -d "\"" -f 2`
  16. [ -z $lport ] && lport=6600
  17. procd_open_instance
  18. procd_add_mdns "mpd" "tcp" "$lport"
  19. procd_set_param command "$PROG" --no-daemon "$CONFIGFILE"
  20. # Give MPD some real-time priority
  21. procd_set_param nice "$NICEPRIO"
  22. procd_close_instance
  23. }