You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
757 B

  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. local pld lport
  11. #create mpd directories from config
  12. pld=$(grep ^playlist_directory "$CONFIGFILE" | cut -d "\"" -f 2 | sed "s/~/\/root/g")
  13. [ -d "$pld" ] || mkdir -m 0755 -p "$pld"
  14. lport=$(grep ^port "$CONFIGFILE" | cut -d "\"" -f 2)
  15. [ -z "$lport" ] && lport=6600
  16. procd_open_instance
  17. procd_add_mdns "mpd" "tcp" "$lport"
  18. procd_set_param command "$PROG" --no-daemon "$CONFIGFILE"
  19. procd_set_param stderr 1
  20. # Give MPD some real-time priority
  21. procd_set_param nice "$NICEPRIO"
  22. procd_close_instance
  23. }
  24. reload_service() {
  25. procd_send_signal "$PROG"
  26. }