Skip to content
/ arradio Public

Listen to internet radio stations from the terminal

License

Notifications You must be signed in to change notification settings

sepen/arradio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

81 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Listen to internet radio stations from the terminal.

Last Commit Repo Size Code Size Proudly Written in Bash

image

Features

  • Listen radio stations from the SHOUTcast and SomaFM directories
  • Manage a list of favorite radio stations
  • Use multiple audio players like arradio-player, mpv, vlc and ffplay to play internet radio stations.
  • Optional UI (fzf pseudo-user interface) with color theme support.

Table of Contents

Requirements

  • Common tools found on most UNIX systems: (bash, cut, grep, sed, head, cat)
  • XML tools are required to parse URL responses from SHOUTcast and SomaFM directories
  • External audio player. This program does not play URL streams directly, this is delegated to an external audio player that should be installed on the system. The following ones are detected automatically if installed.
  • (optional) External command for the User Interface: fzf

Installation

To install arradio paste that in a macOS Terminal or Linux shell prompt:

curl -fsSL https://raw.githubusercontent.com/sepen/arradio/master/arradio | bash -s install
  • The one-liner command from above installs arradio to its default $HOME/.arradio
  • It will place some files under that prefix, so you'll need to set your PATH like this export PATH=$HOME/.arradio/bin:$PATH
  • The installation explains what it will do, and you will see all that information. Consider adding this line to your ~/.bashrc or ~/.bash_profile or make sure to export this PATH before running arradio. The installation explains what it will do.
  • The one-liner installation method found on arradio uses Bash. Notably, zsh, fish, tcsh and csh will not work.

Upgrading arradio

arradio is being actively developed, and you might want to upgrade it once in a while. Please follow the instruction below:

arradio upgrade

Usage

arradio help

Usage:
  arradio [command] <flags>

Available Commands:
  install                   Install arradio itself
  upgrade                   Upgrade arradio itself
  toplist-shoutcast         List top radio stations from the SHOUTcast directory
  toplist-somafm            List top radio stations from the SomaFM directory
  search [string]           Search for radio stations by keyword
  listen [station-id]       Listen to specified radio station
  info [station-id]         Get information for specified radio station
  fadd [station-id]         Add radio station to your favourites
  fdel [station-id]         Delete radio station from your favourites
  flist                     List favourites radio stations
  ui                        Start arradio in UI mode (fzf required)
  themes                    List installed UI themes
  env                       Show environment variables
  version                   Show version information
  help                      Show this help information

Optional Flags:
  -l, --limit [number]      Limit output lines (default: 50)
  -o, --output [string]     Output list format simple or wide (default: simple)
  -p, --player [string]     Command to play the streams (default: arradio-player)
  -t, --theme [string]      UI theme (default: basic)
  -b, --no-color            Do not colorize messages and output lists
  -n, --no-cache            Do not use cached resources
  -d, --debug               Enable debug messages

Configuration

The config file, which defaults to $HOME/.arradio/config has the following format:

# this is a comment line
player_cmd:     mpv --no-video
ui_theme:       molokai8
output_limit:   50
output_filter:  wide
no_color:       0
no_cache:       1
debug:          0
# this is another comment line

NOTE: This file is not created by default, so if you need to make changes to the default values, consider creating this configuration file. You can grab an example from here

Configuration values can come from several sources:

  • As an environment variable
  • As a value in the config file
  • As a command line optional flag

The previous order also indicates the order of precedence to take. For example, to override the default UI theme:

export ARRADIO_UI_THEME=nord
arradio ui

The above can be also override by setting a value in the config file:

ui_theme: gruvbox

Lastly all from above can be override as an optional flag through the command line:

arradio ui --theme molokai

Examples

Look for radio stations with the words rock and metal and limit the list to only 5 stations with wide output format:

arradio search rock -l 5

 STATION  GENRE               NAME
99498012  Rock                ROCK ANTENNE
99497966  Heavy Metal         ROCK ANTENNE Heavy Metal (Germany)
99497948  80s                 ANTENNE BAYERN 80er Hits
 1542116  Pop                 POWERHITZ.COM - THE OFFICEMIX
99497950  Rock                ANTENNE BAYERN Classic Rock

To play a radio station then use the station-id from first column:

arradio listen 99498012

Favorites

By default this is empty but you can mantain a list of favorite radio stations.

To list my favourites:

arradio flist

 STATION  GENRE               NAME
 1210771  Funk                GENERATION SOUL DISCO FUNK RADIO [HD]
 1340450  Misc                AlienWare
 1528122  Jazz                JAZZGROOVE.org - The Jazz Groove
 1862204  Drum and Bass       DnBRadio.com
99497996  Pop                 ANTENNE BAYERN
99500354  Classic Rock        Classic Rock 109 - True Classic Rock!
99504568  Downtempo           Nordic Lodge - Copenhagen
99518870  Salsa               RADIO PANAMERICANA WEB
99540705  Rock                PureRock.US - America Pure Rock
99568323  Dance               Dance Wave Retro!
99571797  Techno              Minimal Mix Radio
99576960  Reggae              Roots Legacy Radio

Add a radio station

To add a radio station you can do it in several ways.

Maybe you already have a station-id from a previous search. In this case just run something like:

arradio fadd 99498012

You can also add radio stations from other locations. All you need is a valid stream URL. For that just create a new file under favorites directory like that:

cat > $HOME/.arradio/favorites/downtuned << __EOF__
id: downtuned
br: 128
genre: Rock
info: Groovy Music Sanctuary (https://www.downtunedmag.com)
url: http://195.242.237.14:8020/stream
__EOF__

Remove a radio station

Similar to adding a station-id to favorites, you can remove it with something like:

arradio fdel 99498012

UI mode

arradio can run in pseudo-terminal User Interface mode. You just need to have fzf installed and then you can run the following command to start UI mode:

arradio ui

UI themes

arradio can perfectly work in UI mode without any theme installed. In this case it will use a black and white interface. But maybe you prefer to use a theme with fancy colors.

The themes are provided separately and their installation and upgrade will be manual. To see the current themes available in this repository go to ui-themes.

You can use any of them, but keep in mind if your terminal supports 24-bit truecolor, if not, it will be better to use the themes for 8-bit colors

Name Screenshot Palette Description
basic 8-bit Basic arradio UI theme designed for portability
gruvbox 24-bit Retro groove color scheme based on morhetz/gruvbox
molokai 24-bit A color scheme for focusing based on tomasr/molokai
nord 24-bit North-bluish theme based on arcticicestudio/nord-vim
purple 24-bit Only want to see you in the purple rain
seoul 24-bit Light theme based on junegunn/seoul256.vim
seouldark 24-bit Dark theme based on junegunn/seoul256.vim

Installing themes

This is an example about installing some themes:

url="https://raw.githubusercontent.com/sepen/arradio/master/ui-themes"
themes="molokai gruvbox nord"
cd $HOME/.arradio/ui-themes
for theme in $themes; do curl -fsSL -O $url/$theme; done
cd -

To see your installed themes:

arradio themes

THEME        PALETTE  DESCRIPTION
molokai       24-bit  A color scheme for focusing based on tomasr/molokai
gruvbox       24-bit  Retro groove color scheme based on morhetz/gruvbox
nord          24-bit  North-bluish theme based on arcticicestudio/nord-vim
basic          8-bit  Basic arradio UI theme designed for portability

Select a theme

By default arradio will try to use what defined in ARRADIO_UI_THEME environment variable.

To use another theme you should override this by doing something like this:

arradio ui -t gruvbox

Or set up a config file like this:

ui_theme: gruvbox