From 8fc77d0bc738d4838fb062bcc892928c581a9097 Mon Sep 17 00:00:00 2001 From: Siraaj Khandkar Date: Thu, 7 Feb 2019 22:33:00 -0500 Subject: [PATCH] Use newer mpd API --- x2/src/bash/exe/khatus_sensor_mpd.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/x2/src/bash/exe/khatus_sensor_mpd.sh b/x2/src/bash/exe/khatus_sensor_mpd.sh index 058cecd..dab4d77 100644 --- a/x2/src/bash/exe/khatus_sensor_mpd.sh +++ b/x2/src/bash/exe/khatus_sensor_mpd.sh @@ -4,6 +4,18 @@ set -e dir_bin="$1" -echo 'status\ncurrentsong' \ +# TODO: Convert mpd sensor to watcher from poller +# Since we can just open the connection and send periodic requests. +# +# close +# Closes the connection to MPD. MPD will try to send the remaining output +# buffer before it actually closes the connection, but that cannot be +# guaranteed. This command will not generate a response. +# +# Clients should not use this command; instead, they should just close the socket. +# +# https://www.musicpd.org/doc/html/protocol.html#connection-settings +# +echo 'status\ncurrentsong\nclose' \ | nc 127.0.0.1 6600 \ | "$dir_bin"/khatus_parse_mpd_status_currentsong -- 2.20.1