How to Record a Shoutcast Stream on a Schedule
by William Jackson on 2006-02-20
Have you heard? Iʼve been drumming up Labarum for the Latter Day for a while. But stuff keeps coming up and I miss it. I decided that I need to record the broadcasts automatically. This is how I did it.
This process can be generalized to record any shoutcast-compatible audio stream. Because of the nature of this operation, it is well-suited to be done on a server that is always running.
Hereʼs what you need:
- Unix, on a computer with internet access that is turned on (of course) at the time you want to record the stream. Servers work great. These instructions assume you have command-line access to your server.
- Perl. Most Unix computers have Perl installed already. Type
which perlto find out if you have Perl installed on your server.
cron. If you have Unix and you donʼt have
cron, something is wrong with you.
cronis the program that runs other programs on a particular schedule. Other programs like …
- icecream. No, really,
icecreamis the Perl script that does all the work. It wouldnʼt hurt to have some vanilla ice cream handy, too.
Hereʼs what you do:
icecream. Unzip the files and put them on your server somewhere. I put mine in
icecreamwhen you need to. Type
crontab -eto edit your
cronjobs. On a new line in the crontab file, follow the crontab format to specify when you want the job to run. Hereʼs what I used:
25 19 \* \* 3 perl /home/william/icecream/icecream -q --name=kvrx-\\%Y-\\%m-\\%d --stop=40min http://18.104.22.168/listen.pls
25 19 \* \* 3means the command will be executed at 7:25pm on the third day of every week.
perl /home/william/icecream/icecreamis the actual command to run
icecreamto not output anything (q is for quiet).
--name=kvrx-\\%Y-\\%m-\\%dgives the name of the file
icecreamwill create when it records the radio stream.
%Y-%m-%dgives the current date, while the backslashes are there to keep
cronfrom complaining. I learned that through trial and error.
icecreamto stop recording after 40 minutes have passed.
http://22.214.171.124/listen.plsis the location of the stream. 3. Wait for the appointed time to come around, then look in your home directory for the file that
icecreamcreated. Thatʼs all!
I should never miss recording an episode of Labarum for the Latter Day again.
Oh, and sorry. I know most of you hate reading or donʼt read this sort of stuff, but I want to have it around in case I need to do it again at some time in the future.