I'm a fan of Garrison Keillor and A Prairie Home Companion. Kansas German Lutherans aren't quite as shy as Minnesota Norwegian Lutherans, but it's a close race, and there are a lot of parallels between Lake Wobegon and Holyrood.
So I like to listen, but never get to hear an entire show.
Problem: I just can't take two hours out of every Saturday night to listen to the show. (I'm a busy (ex-)Kansas German (ex-)Lutheran.)
However, I spend 3-4 hours a week at the gym, and I have an Samsung YP-U1 MP3 player (inherited from Youngest Child after the purchase of an iFollowtheCrowdPod). So can we somehow get the show onto the MP3 player?
Yes! PHC has an archive where you can find old shows.
Solution: Download the streaming media, convert it MP3 or OGG (the Samsung plays both).
But how? With mplayer. However, first we have to find the stream, and then capture it.
It's not as simple as all that, as the PHC site hides the file pretty well. Here's the procedure for last Saturday's (April 21) show, which just went on line:
- Go to the archive page, and select the month and year of the program you want to hear. Click GO
- Scroll down to the show you want, click on the date.
- On the next page, right click on the “Listen to the whole show” line, and chose the “copy link location” option.
- Open a terminal window, change to the directory where you want to save your files, write “wget” on the command line and then middle-click. This will produce the command:
which will return a file named 21_phc.ram. (Obviously the numbers will change with the date of the show.)
- $ wget `21_phc.ram`
(Note that those are backquotes.)
- This yields a file named 21_phc.smil. If you cat that file, you'll find a string like
That's the audio stream.
- From here it's simple, if you read the reference article:
mplayer -vc null -vo null -ao pcm:file=phc_070421.wav rtsp://archivemedia.publicradio.org/5559/phc/2007/04/21_phc.rm
- This produces a WAV file. You can produce MP3s directly with this method, but they are terribly compressed.
- After the two hours are up (this is streaming media, remember?), go back to the command line and compress the file. Since the Samsung reads Ogg format, I use:
sox phc_070421.wav phc_070421.ogg
which produces a file that I can store on the Samsung and listen to in the gym.
Of course, now that you know the trick it's trivial to write a script to do the whole thing every week, but I wanted to note how you find all of this out, in case PHC changes the format of the files involved.