diff --git a/tools/radio-fetch b/tools/radio-fetch old mode 100644 new mode 100755 index 03697ae..8d28bc0 --- a/tools/radio-fetch +++ b/tools/radio-fetch @@ -1,14 +1,9 @@ #!/usr/bin/env sh -radiodj_socket=/var/run/dwelling-radio/sock -radiodj_playlist_url=http:/api/playlist +outp="$(curl -XGET --unix-socket /var/run/dwelling-radio/sock http:/api/playlist -s -w '%{response_code}')" -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 +if [ "${outp: -3}" != "200" ]; then exit 1; fi -echo $song \ No newline at end of file +echo ${outp%????} \ No newline at end of file