I had a problem: I wanted to record my friend’s online radio show – it happened at a time when I wasn’t around to listen, but I was actually, genuinely interested in listening, and the station didn’t have any kind of podcast, or “listen again” system.
Linux/Ubuntu actually has a pretty nice gui called Streamtuner for recording online radio, however I didn’t want to have to leave my desktop computer on all the time – I wanted to leave a script running on a cronjob on a server somewhere.
It turns out that Streamtuner’s backend is a nice little CLI tool called Streamripper which proved to do everything I wanted.
It was pretty simple:
#!/bin/bash
#Make a nice file name
prefix=Awesome.radio.show
suffix=$(date +%e.%m.%Y) # date in UK time format
filename=$prefix.$suffix
#Record that Radio!
streamripper http://example.com/awesomefm.mp3 -u VLC -a $filename.mp3 -l 7400 -d /folder/to/store/recording/in/ --quiet
To explain the above slightly, streamripper tries to give the output files well documented, yet quite complex filenames – I just wanted “show.date.extension” which is what the above does.
To explain the arguments, the “-u VLC” bit makes the program identify as “VLC” rather than “streamripper” to the server, just in case some snoopy server admins get upset about it being recorded. The “-l 7400” argument specifies how long to record for – in this case (just over), two hours – specified in seconds.
After making my script executable, I simply put
59 15 * * 4 user /path/to/the/script.sh
in my crontab
Since the clock on which a radio schedule runs on, generally tends to be a bit flexible (and missing the first 30 seconds of the show being annoying!) I set it to record at 15:59 on Thursday. [Crontab syntax is well documented – go and look it up. :)]
And that was it! Now, whenever I want to listen to my friend’s radio show, I don’t need to make sure I’ve actually tuned in, just look in a folder on my server and have groove out!

