diff options
Diffstat (limited to '')
-rw-r--r-- | mpdnotify/conf | 5 | ||||
-rwxr-xr-x | mpdnotify/run | 12 |
2 files changed, 16 insertions, 1 deletions
diff --git a/mpdnotify/conf b/mpdnotify/conf new file mode 100644 index 0000000..ea5ab13 --- /dev/null +++ b/mpdnotify/conf @@ -0,0 +1,5 @@ +#!/bin/sh +ID=18 + +coverart=1 # extract coverart on song change +coverartfile=/tmp/coverart.png # path to put extracted coverart diff --git a/mpdnotify/run b/mpdnotify/run index c8eca40..6f4c929 100755 --- a/mpdnotify/run +++ b/mpdnotify/run @@ -5,6 +5,16 @@ sv check "$HOME/.local/share/service/mpd" > /dev/null || exit 1 # set DISPLAY environment variable so notify send doesn't complain export DISPLAY=:0 +[ -f ./conf ] && . ./conf || exit 1 + while - notify-send -r 18 "Now playing" "$(mpc current --wait)" + song="$(mpc current --wait)" + + if [ $coverart -eq 1 ]; then + ffmpeg -y -i "/mnt/hdd/moosic/$(mpc -f %file% | head -1)" "$coverartfile" & + timeout 3 inotifywait -e close "$coverartfile" + notify-send -i "$coverartfile" -r $ID "Now playing" "$song" + else + notify-send -r $ID "Now playing" "$song" + fi do :; done |