1
0
Fork 0

mpd2nheko: simplify

This commit is contained in:
tastytea 2022-12-07 18:15:08 +01:00
parent c14c729ede
commit deebf1e311
Signed by: tastytea
SSH Key Fingerprint: SHA256:FBkvrOlhq5use1XEttyUGT4bUTDVA1ar9SgIc9P03cM
1 changed files with 7 additions and 12 deletions

View File

@ -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