about summary refs log tree commit diff
path: root/media-sound/mpdscribble/files
diff options
context:
space:
mode:
Diffstat (limited to 'media-sound/mpdscribble/files')
-rwxr-xr-xmedia-sound/mpdscribble/files/mpdscribble32
1 files changed, 32 insertions, 0 deletions
diff --git a/media-sound/mpdscribble/files/mpdscribble b/media-sound/mpdscribble/files/mpdscribble
new file mode 100755
index 0000000..d23ebd1
--- /dev/null
+++ b/media-sound/mpdscribble/files/mpdscribble
@@ -0,0 +1,32 @@
+#!/sbin/openrc-run
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+: CFGFILE=${CFGFILE:=/etc/mpdscribble.conf}
+
+get_config() {
+	x=$1
+	test -e ${CFGFILE} || return 1
+	cat ${CFGFILE} | \
+		sed -n -e '/^[ \t]*'${x}'/{s:^[ \t]*'${x}'[ \t]\+"\?\([^#"]\+\)[^"]*"\?$:\1: ; p }' | \
+		awk '{print $3}'
+}
+
+extra_started_commands='reload'
+command=/usr/bin/mpdscribble
+#command_args="--conf ${CFGFILE}"
+required_files=${CFGFILE}
+pidfile=$(get_config pid)
+description="An MPD client that submits information to Audioscrobbler"
+
+depend() {
+	need mpd
+	use net
+	config ${CFGFILE}
+}
+
+reload() {
+	ebegin "Reloading ${RC_SVCNAME}"
+	start-stop-daemon --pidfile ${pidfile} --signal HUP
+	eend $?
+}

Consider giving Nix/NixOS a try! <3