1
0

Fixed and simplified radio-fetch.

This commit is contained in:
Alexander Andreev 2023-10-07 06:03:16 +04:00
parent 65ec8c1db2
commit 0590eaa1c5
Signed by: Arav
GPG Key ID: D22A817D95815393

11
tools/radio-fetch Normal file → Executable file
View 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%????}