It stands for "my domain is shorter than your domain"

Radio 4 without the Archers


As requested by @libbymiller, here is my Python script that plays the best radio station in the world: Radio 4 without the Archers.

It works out the time until the next Archers episode, then plays the Radio 4 stream, slowed down just enough to allow you to skip the next episode.

Note that if you are unfortunate enough to start the script while the Archers is already on, there’s little we can do but ensure you won’t be subjected to the next episode.

It’s very crude, has no error checking and just runs on an infinite loop. It requires VLC for playback. It’s been tested on Linux and Mac (I think).

Feel free to improve upon it. It should be easily adaptable for other programme schedules too. Gardeners’ Question Time comes to mind.

Full source code below the fold. Save it as archless.py. I hereby release it under the WTFPL.

#!/usr/bin/env python

import sys
from datetime import datetime, date, time, timedelta
import os

stream_url = "mms://wmlive-acl.bbc.co.uk/wms/bbc_ami/radio4/radio4_bb_live_ep1_sl0"
vlc = "/usr/bin/vlc"
vlcdefopts = "--intf=dummy"

schedule = [
    {'day':6, 'time':"19:02", 'duration':12.5}, # Sunday
    {'day':0, 'time':"14:02", 'duration':12.5}, # Monday repeat
    {'day':0, 'time':"19:02", 'duration':12.5}, # Monday
    {'day':1, 'time':"14:02", 'duration':12.5}, # Tuesday repeat
    {'day':1, 'time':"19:02", 'duration':12.5}, # Tuesday
    {'day':2, 'time':"14:02", 'duration':12.5}, # Wednesday repeat
    {'day':2, 'time':"19:02", 'duration':12.5}, # Wednesday
    {'day':3, 'time':"14:02", 'duration':12.5}, # Thursday repeat
    {'day':3, 'time':"19:02", 'duration':12.5}, # Thursday
    {'day':4, 'time':"14:02", 'duration':12.5}, # Friday repeat
    {'day':4, 'time':"19:02", 'duration':12.5}, # Friday
    {'day':6, 'time':"10:00", 'duration':75.0}  # Sunday bloody omnibus

def secondsFromNow(ep):
    now = datetime.now()
    daysfromnow = (ep['day'] - now.weekday()) % 7
    eptime = datetime.combine(now.date(), datetime.strptime(ep['time'], "%H:%M").time()) + timedelta(days=daysfromnow)
    secondsfromnow = (eptime - now).total_seconds()
    if (secondsfromnow < 0): # Today's episode already passed
        secondsfromnow = secondsfromnow + timedelta(weeks=1).total_seconds() 
    return secondsfromnow

def nextEpisode():
    nextep = schedule[0]
    for ep in schedule:
        if (secondsFromNow(ep) < secondsFromNow(nextep)):
            nextep = ep
    print "Making next %d seconds last for %d seconds" % (secondsFromNow(nextep), secondsFromNow(nextep) + (nextep['duration'] * 60))
    runtime = (secondsFromNow(nextep) + (nextep['duration'] * 60))
    playspeed = secondsFromNow(nextep) / runtime
    execstr = vlc + " " + vlcdefopts + " --rate="+str(playspeed) + " --run-time="+str(int(runtime)) + " " + stream_url + " vlc://quit"

def main():

if __name__ == '__main__':


  1. Pingback: RT @PottyBot: A python script that plays Radio 4,… | Ali's Li'l Place on the Net

  2. Brilliant!

    Minor bug: if started at ~18:45 on (currently) Mondays you’ll get the well-known pannel game “Just Two Minuites”…

  3. Managed to get this working on Windows by replacing /usr/bin/vlc with \”C:\\Program Files\\VideoLAN\\VLC\\vlc.exe\”

    It works, but it often falls over on the Radio 4 stream for some reason. VLC exits, then the script starts a new instance with the latest parameters and you miss a bit of the programme – the bit that the old instance had buffered but not yet played.

  4. I got this to work on Windows outside the UK by doing Richard’s change and grabbing another URL from http://www.radiofeeds.co.uk/query.asp?feedme=BBC+Radio+4+%28FM%29

    So (remember indents before vlc= if they’re stripped from this comment):

    stream_url = “http://www.bbc.co.uk/radio/listen/live/r4_aaclca.pls”
    if sys.platform == “win32”:
    vlc = “\”C:\\Program Files (x86)\\VideoLAN\\VLC\\vlc.exe\””
    vlc = “/usr/bin/vlc”

    For a harder challenge, how about the next best radio station in the world: Radio 4 without the Archers and without the National Anthem at Closedown?

  5. (Of course, if you’re outside the UK but in a different time zone, you’ll need to adjust the times for your timezone.)

Leave a Reply

Required fields are marked *.

This site uses Akismet to reduce spam. Learn how your comment data is processed.