2/2/2005
getting the hourly news in mp3 format
Recipe for downloading the five-minute top of the hour news stream from NPR and converting it into mp3 format. Relies upon mimms, vlc, and lame. I had to use mimms because vlc won’t terminate upon reaching the end of an mms stream. I’m using lame’s phone preset, but you may find --preset voice to sound a little better. The hard part was getting VLC to output WAV format audio in faster than realtime. Unfortunately, NPR won’t stream the audio much faster than realtime, so the script takes about five minutes to run.
On OSX, you’ll want the path /Applications/VLC.app/Contents/MacOS/clivlc instead of just vlc.
#!/bin/sh
mimms -o /tmp/news.asf "mms://216.35.221.84/newscast/newscast.wma"
vlc -I dummy /tmp/news.asf \
:sout='#transcode{acodec=s16l}:std{access=file,mux=wav,url=/tmp/news.wav}' \
vlc:quit
lame -S --preset phone /tmp/news.wav /tmp/news.mp3
rm /tmp/news.wav /tmp/news.asf
Coming soon, an AppleScript that will pause iTunes at or near the top of each hour and play this (or another) mp3.