Wouldn’t it be nice if the huge number of radio programmes on the BBC iPlayer were also available as podcasts? Well, too bad. They’re not. You get the BBC’s arbitrary selection of their programmes, and that’s it.
I’m forever missing episodes or series or getting annoyed that I can’t reliably listen on my commute, so I decided to rustle something up to pull BBC radio programmes into my podcast app. I call it iCaster, because it seemed the obvious thing to call it.
iCaster is written in Python, and it doesn’t do very much, because more competent people than me have already made most of the necessary tools to make this happen. I just had to tie them together with my own poorly-made string. It uses:
- get_iplayer, which can download TV and radio from iPlayer and has a handy PVR function.
- Mutagen, a Python library, to read the tags of the files from iPlayer.
- PyRSS2Gen, another Python library, to generate the RSS feed.
It works using three scheduled tasks:
- get_iplayer’s PVR function is triggered, to check for and download new episodes to the iCaster audio directory.
- iCaster runs, scans the audio directory, and builds an RSS feed out of everything it finds.
- Files in the iCaster audio directory older than 14 days are deleted so that my server doesn’t fill up with old episodes of Just a Minute.
Make sure the feed and the episodes are somewhere your podcast app can see them, subscribe to the feed, and away you go. So far it’s working delightfully for me, although because radio programmes are quite conservatively trimmed for iPlayer you still run the risk of accidentally hearing a bit of the Archers at the start.
Here’s the script; you’ll need to edit it to fill in a couple of paths before it will work.
If you have any questions or improvements, drop me a line.