Jul 07, '05 07:47:00AM • Contributed by: jspivack
I wanted to automate this process, but the URL for the RealAudio stream changes every week. So I wrote an AppleScript that figures out what this week's URL is, and I call that script from Audio Hijack every Tuesday morning. Audio Hijack then passes the file to iTunes when it's done with it, where it gets added to a Smart "CarTalk" playlist. VoilĂ -- Car Talk in my car, every week!
Script: CarTalkByWeek
set today to current date
set NewYearsDay to date "1/1" of today
set SecondsOfYear to today - NewYearsDay
set WeekOfYear to round SecondsOfYear / weeks + 1 rounding down
set ThisWeeksCarTalk to "05" & WeekOfYear
set CarTalkURL to "http://play.rbn.com/?url=cartalk/cartalk/demand/CT" ¬
& ThisWeeksCarTalk & "-01.ra?url=cartalk/cartalk/demand/CT" ¬
& ThisWeeksCarTalk & "-02.ra?url=cartalk/cartalk/demand/CT" ¬
& ThisWeeksCarTalk & "-03.ra?url=cartalk/cartalk/demand/CT" ¬
& ThisWeeksCarTalk & "-04.ra?url=cartalk/cartalk/demand/CT" ¬
& ThisWeeksCarTalk & "-05.ra?url=cartalk/cartalk/demand/CT" ¬
& ThisWeeksCarTalk & "-06.ra?url=cartalk/cartalk/demand/CT" ¬
& ThisWeeksCarTalk & "-07.ra?url=cartalk/cartalk/demand/CT" ¬
& ThisWeeksCarTalk & "-08.ra?url=cartalk/cartalk/demand/CT" ¬
& ThisWeeksCarTalk & "-09.ra?url=cartalk/cartalk/demand/CT" ¬
& ThisWeeksCarTalk & "-10.ra"
tell application "RealPlayer"
open clip with URL CarTalkURL
end tell
To do's...
- I wish I could figure out how to handle errors from RealAudio if/when the script gets the URL wrong. "Handling errors" would generally mean sending myself an email.
- I wish I could figure out how to reliably wake my beige G3 (Jaguar) from power-off on Tuesday mornings to make sure the script runs; I tried ResurrXtion, but I couldn't get it working repeatedly/reliably.
