Setting up PiFace Control And Display Radio

Difficulty: medium

How to setup the PiFace Radio example to play internet radio through speakers or headphones, and control it with PiFace Control And Display.

Add stations to PiFace Radio

Changing the list of radio stations on PiFace Radio is simple.

First copy the radio program to your home directory so you don't lose the original, open a Terminal and enter
cp /usr/share/doc/python3-pifacecad/examples/radio.py ~

You will also need to copy the radiolircrc file aswell
cp /usr/share/doc/python3-pifacecad/examples/radiolircrc ~

Now open your newly copied radio.py file in your home directory, with your favourite text editor, eg
leafpad radio.py

Near the beginning of the code, you will see a line beginning like this
STATIONS = [

This is the list of radio stations. To remove a station you don't want, delete the 3 lines associated with it (name, source and info) and remove the {} also.

To add a station find its web address, one that plays the station without having to click anything on the page, and the address ends in a audio file format such as pls ormp3. Enter the station into the list in the form
{'name': "station name",
'source': 'station web address',
'info': 'station info web address' or None},

To check this works, use http://www.bbc.co.uk/radio/listen/live/r3_aaclca.pls as your radio station (we checked this one).

Rearrange the list so your favourite stations are at the top, as PiFace radio will play them in order when you cycle through the stations