DIY "podcast" for This American Life
If you can't afford to buy This American Life at between $4 and $13 per episode and you think that Audible is evil and you're running a relatively current Linux with MP3 and Real installed... then the script below will fetch TAL episodes. This presumes a "root" directory of $HOME/podcasts within which will be created directories named for the date (yyyy-mm-dd). Prerequisites:
- mplayer
- Real codecs
- LAME
- GNU "bc" calculator program
Setup:
- In the $HOME/podcasts directory create a file named "ThisAmericanLife.log". Add one line to it with the one lower than episode number with which you wish to start.
- Schedule the script to run nightly via cron
- When the script runs without any arguments it will extract the last line of ThisAmericanLife.log, add one to the value and use that as the episode number to fetch.
- The RealAudio version of the episode is fetched and saved as a WAV using the mplayer program. This fetching runs in "real time" so fetching a one hour show takes an hour. Except sometimes it doesn't and downloads very quickly. No clue why. Some weirdness in mplayer.
- After the WAV file is fetched it is converted to MP3 using the LAME program. The MP3 is tagged and stored in a directory named for the date and the WAV file is deleted.
- Could scrape the website for the episode number. But then you'd get reruns. So it doesn't do that. If you seed the log file with the current episode number (minus one) then you'll only get new episodes with no reruns.
- Could scrape the mplayer output and get the episode title.
- Just one so far. If you run the script with a numeric argument it will fetch that episode.
cd $HOME/podcasts datedir=$(date +%Y-%m-%d) episode=$1 if [ -z $episode ] ; then episode=$(echo $(tail -n 1 ThisAmericanLife.log )+1|bc) fi echo Fetching episode $episode /usr/bin/mplayer -playlist http://www.thislife.org/ra/$episode.ram -ao pcm:file=tal$episode.wav -vc dummy -vo null if [ -e tal$episode.wav ] ; then echo $episode >>ThisAmericanLife.log sort -nThisAmericanLife.logtemp mv ThisAmericanLife.logtemp ThisAmericanLife.log if [ ! -d $datedir ] ; then mkdir $datedir fi /usr/bin/lame -V -vbr-new -h --add-id3v2 --tg Speech --tt "This American Life episode $episode" --ty 2006 --ta "Ira Glass" tal$episode.wav $datedir/tal$episode.mp3 rm tal$episode.wav fi