toolbox

radio
Login

Command line radio player

Download

radio

Usage

$ radio -h
Command line radio player
Usage:
        radio <radio>
Options:
        -h : display this help and exit
        -l : list radios

Example

$ 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)

Misc

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