Recording Streaming Radio (improved)

Save this script as 'radio'
# $1 = URL
# $2 = Title
set -e
TMP="/tmp/radio-`perl -le 'print localtime()'`"
mkfifo $TMP
DATE=`date +%Y-%m-%d`
MP3="$HOME/Desktop/$2 $DATE.mp3"
lame $TMP -o "$MP3" -V 2 --tt "$DATE" --tl "$2" --ta "Radio" --ty "`date +%Y`" --add-id3v2 --pad-id3v2 --ignore-tag-errors --quiet &
mplayer -playlist "$1" -vc null -vo null -prefer-ipv4 -bandwidth 8000000 -ao pcm:fast:waveheader:file=$TMP &
trap "kill $MPLAYER_PID; echo 'killed recording'; exit" HUP INT TERM
trap "kill $LAME_PID; rm $TMP; exit" EXIT
Then run it weekly like this:
radio '' 'Mary Anne Hobbs: Breezeblock'
or like this:
radio '' 'Resonance FM'

To automatically add the MP3 to iTunes (on Mac OS X) when it's complete, add this line to the end of the script:

osascript -e "tell application \"iTunes\" to add POSIX file \"$MP3\" to playlist named \"Radio\""