Ray Van Dolson's Blog

Pontifications from smoggy Southern California

Posts Tagged ‘streaming

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
URL="mmsh://url"
DATE=$(date +%Y%m%d)
OUTFILE="$HOME/Music/Show/show-$DATE.asf"

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

mplayer -dumpstream -dumpfile $OUTFILE $URL &
PID=$!
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 rayvd

June 23, 2009 at 8:38 pm