Tuesday, July 7, 2009

XM alarm clock

So I thought I'd share how I set up an XM alarm clock on the mac.

What you need to do, in the end, is somehow bring up their little plugin iframe content in a page. But in order to do that, you need to tickle the login page first. Fortunately, it's relatively easy to do with JQuery. What you do is make an AJAX call to the login page, and have the success function add an iframe to the page with the URL of the player.

You can download the html file here. You need to edit the HTML page to put in your credentials and the channel number that you want. If you save the resulting page somewhere on your machine and then double-click it in the finder, the resulting browser window should start playing the channel of your choice (assuming your machine has Internet connectivity).

To this point, this solution is platform independent, so long as your browser has the plugin support to play the audio stream. The next thing you need to do is somehow cause your machine to open the file at the time desired. I'm confident there's a way to do this on Windows, but I don't really care. So sorry.

On the mac, you use cron to schedule things. The thing you need to schedule is:

osascript -e 'open location "file:///path/to/html_file"'

And that's all there is to it.

No comments: