uploaded rainwave-play

it only relies on busybox (and some sort of audio player), gives a little menu of all channels, and then plays it
This commit is contained in:
jan6 2019-04-05 17:46:08 -04:00
parent e19cb8f133
commit 5b50ef6743
1 changed files with 33 additions and 0 deletions

33
rainwave-play.sh Normal file
View File

@ -0,0 +1,33 @@
#!/bin/sh
if test "$1" = "-h" -o "$1" = "--help";then
echo "simple channel selector for rainwave.cc,"
echo " fetches m3u for a channel and plays it";
echo "(choose format by editing script, mp3 vs ogg)"
echo;
echo "syntax: rainwave-play.sh [player] [arguments]";
echo;
echo "defaults to playing .ogg using mpv without arguments";
echo;
exit;
else
#feel free to replace with whatever you want,
# left the space in player_opt so it's easier to do stuff like
# "player-curses" if you want
player="${1:-"mpv"}";player_opt=" ${2}"
fi;
format="ogg" #could be "mp3" or "ogg"
player="$player" player_opt="$player_opt" format="$format" busybox ash -c '
x=$(
busybox wget -O- https://rainwave.cc/api4/stations 2>/dev/null|
busybox tr "}" "\n"|
busybox grep -Eo "\"name\"\: .*|\"id\"\: [0-9]*"|
busybox cut -d" " -f2|
busybox sed "N;s/\n/:/");
list=$(echo -e "$x ?"|tr " " "\n");
read -p "$list" -n1 choice;echo;export choice=$choice
echo "$list"|grep "$choice"|cut -d":" -f2|
sed "s/^/Playing channel: /"
sid="$choice";echo $sid
echo "$player$player_opt https://rainwave.cc/tune_in/${sid}.${format}.m3u"
$player$player_opt https://rainwave.cc/tune_in/${choice}.${format}.m3u
'