aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSquibid <me@zacharyscheiman.com>2024-08-04 02:12:04 -0400
committerSquibid <me@zacharyscheiman.com>2024-08-04 02:12:04 -0400
commit84f3886d289dccefd965d05b4e17f245d3a309b9 (patch)
treed19f79bc423a9ab76a31f5ea25f7bd98e893cd66
parent8a8291bd82935290b69187b92d04842eb0ce1533 (diff)
downloadrunit-services-84f3886d289dccefd965d05b4e17f245d3a309b9.tar.gz
runit-services-84f3886d289dccefd965d05b4e17f245d3a309b9.tar.bz2
runit-services-84f3886d289dccefd965d05b4e17f245d3a309b9.zip
improve mpdnotifys portability
-rw-r--r--mpdnotify/conf7
-rwxr-xr-xmpdnotify/run5
2 files changed, 7 insertions, 5 deletions
diff --git a/mpdnotify/conf b/mpdnotify/conf
index f5dffdb..7517940 100644
--- a/mpdnotify/conf
+++ b/mpdnotify/conf
@@ -1,5 +1,6 @@
#!/bin/sh
-ID=18
+export ID=18
-coverart=0 # extract coverart on song change
-coverartfile=/tmp/coverart.png # path to put extracted coverart
+export musicdir="$HOME/media/music" # path to mpds root music dir
+export coverart=1 # extract coverart on song change
+export coverartfile=/tmp/coverart.png # path to put extracted coverart
diff --git a/mpdnotify/run b/mpdnotify/run
index 6f4c929..10ce9e7 100755
--- a/mpdnotify/run
+++ b/mpdnotify/run
@@ -1,6 +1,6 @@
#!/bin/sh
# make sure mpd is running
-sv check "$HOME/.local/share/service/mpd" > /dev/null || exit 1
+sv check "$SV/mpd" > /dev/null || exit 1
# set DISPLAY environment variable so notify send doesn't complain
export DISPLAY=:0
@@ -9,9 +9,10 @@ export DISPLAY=:0
while
song="$(mpc current --wait)"
+ rm -f "$coverartfile" # remove old coverart file
if [ $coverart -eq 1 ]; then
- ffmpeg -y -i "/mnt/hdd/moosic/$(mpc -f %file% | head -1)" "$coverartfile" &
+ ffmpeg -y -i "$musicdir/$(mpc -f %file% | head -1)" "$coverartfile" &
timeout 3 inotifywait -e close "$coverartfile"
notify-send -i "$coverartfile" -r $ID "Now playing" "$song"
else