BBC Streaming Radio Script for MPD

UPDATE: Changes the BBC have made to their streaming service means the below no longer works. Bit of a shame…

Following on from my earlier post, this details the steps taken to get the Pi to operate as a BBC radio player. This is aimed at people in the UK as it uses the UK-only stream URLS.

The end result is the ability to select and play the main BBC radio stations from another computer (over ssh) or from your iPhone using the app MPoD.

Firstly, install MPD and MPC:
$ sudo apt-get install mpd mpc
Change the permissions of mpd (just to make sure):
$ sudo service mpd stop
$ sudo chmod -R g+w /var/lib/mpd
$ sudo chmod -R g+w /var/run/mpd

Make a change to the mpd config file /etc/mpd.conf
$ sudo nano /etc/mpd.conf
Comment OUT the line:
bind_to_address "localhost"

Uncomment the ZeroConf lines and alter the name to “RaspiRadio” and restart the mpd service: sudo service mpd start. This should now be a functioning MPD / MPC install.

The next step is to generate a playlist file that includes each stream address. What I have done is different to other scripts found online – they make a different file for each station. I prefer having all the streams in a single playlist so I can select any station using the MPoD app on my phone, without having to deal with finding / loading playlists. It just works.

The below code can be run as a cron job to update the streams (their details change periodically) every 2 or so hours.

4 replies
  1. Benoit
    Benoit says:

    Hi Tristan,

    I really nice article, i did something similar for my Wife with a raspberry and a timed constrained webradio to wake her up in the morning.
    I’m now using http://volumio.org as my raspberry distribution for everything related to sound. You can still hack this distribution to do specific things. You should try it.

    Kind Regards.

  2. Nick Form
    Nick Form says:

    Thanks for the post. I too like being able to load the complete list of stations once and flick between the channels by selecting a different infinite track in the queue.

    I did encounter a small problem though – mpd has a hard-coded default of 10s trying to connect to a url and since I’m outside the UK, it was taking just over that to connect. I have ended up recompiling mpd with the curl default timeout of 300s and it solved my problem. If anyone has followed the original post and updated to the new url schema mentioned in Dick Wright’s comment but finds that mpd just lingers on each “track” for 10s then moves on without ever playing anything, you might have the same problem as me.

    Thanks again.

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

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