Command line radio player


$ radio -h
Command line radio player
Usage: radio <radio>
  -l    list radios
  -p string
		mp3 stream player (default "mpv -")


$ radio "Radio Paradise"
Led Zeppelin - Dazed and Confused
Vetiver - You May Be Blue
Marc Cohn - Dance Back From The Grave

(icy metadata are displayed on stdout if available)

Alternate mp3 player

mpv is the default backend player, but you can use another one:

$ alias radio='radio -p "mplayer -cache 1024 -"'
$ radio "Radio Paradise"
Loreena McKennitt - Marco Polo

Add/Update streams

Feel free to add your own radios. Edit json/radio.json, then recompile the program:

$ fossil clone radio.fossil
$ mkdir radio
$ cd radio
$ fossil open ../radio.fossil
$ vi json/radios.json
(make your changes..)
$ make


i3 integration

Sample script for i3 integration:

#!/usr/bin/env bash
# Wrapper around radio for i3 integration

choice=$( (echo "stop"; radio -l) | dmenu -i)
pkill radio
[ "$choice" == "stop" ] && exit
radio "$choice"

Bash completion

For bash completion, save the following script in your bash_completion.d directory:

#!/usr/bin/env bash

function _radio()
	local cur=${COMP_WORDS[COMP_CWORD]}
	local patterns
	mapfile -t patterns < <(radio -l)
	mapfile -t COMPREPLY < <( compgen -W "$( printf '%q ' "${patterns[@]}" )" -- "$cur" \
		| awk '/ / { print "\""$0"\"" } /^[^ ]+$/ { print $0 }' )

complete -F _radio radio