radiobro

Submitted scripts and programs
Forum rules
Your own work only.
machinebacon
Baconator
Posts: 10253
Joined: Thu Sep 16, 2010 11:03 am
Location: Pfälzerwald
Contact:

radiobro

Unread post by machinebacon » Mon Mar 13, 2017 3:10 pm

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
..gnutella..

User avatar
wuxmedia
Grasshopper
Posts: 6454
Joined: Wed Oct 17, 2012 11:32 am
Location: Back in Blighty
Contact:

Re: radiobro

Unread post by wuxmedia » Mon Mar 13, 2017 8:56 pm

cool bro
"Seek, and Ye shall find"
"Github | Chooons | Site"

pidsley
Hermit
Posts: 2539
Joined: Wed Oct 17, 2012 12:31 pm

Re: radiobro

Unread post by pidsley » Thu Mar 16, 2017 2:17 pm

Nice. I especially like the use of config variables. This might reduce people whining about their favorite tweak.

Post Reply