| 1 | #! /bin/sh |
| 2 | |
| 3 | set -e |
| 4 | |
| 5 | dir_bin="$1" |
| 6 | |
| 7 | # TODO: Convert mpd sensor to watcher from poller |
| 8 | # Since we can just open the connection and send periodic requests. |
| 9 | # |
| 10 | # close |
| 11 | # Closes the connection to MPD. MPD will try to send the remaining output |
| 12 | # buffer before it actually closes the connection, but that cannot be |
| 13 | # guaranteed. This command will not generate a response. |
| 14 | # |
| 15 | # Clients should not use this command; instead, they should just close the socket. |
| 16 | # |
| 17 | # https://www.musicpd.org/doc/html/protocol.html#connection-settings |
| 18 | # |
| 19 | echo 'status\ncurrentsong\nclose' \ |
| 20 | | nc 127.0.0.1 6600 \ |
| 21 | | "$dir_bin"/khatus_parse_mpd_status_currentsong |