Page 1 of 1

radiobro

Posted: Mon Mar 13, 2017 3:10 pm
by machinebacon
Front-end for http://radio-browser.info

Usage: radiobro `searchterm`

The `searchterm` can be anything related to the radio station you are looking for, eg. jazz, essex, bbc

Code: Select all

#!/bin/bash
# radio-browser TUI frontend (depends: curl, jq, mpg123)

[[ -z $1 ]] && printf "E: Enter search term for radio stations.\n" && exit 0

BYNAME=http://www.radio-browser.info/webservice/json/stations/byname
STATION_LIST=/tmp/stations

## bbq way
BUFFER=3000
PLAYER="mpg123"
PARAMS="-C -b $BUFFER"

## for mr-know-all:
# BUFFER=3000
# PLAYER="mpg123" # you can try with streamripper, mplayer, vlc, ...
# PARAMS="--silent-whore --shut-the-fuck-up-smoothly --asshole-on-fire  -b $BUFFER" # depends on the $PLAYER, make *your* choices and stop fucking discussing what whoreface parameters you suggest

printf "Searching for stations containing $1... \n"
curl -A "LinuxBBQ Radiobro" -s $BYNAME/$1 | jq '.[] | .url' > $STATION_LIST

killall $PLAYER 2> /dev/null # to make sure we don't have multiple streams running

array=( $(cat $STATION_LIST) )
select opt in "${array[@]}"; do
	$PLAYER $PARAMS `echo $opt | tr -d '"' | tr -d ';'` &
	break
done

Re: radiobro

Posted: Mon Mar 13, 2017 8:56 pm
by wuxmedia
cool bro

Re: radiobro

Posted: Thu Mar 16, 2017 2:17 pm
by pidsley
Nice. I especially like the use of config variables. This might reduce people whining about their favorite tweak.