Skip to content

Instantly share code, notes, and snippets.

@marcsello
Created September 6, 2017 20:57
Show Gist options
  • Save marcsello/57f54c4854541aa0a8b801cfc36ee3aa to your computer and use it in GitHub Desktop.
Save marcsello/57f54c4854541aa0a8b801cfc36ee3aa to your computer and use it in GitHub Desktop.
#!/bin/bash
echo -e "Fetching station list...\n"
list=$(curl "--station_lising--" 2>/dev/null)
streaming_links=()
link_cnt="0"
while read -r i; do
# decode the entry
name=$(echo "$i" | cut -d ';' -f 1)
link=$(echo "$i" | cut -d ';' -f 2)
# do magic
streaming_links+=("$link")
# print option
echo "$link_cnt) $name"
link_cnt=$(($link_cnt + 1))
done <<< "$list"
echo -e "q) quit\n"
echo "It's time to choose Dr. Freeman"
read choosen_idx
[ "$choosen_idx" == "q" ] && exit 0
if [[ ! "$choosen_idx" =~ ^[0-9]+$ ]]; then
echo "de number pls"
exit 1
fi
if [ "$choosen_idx" -gt "$link_cnt" ]; then
echo "de jo number pls"
exit 1
fi
mplayer ${streaming_links[$choosen_idx]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment