Listen to Internet Radio From Your Linux Terminal With PyRadio
Radio is the oldest form of electronic mass communication and even in the third decade of the 21st century, it’s still how many people consume news, find new music, and pass the time while stuck in traffic on the commute to work.
The internet allows you to listen to streaming radio stations worldwide, exposing you to music, culture, news, and events you would never otherwise have found. You can listen to internet radio without ever leaving your terminal on Linux. Here’s how.
What Is Internet Radio?
Until the early 20th century, entertainment was limited to live venues. You could go to the theater or a dance hall to listen to live music, or you could sing around the piano in the pub. Occasionally musicians would visit.
For news, you could read the newspaper, and depending on where you were in the world, that news could take weeks or months to arrive. Life was grim, people were uninformed, and music, limited.
Radio changed everything. There was no need to wait for passing travelers to tell of the goings-on in faraway lands. News, music, and shows were broadcast over the airwaves to entire nations, and smaller stations served individual cities. With the right equipment, at the right time of day, you could listen to radio stations from across oceans.
With the advent of the internet came streaming radio—you no longer needed to rig arrays of magnetic loop antennae to listen to BBC Radio 4 at night from the continental US. All you needed was a browser or streaming client, and a decent internet connection to listen to the local news and music scene from anywhere in the world.
Usually, to listen to internet radio, you would visit any number of websites offering to connect you to live streams. If you live in an area with data protection laws you’ll see pop-ups asking for your consent to track you, display advertising, and sell your data. If you don’t… it happens anyway.
Music apps such as Spotify have the same problem, and also trap you in a gated garden—exposing you to music the algorithm determines will suit you, rather than true exposure to the wider world.
Why Listen to Internet Radio From the Terminal?
While there are dozens of standalone internet radio clients for the Linux desktop, using one means another app you have to install and manage. It’s the memory you can’t afford to waste, and they tend to require you to use the mouse too.
PyRadio is a fully featured internet radio client you can run right from your terminal. It’s entirely keyboard driven, boasts a low storage and memory footprint, and comes with a good-looking terminal user interface (TUI).
How to Install PyRadio on Linux
The easiest way to install PyRadio is by using your package manager, however, the app isn’t available in all standard repositories. Despite being, as the name suggests, a Python app, the version of PyRadio available directly via PIP, hasn’t been updated since 2013.
If you can’t get the PyRadio app through your package manager, you’ll need to use an installation script prepared by the developer. First, though, you’ll need to install Python. Once Python is on your system, use it to install further dependencies:
python3 -m pip install
Use wget to download the installation script:
…and install it using Python:
If everything goes well, you should see a success message as above.
You can now start PyRadio from any terminal with:
Use PyRadio to Listen to Radio Stations From Around the World!
Start PyRadio with no arguments, and you’ll see the TUI with a playlist of stations selected by the developer. There’s something for almost everyone, with genres including hip-hop, indie pop, jazz, Goth rock, and even Commodore 64 remixes from Slay FM.
Navigation is simple: use the arrow keys to navigate between stations, and hit Enter to select. To stop the playback, press Space. The title and artist of the current track are displayed at the bottom of the interface.
You can navigate to the top, bottom, or middle of the playlist with H, L, or M—which is easy to remember if you think “High, Low, Middle”.
PyRadio has five built-in themes, and you can access them by pressing “t” on your keyboard. For a more complete list of keybindings, press “?“.
Being able to listen to the developer’s prebuilt station playlist is cool, but you may not agree with his selections, or you might already have decided what stations you want to listen to.
PyRadio loads its playlist from a CSV (Comma Separated Value) file located in ~/.config/pyradio/stations.csv.
To add, remove, or edit the default stations, use nano to open the playlists file:
You’ll see that each line contains two parts. The first is the name of the station, and the second part after the comma is the stream URL. You can delete any lines you don’t want, add new ones, rename the station to something memorable, or modify the stream URL if it changes.
It should go without saying that the custom names for your stations shouldn’t contain any commas.
Save and exit nano with Ctrl + O then Ctrl + X.
If you’re listening to stations from across the globe, it can be useful to create multiple playlists. These can be for the country of origin, the genre of music, the time zone, or news stations. It’s up to you.
Create new stations by using nano to create and edit new CSV files in the ~/.config/pyradio/ directory. Remember to name your playlists with a “.csv” extension.
To start PyRadio with a particular playlist, use the -s switch with the name of your playlist. For instance:
pyradio -s ~/.config/pyradio/'Russian Numbers Stations.csv'
While you can place your playlist anywhere, if you load it in this way, PyRadio will warn you that it is a foreign playlist, and prompt you to copy it into the config directory.
To load a playlist from within PyRadio, press “o“.
Internet Radio Is the Best Radio
Listening to internet radio in your terminal is the best way to experience the medium. You don’t need to fiddle with a dial or wait for the tubes to warm up, and it’s easy to search for and classify stations to create your own playlist. There’s also the ineffable cool that comes from running bloat-free terminal apps instead of clunky GUIs or browsers.
The only way you can make PyRadio more awesome is to listen to its output through a set of great headphones.