diff --git a/rainwave-play.sh b/rainwave-play.sh new file mode 100644 index 0000000..5f57c2f --- /dev/null +++ b/rainwave-play.sh @@ -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 +'