Created
February 3, 2019 16:39
-
-
Save rubenverhoef/caa7d670153d6fc5c6c6fec47774a6db to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
channels=(11C 12C) | |
# channels=(5A 5B 5C 5D | |
# 6A 6B 6C 6D | |
# 7A 7B 7C 7D | |
# 8A 8B 8C 8D | |
# 9A 9B 9C 9D | |
# 10A 10B 10C 10D | |
# 11A 11B 11C 11D | |
# 12A 12B 12C 12D | |
# 13A 13B 13C 13D 13E 13F) | |
status=$(curl -s --head -w %{http_code} http://localhost:7979 -o /dev/null) | |
if ! [ "$status" = "000" ]; then | |
for DABch in ${channels[*]} | |
do | |
curl --data $DABch http://localhost:7979/channel > /dev/null 2>&1 | |
counter=0 | |
prevlength=0 | |
while [ "$counter" -le "20" ] | |
do | |
sleep 1 | |
services=$(curl -s "http://localhost:7979/mux.json" | jq '.services') | |
length=$(echo $services | jq 'length') | |
if [ "$length" = "$prevlength" ] && [ "$length" -gt "0" ]; then | |
break | |
fi | |
prevlength=$length | |
((counter++)) | |
done | |
if ! [ "$services" = "null" ]; then | |
counter=0 | |
length=$(echo $services | jq 'length') | |
while [ $counter -lt $length ] | |
do | |
label=$(echo $services | jq '.['$counter'].label' | sed -e 's/^"//' -e 's/"$//') | |
url=$(echo $services | jq '.['$counter'].url_mp3' | sed -e 's/^"//' -e 's/"$//') | |
echo "http://localhost:7979"$url $DABch > "$label".strm | |
((counter++)) | |
done | |
fi | |
done | |
else | |
echo "Welle.io webserver not running!" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment