add mpd2nheko
This commit is contained in:
parent
63c41b480b
commit
2cdbc7dbed
27
.local/bin/mpd2nheko
Executable file
27
.local/bin/mpd2nheko
Executable file
@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env zsh
|
||||
# Get current song info from MPD and send it via DBUS to nheko to display as
|
||||
# status message.
|
||||
|
||||
setopt LOCAL_OPTIONS ERR_RETURN NO_UNSET PIPE_FAIL
|
||||
|
||||
local oldstatus
|
||||
|
||||
while :; do
|
||||
local title=$(mpc current --format '%title%')
|
||||
if [[ -z ${title} ]]; then
|
||||
sleep 10s
|
||||
continue
|
||||
fi
|
||||
local artist=$(mpc current --format '%albumartist%')
|
||||
local album=$(mpc current --format '%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 \
|
||||
"string:${mpdstatus}"
|
||||
oldstatus=${mpdstatus}
|
||||
fi
|
||||
|
||||
sleep 1
|
||||
done
|
Loading…
x
Reference in New Issue
Block a user