I’m up outta here tomorrow for Spain, and I realized that I’ll be missing out on my This American Life shows, so I am revisiting time-shifting my radio. I’ve got a D-Link USB Radio plugged in to my linux machine. I just had to install Alsa, lame, and fmtools and come up with a script to marry them. Here’s what I came up with:
#!/usr/bin/ruby -w
raise "#{$0} <name> <freq> <seconds>" if ARGV.length < 3
show = ARGV[0]
freq = ARGV[1]
seconds = ARGV[2]
FM = '/usr/local/bin/fm'
LAME = '/usr/bin/lame'
AMIXER = '/usr/bin/amixer'
ARECORD = '/usr/bin/arecord'
file = "#{ENV['HOME']}/#{show}_#{Time.now.strftime('%Y-%m-%d')}"
# Tune the radio
%x{#{FM} #{freq} 65535}
# Set up the mixer settings
%x{#{AMIXER} -c 0 set Line,0 100%,100% unmute cap}
%x{#{AMIXER} sset Capture 75%,75% unmute cap}
%x{#{ARECORD} -f cd -t wav -d #{seconds} #{file}.wav}
%x{#{LAME} --quiet -m j --preset standard #{file}.wav #{file}.mp3}
%x{rm #{file}.wav}
Then just set up my crontab to record the show:
0 19 * * Fri /home/aaron/record.rb TAL 94.9 3600
[/sourcecode]
Now I'll have This American Life waiting for me when I get home!
this posting is so nerdy that it’s doubly-nerdy, which means it cancels itself out and is now identified as a non-entity-blog-entry. sorry i had to be the one to tell you. i’ll miss you sissyboy! have fun!
You can’t get away with a “comment goodbye”. You are getting a phone call when I get to the airport young lady.
You can do this much easier just by downloading the episode from the TAL shoutcast server. Just do
curl -O -A ‘iTunes/4.7 (Macintosh; N; PPC)’ http://wbez-tal.streamguys.us:8020/content/313.mp3
Obviously replacing the 313 with the episode number. Voila!
Awesome. I came up with this script before TAL had a podcast, but this is much easier!