Archive for June 2009
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.