From deebf1e311aa050fe7efa4df3158985eebc54acc Mon Sep 17 00:00:00 2001 From: tastytea Date: Wed, 7 Dec 2022 18:15:08 +0100 Subject: [PATCH] mpd2nheko: simplify --- .local/bin/mpd2nheko | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/.local/bin/mpd2nheko b/.local/bin/mpd2nheko index f6c3e54..03cd307 100755 --- a/.local/bin/mpd2nheko +++ b/.local/bin/mpd2nheko @@ -7,18 +7,9 @@ setopt LOCAL_OPTIONS ERR_RETURN NO_UNSET PIPE_FAIL local oldstatus while :; do - local title=$(mpc current --format '%title%') - if [[ -z ${title} ]]; then - dbus-send --print-reply \ - --dest=im.nheko.Nheko / im.nheko.Nheko.setStatusMessage \ - "string:" - sleep 10s - continue - fi - local artist=$(mpc current --format '%albumartist%') - local album=$(mpc current --format '%album%') + local mpdstatus=$(mpc current --format \ + '[np: %title%[ by [%albumartist%|%artist%][ \[from %album%\]]]]') - local mpdstatus="np: ${title} by ${artist} [from ${album}]" if [[ ${mpdstatus} != ${oldstatus} ]]; then dbus-send --print-reply \ --dest=im.nheko.Nheko / im.nheko.Nheko.setStatusMessage \ @@ -26,5 +17,9 @@ while :; do oldstatus=${mpdstatus} fi - sleep 1 + if [[ -z ${mpdstatus} ]]; then + sleep 10 + else + sleep 1 + fi done