diff options
author | Squibid <me@zacharyscheiman.com> | 2024-04-30 23:39:07 -0400 |
---|---|---|
committer | Squibid <me@zacharyscheiman.com> | 2024-04-30 23:40:10 -0400 |
commit | 87b0874af6077bb2952a0602faa5c917b7e3aba6 (patch) | |
tree | d094ec937343f9ee27bc86a5a10fe5648b3494c3 /mpd | |
parent | 553c78eeac8270a8549d4e9e47e666399e04a0ea (diff) | |
download | runit-services-87b0874af6077bb2952a0602faa5c917b7e3aba6.tar.gz runit-services-87b0874af6077bb2952a0602faa5c917b7e3aba6.tar.bz2 runit-services-87b0874af6077bb2952a0602faa5c917b7e3aba6.zip |
add coverart and config file to mpdnotify
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 |