I'm finally timeshifting radio again
Today's bundle of little discoveries:
- DSBRTuner has been updated to support AppleScript since last I downloaded it.
- DSBRTuner has been updated to record to MP3 on disk.
- MacOSX has a command called
osascriptwith which you can launch AppleScripts (among other things) from a shell.
osascripthas an option
-eto run a one-liner from the shell.
Given these discoveries, I was able to cobble together a quick pair of scripts with which to schedule recording radio broadcasts to MP3 via cron.
Wow. Another little project that became, all of a sudden, so much easier than I thought. I love Unix and OS X. Before this, I'd been looking high and low for all the parts: a scheduler, a sound recorder, an app controller, etc & so forth. Given the source code to DSBRTuner, I was almost about to hack some solutions into it, but I'd never gotten the time.
Now, I can happily record and listen to my favorite late Sunday night radio show during the week again!
Oh yeah, and the ugly scripts:
#!/bin/sh FREQ=$1 MP3_FN="$2-`date "+%Y%m%dT%H%M%S"`.mp3" OSA=/usr/bin/osascript TELL='tell application "DSBRTUNER" to' open /Applications/DSBRTuner.app $OSA -e "$TELL set frequency to $FREQ" $OSA -e "$TELL record to file "$MP3_FN""
#!/bin/sh OSA=/usr/bin/osascript TELL='tell application "DSBRTUNER" to' open /Applications/DSBRTuner.app $OSA -e "$TELL stop recording" $OSA -e "$TELL quit"