Fixed and simplified radio-fetch.
This commit is contained in:
parent
65ec8c1db2
commit
0590eaa1c5
11
tools/radio-fetch
Normal file → Executable file
11
tools/radio-fetch
Normal file → Executable file
@ -1,14 +1,9 @@
|
|||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
radiodj_socket=/var/run/dwelling-radio/sock
|
outp="$(curl -XGET --unix-socket /var/run/dwelling-radio/sock http:/api/playlist -s -w '%{response_code}')"
|
||||||
radiodj_playlist_url=http:/api/playlist
|
|
||||||
|
|
||||||
CURL_FLAGS=--unix-socket $radiodj_socket $radiodj_playlist_url -o /dev/null -s -w "%{response_code}"
|
if [ "${outp: -3}" != "200" ]; then
|
||||||
|
|
||||||
read -r song response <<< "$(curl -XGET $CURL_FLAGS)"
|
|
||||||
|
|
||||||
if [ "$response" -ne "200" ]; then
|
|
||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo $song
|
echo ${outp%????}
|
Loading…
Reference in New Issue
Block a user