Pyradio - Play your Favorite Radio Station from Linux Terminal

Channel: Linux
Abstract: 2 Alternative (BAGeL Radio - SomaFM)pyradio [-h] [--stations STATIONS] [--play [PLAY]] [--add] [--list]

Pyradio is a free and open source Python-based command line tool that allows you to play your favorite radio station online. We'll take you through the installation of Pyradio and how to play your favorite radio station online from Ubuntu Linux terminal. We have tested this installation on Ubuntu 18.04 version.

Prerequisites before installing Pyradio

Before we get started, here are a few things we need to have installed in our Linux system.

  1. Python3
  2. pip3
  3. mplayer or vlc media player
Installation of PyRadio

To install PyRadio clone the git repository

How to Create Online Radio Stations...

To view this video please enable JavaScript, and consider upgrading to a web browser that supports HTML5 video

How to Create Online Radio Stations Free with Azuracast Web Radio Broadcasting Software | Part 1
https://github.com/coderholic/pyradio.git

After successful cloning, navigate to pyradio folder

cd pyradio

Next, we shall install Pyradio by building from source

Building Pyradio from Source
python setup.py build

Next, install the build

python setup.py install

After successful installation, it's time to launch Pyradio and listen to your favorite radio station!

To launch Pyradio, you need to switch from root to a regular user and  run

pyradio --play

Output

Scroll to your preferred station and Hit Enter to start streaming.

To view, the station list files head to

pyradio/pyradio

In this directory, you'll find the stations.csv file as shown

vim stations.csv

Output

  1 # Find lots more stations at http://www.iheart.com,
  2 Alternative (BAGeL Radio - SomaFM),http://somafm.com/bagel.pls
  3 Alternative (The Alternative Project),http://c9.prod.playlists.ihrhls.com/4447/playlist.m3u8
  4 American Roots (Boot Liquor - SomaFM),http://somafm.com/bootliquor.pls
  5 Celtic (ThistleRadio - SomaFM),http://somafm.com/thistle.pls
  6 Chillout (Groove Salad - SomaFM),http://somafm.com/startstream=groovesalad.pls
  7 Commodore 64 Remixes (Slay Radio),http://www.slayradio.org/tune_in.php/128kbps/listen.m3u
  8 Covers (SomaFM),http://somafm.com/covers.pls
  9 Downtempo (Secret Agent - SomaFM),http://somafm.com/secretagent.pls
 10 Dub Step (Dub Step Beyond - SomaFM),http://somafm.com/dubstep.pls
 11 Electronic/Dance (Electronic Culture),http://www.shouted.fm/tunein/electro-dsl.m3u
 12 Folk (Folk Forward - SomaFM),http://somafm.com/folkfwd.pls
 13 Hip Hop (Hot 97 NYC),http://playerservices.streamtheworld.com/pls/WQHTAAC.pls
 14 Hip Hop (Power 1051 NYC),http://c11.prod.playlists.ihrhls.com/1481/playlist.m3u8
 15 House (Beat Blender - SomaFM),http://somafm.com/startstream=beatblender.pls
 16 Indie Pop (Indie Pop Rocks! - SomaFM),http://somafm.com/indiepop130.pls
 17 Intelligent dance music (Cliq Hop - SomaFM),http://somafm.com/startstream=cliqhop.pls
 18 Jazz (Sonic Universe - SomaFM),http://somafm.com/startstream=sonicuniverse.pls
 19 Lounge (Illinois Street Lounge - SomaFM),http://somafm.com/illstreet.pls
 20 Pop (PopTron! - SomaFM),http://somafm.com/poptron.pls
 21 Pop/Rock/Urban  (Frequence 3 - Paris) ,http://streams.frequence3.net/hd-mp3.m3u
 22 Progressive (Tags Trance Trip - SomaFM),http://somafm.com/tagstrance.pls
 23 Public Radio (WNYC - Public Radio from New York to the World),http://wnyc-iheart.streamguys.com/wnycfm-iheart.aac
 24 Reggae Dancehall (Ragga Kings),http://www.raggakings.net/listen.m3u
 25 Rock (Digitalis - SomaFM),http://somafm.com/digitalis.pls
~                                                                                                                                      
~

To access help man pages run

pyradio -h

Sample Output

usage: pyradio [-h] [--stations STATIONS] [--play [PLAY]] [--add] [--list]

Console radio player

optional arguments:
  -h, --help            show this help message and exit
  --stations STATIONS, -s STATIONS
                        Path on stations csv file.
  --play [PLAY], -p [PLAY]
                        Start and play. The value is num station or empty for
                        random.
  --add, -a             Add station to list.
  --list, -l            List of added stations.

Other Useful controls

Enter - Play the highlighted station
- / +    - Increase / Decrease the volume
    m    - Mute
    r      - Select a random station
    q     -  Quit / End

Read also:

  • Tlog - A Tool to Record / Play Terminal IO and Sessions
  • How to Display Random ASCII Art on Terminal
  • Tizonia - A Command Line Music Player for Linux
  • MPS-Youtube - Play and Download Youtube Video on Linux Command Line

In this article, we outlined how to install and use Pyradio to play your favorite radio station. Pyradio is a handy command-line tool you can use to keep boredom at a bay and inject some excitement by listening to a myriad of worldwide radio stations. It can be installed on many Linux distributions, both Debian and RedHat based. You could also try another version of Pyradio on github but we didn't test it. Give it a shot and give us your feedback. :-)

Resource Reference

GitHub - Pyradio

Ref From: linoxide
Channels:

Related articles