Ray Van Dolson's Blog

Pontifications from smoggy Southern California

Recording Streaming Automatically

leave a comment »

I wanted to record a streamed radio show automatically once a week at a certain time, for a certain duration. Enter mplayer, cron and a simple shell script:

# show.sh
DATE=$(date +%Y%m%d)

[ -f "$OUTFILE" ] && rm -f "$OUTFILE"

mplayer -dumpstream -dumpfile $OUTFILE $URL &
sleep 10800
kill $PID

Then add a cron entry as follows:

0 7 * * Sun $HOME/bin/show.sh

This will record the specified stream for three hours, every Sunday at 7am local time.

Written by Variant

June 23, 2009 at 8:38 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: