From 0590eaa1c57933e21eb41d5946115bdc70dbed46 Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Sat, 7 Oct 2023 06:03:16 +0400 Subject: [PATCH] Fixed and simplified radio-fetch. --- tools/radio-fetch | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) mode change 100644 => 100755 tools/radio-fetch 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