Radio Shows As Podcasts: Part 1 – The Set Up

I prefer to listen to radio shows and plays as podcasts than as normal mp3s or items in my library. There are various ways to obtain BBC radio shows as mp3 files, and to set the tags as needed to be added as podcasts in iTunes, which I will leave as an exercise for the reader.

Last time I put this together, I had my Raspberry Pi download the shows. I then wrote a python script to connect to the Pi, check the tags on the file and copy them across to my laptop into the “Automatically add to iTunes” folder. This script had to run each night, and (due to the slow speed of my home network) would only work if I was in a particular part of the house and had the network share mounted. It also didn’t manage the files on the Raspberry Pi.

Rather than attempt to update this script, I’ve taken the far more elegant approach of turning my Raspberry Pi into a podcast server for my home network. This approach is incredibly simple, and should require far less work on my part to manage the files and ensure the tags are all as they should be.

There are 4 basic steps to this approach:

  1. Set up a minimal web server on the Raspberry Pi
  2. Obtain your radio show as a podcast, with the programme information in an xml file.
  3. Generate the XML for the podcast feed.
  4. Subscribe in iTunes

1. Set up a minimal web server

I chose to run the minimal web server lighttp, which was as straightforward as it comes. Simply run

sudo apt-get install lighttp

to install and start the web server. The server directory is found in /var/www/

Obtain your radio show

This is left as an exercise for the reader.

Generate the XML for the podcast feed

I will go through this step in Part 2.

For initial set up and testing, I simply copied XML from an existing podcast feed, e.g. from The Guardian’s Rugby World Cup Podcast.

Subscribe in iTunes

Subscribing in iTunes is as simple as selecting File > Subscribe to Podcast… and entering the internal url to the XML file. iTunes should then automatically start downloading the podcast from the Raspberry Pi, as per your default podcast settings.

Notes on Set Up

I had a few problems when initially setting this up. First, I have the podcast files on an external disk, rather than the /var/www/ folder, which is on the Raspberry Pi SD card. I simply created a symbolic link within the /var/www/ folder pointing to where I store the podcasts to solve this problem.

Second, and the most frustrating problem, was that I could not get iTunes to download the podcast files using a link in the <encode url="…"> XML tag. I could point my browser to the file, e.g. to, and it would play. So why wasn’t it downloading through iTunes? Well, it turns out that iTunes can only resolve the address of the podcast file if http:// is included at the start of the address in the <encode> tag.

A minor, third, problem, is that iTunes will not download the file if the length property of the <encode> tag is wrong.

Next: Part 2, where I will go through writing a Python script to automatically generate the XML for the podcast feed. This will involving checking when a new podcast is created in a watched folder and scraping its XML file for the relevant information.

This entry was posted in Blog, Programming, Python, Raspberry Pi. Bookmark the permalink.

Leave a Reply

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