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