diff --git a/tools/radiodj-fetch b/tools/radiodj-fetch new file mode 100644 index 0000000..82e8ee9 --- /dev/null +++ b/tools/radiodj-fetch @@ -0,0 +1,14 @@ +#!/usr/bin/env sh + +radiodj_socket=/var/run/dwelling-radio/djsock +radiodj_playlist_url=http:/playlist + +CURL_FLAGS=--unix-socket $radiodj_socket $radiodj_playlist_url -o /dev/null -s -w "%{response_code}" + +read -r song response <<< "$(curl -XGET $CURL_FLAGS)" + +if [ "$response" -ne "200" ]; then + exit 1; +fi + +echo $song \ No newline at end of file diff --git a/tools/radiodj-listener-connect b/tools/radiodj-listener-connect new file mode 100644 index 0000000..625b623 --- /dev/null +++ b/tools/radiodj-listener-connect @@ -0,0 +1,10 @@ +#!/usr/bin/env sh + +radiodj_socket=/var/run/dwelling-radio/djsock +radiodj_listener_url=http:/listener + +response=$(curl -XPOST --unix-socket $radiodj_socket $radiodj_listener_url -o /dev/null -s -w "%{response_code}") + +if [ "$response" -ne "201" ]; then + exit 1; +fi \ No newline at end of file diff --git a/tools/radiodj-listener-disconnect b/tools/radiodj-listener-disconnect new file mode 100644 index 0000000..c642914 --- /dev/null +++ b/tools/radiodj-listener-disconnect @@ -0,0 +1,10 @@ +#!/usr/bin/env sh + +radiodj_socket=/var/run/dwelling-radio/djsock +radiodj_listener_url=http:/listener + +response=$(curl -XDELETE --unix-socket $radiodj_socket $radiodj_listener_url -o /dev/null -s -w "%{response_code}") + +if [ "$response" -ne "204" ]; then + exit 1; +fi \ No newline at end of file