radio.py-0.4 – Listening to Radio the Easy Way

Update: radio.py 0.5 is available.

radio.py is a little script that makes it very easy to listen to radio under Linux (and maybe other OSs too) with mplayer. All you need to do is to call radio.py with the name of the station you want to listen to. For example:

radio.py Radio Paradise
or
radio.py BBC3
To read more about radio.py go to the first post discussing radio.py.

What’s New

Here are some of the things that have changed in radio.py-0.4 compared to the previous release (0.3). On the usability side, I’ve dropped the need to put quotation marks around station names containing spaces. So while in previous version of radio.py to listen for “Radio Tel Aviv” you had to run
radio.py "Radio Tel Aviv"
In the new version you can just call
radio.py Radio Tel Aviv
This doesn’t seem a big change but it makes it a lot easier to listen to radio stations with spaces in their names, and listening to radio in a user-friendly way is what radio.py is all about.

Another great feature is the ability to add new stations to radio.py on a specific user basis or in a system-wide basis via configuration files. radio.py looks for /etc/radiopy.conf and ~/.radiopy and parse them for new stations or for overriding existing stations. The system-wide /etc/radiopy.conf/ overrides the default settings in radio.py itself, and ~/.radiopy can override the system-wide configuration. The syntax for adding new station is

[station name]
home: station homepage
stream: station's stream location

So if one wants for example to add the BBC3 radio station (although it already in the known station list) one would add the following snippet to ~/.radiopy (or to /etc/radiopy.conf if one wants to add it system-wide):

[BBC3]
home: http://www.bbc.co.uk/radio3
stream: http://www.bbc.co.uk/radio3/ram/r3g2.ram

The credit for the idea to use configuration file and the basic implementation of parsing them using the ConfigParser module goes to Fernando Rendón.

In addition to the above, I’ve added 24 new radio stations including all of RadioIO stations, Beethoven (classic music), Radio Paradise and Onda Cero (some Spanish radio).

A full list of changes between radio.py versions is included the the file CHANGES inside the radio.py-0.4 tar archive.

Download

You can download radio.py-0.4 from here.

Installation

The installation process remained the same. Just download the tar archive., extract it and copy radio.py to somewhere in your PATH, e.g. to /usr/bin or /usr/local/bin. From the command line you can run the following commands from the directory in which you saved the tar archive in order to install the script:

tar -zxvf radiopy-0.4.tar.gz
cd radiopy
cp radio.py /usr/bin/

Bugs and Suggestions

If you find a bug in the script please leave a comment bellow. If you have any suggestion or a radio station you would like me to add to the default station list, comment bellow, preferably add the station’s stream url.

9 thoughts on “radio.py-0.4 – Listening to Radio the Easy Way”

  1. Ran, You’re the best.
    I’ve learned python, and I wanted to write a script like this. But you’re ahead of me.
    This is just great.
    10x.

    Oz

  2. Hi.. how to use this program? sorry im new for this language…

    is it can run in windows?

    what i should i do to run it? copy downloaded files to python???

    please help me….

  3. Everything works fine except when I add stations to /etc/radiopy.conf.

    The new stations don’t show up when I do a –list

    And they don’t play. They seem to detect the location and stream but hang (until the next song) at the ICY Info line

    Here is an example of one two I added:

    [Uber]
    home: http://www.ubercityradio.com
    stream: http://www.streaminglicensing.com:8057

    [Folk Alley]
    home: http://www.folkalley.com/music/listen
    stream: http://www.folkalley.com/folkalley.pls

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.