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:
- Set up a minimal web server on the Raspberry Pi
- Obtain your radio show as a podcast, with the programme information in an xml file.
- Generate the XML for the podcast feed.
- Subscribe in iTunes
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
This is left as an exercise for the reader.
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.
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 192.168.1.84/podcast.mp3, 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 <
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.