A mobile app for listening to radio stations from around the globe
git clone git://soophie.de/verbal
blob: 975596b61292c9fc0fb7346cd165c96f88bb6a4a (971 bytes)[doc][blame][raw]
1
#!/bin/bash3
declare -A config4
config=(5
["port"]=""6
["uri"]="/api"7
["method"]="GET"8
["args"]=""9
["token"]="test-token"10
)12
while read argument; do13
key=$(echo "$argument" | awk '{split($0, a, "="); print a[1]}')14
if [ -z "$key" ]; then15
continue16
fi17
value=$(echo "$argument" | awk '{st = index($0, "="); print substr($0, st + 1)}')18
config["$key"]=$value19
done <<< $(echo "$@" | tr " " "\n")21
# while read key; do22
# echo "$key: ${config[$key]}"23
# done <<< $(echo "${!config[@]}" | tr " " "\n")25
# echo ""27
url="http://localhost:${config["port"]}${config["uri"]}?${config["args"]}"29
echo ""30
echo "Request"31
echo "------------------------------------------------------------"33
echo "${config["method"]} $url"34
echo "verbal-token: ${config["token"]}"35
echo ""37
echo "Response"38
echo "------------------------------------------------------------"40
curl "$url" -I -g42
curl "$url" -s -g -X "${config["method"]}" -H "verbal-token: ${config["token"]}" | jq -r "."