From 87b0874af6077bb2952a0602faa5c917b7e3aba6 Mon Sep 17 00:00:00 2001 From: Squibid Date: Tue, 30 Apr 2024 23:39:07 -0400 Subject: add coverart and config file to mpdnotify --- mpdnotify/conf | 5 +++++ mpdnotify/run | 12 +++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 mpdnotify/conf (limited to 'mpdnotify') 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 -- cgit v1.2.1