radio.py is a command-line frontend for
mplayer designed to make listening to online radio easy.
- Allows you to easily play your favorite online radio stations.
- Adding new stations to
radio.pyis very simple.
- Record radio streams.
- Sleep and Wake-Up features.
- Search Tune-In for new stations.
Download and Install
radio.py is available via
# pip install radiopy
The latest development version can be found in the SourceForge project page.
radio.py is just as easy as specifying the station name.
radio.py Classic FM
You can view the list of supported stations by adding the
This will show a nicely formatted list of the station along with their homepage, so you can easily learn what type of music (or shows) each broadcasts.
When invoking radio.py you can use the
--sleep to make
radio.py start to play after specified number of minutes and shut itself down after specified number of minutes accordingly.
radio.py --wake-up 30 Radio Paradise radio.py --sleep 60 Radio Tel Aviv
These options can also be used together and make
radio.py some kind of radio alarm clock.
radio.py --wake-up 480 --sleep 10 Galgalatz
will play cause
radio.py to start play for 10 minutes in 8 hours from now.
radio.py also supports recording streams to mp3 (via
radio.py --record news.mp3 BBC World Service
This option can also be combined with the
--wake-up flags to time the recording.
29 thoughts on “
radio.py– A CLI frontend to Online Radio”
Beautiful! Works perfectly, and very handy! Many thanks.
This is just great – I’ve been struggling with a pile of mplayer stream url’s for BBC radio, that stopped working some time ago, and this has replaced all of the messing about entirely.
Unfortunately it looks as if the BBC streams have been changed, and no longer work… Other than that, great program…
This is a brilliant idea, I will be following your progress alongside with applejux. Good luck and hope to hear great things!
radio.py – A CLI frontend to Online Radio by Guy Rutenberg – just great!
It is a very nice project, Thank you, but somo statios don’t work any more: BBC, radioio, and probably others
The above folks are correct. Lots of the stations in the main radio.py don’t work. I ended up commenting them all out. Then I used the ~/.radiopy config file to add my own personal streams.
Great wrapper for mplayer. Thanks a bunch!
I love this project, but I’d like to see it in Debian.
What about packaging it? Have you thought about it?
It’s a great idea, but I never had the time to package it. I think the best thing would be to actually package it for PyPi so it would be available via tools like pip instead of directly through Debian.
However, if you are willing to create a package for Debian, I’ll gladly upload it to the radio.py page.
how do i download radio.py with wget in shell? can you please give me the link? thx u
You can just
wgetthe download link above. I just verified that it works.
This program looks like just what I am looking for! Unfortunately having issues invoking radio.py to play stations. For instance, following the example with listed stations, I am recieving this error:
banshee@nachtcrawler:~$ radio.py Rocky FM
Traceback (most recent call last):
File “/usr/local/bin/radio.py”, line 96, in
File “/usr/local/bin/radio.py”, line 91, in main
File “/usr/local/lib/python2.7/dist-packages/radiopy/__init__.py”, line 96, in play
File “/usr/lib/python2.7/os.py”, line 344, in execvp
File “/usr/lib/python2.7/os.py”, line 380, in _execvpe
OSError: [Errno 2] No such file or directory
This error seems to occur when I try to start any radio station listed (radio.py –list)
Do you have any thoughts why this error may be occuring? I am new to linux and python X| but i am trying to learn more and radio.py seems very cool. Any direction would be much appreciated!
Hello Banshee, You need to have
sudo apt-get install mplayer
cool! thanks to the error report (by banshee) i managed to find a file to add/edit radio-stations! (radiopy.default) now listening to WFMU! are there more ways to achieve this? i couldn’t find that “~/.radiopy config file” (mentioned by chris)
You need to create the
~/.radiopyfile before editing it.
Hi, I am packaging version 0.6 for arch linux AUR. However I noticed that tune-in stations only work if I change station[“playlist”] = “yes” to station[“playlist”] = “no” in stations_tunein.py. This is consistent with when I run mplayer manually, the -playlist argument does not work with tune-in streams. Any comments? Can you maybe change that in an upcoming version?
Hi there, i have the same problem as banshee. I’m totally new at python, i’m working on Win7. My python ver is 2.7
So I have installed mplayer7.0, I have installed radiopy. And I have that problem
@Tom, I will fix it.
It looks like you are missing the mplayer binary.
How do i add/remove stations from radio.py
I’m able to record to .wav or .mp3 file formats, but I’m not sure about the bitrates of these files. A project I’m doing requires them to be 16 bits per sample. Is there anyway to customize this?
The bitrate is the same as the original stream, there is no conversion. The bitrate of the compression is not the same as how many bits per sample, bits per sample are usually relevant to non-compressed streams (wav, pcm) and lossless.
Why it doesn’t find any radios?
radio.py -v -v -v -v bbc
INFO:Verbosity: Level -10
DEBUG:tunein: Searching for: bbc
DEBUG:tunein: No matching station
radiopy couldn’t find the requested station “bbc”
Try –list to see the available stations list
Fails to install on Win 10 x64 with the following error:
pip install radiopy
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File “”, line 1, in
File “C:\Users\user\AppData\Local\Temp\pip-build-fp_7pckz\radiopy\setup.py”, line 23, in
File “C:\Users\user\AppData\Local\Temp\pip-build-fp_7pckz\radiopy\setup.py”, line 19, in get_version
NameError: name ‘version‘ is not defined
Command “python setup.py egg_info” failed with error code 1 in C:\Users\user\AppData\Local\Temp\pip-build-fp_7pckz\radiopy\
Can anything be done to resolve it?
In addition to my earlier comment, I was trying to install radiopy on Win 10 x64 in python 3.
Hi Piotr, currently
radio.pyonly works with Python 2.7 and not with Python 3.
Runs fine on a Raspberry 3 with Rapsbian (Jessie) or actually OpenMediaVault 3.2 🙂 This after adding working stations in
Nice job! Next steps should be
See if I can have my raspberry plays it through a BT-connected speaker
Give moc and mpd/mpc a try (the latter is said to be easily controlled via some Android app)
This sounds awesome. Unfortunately, neither the pip installer nor the sourgeforge link seem to work anymore. If you could make them available again it would be so great!