Simon Fell > Its just code >

Thursday, June 26, 2008

Sometimes full blown 2 way sync is just overkill, for some people just having a read only copy of their calendar in iCal is all they want, fortunately this is pretty straightforward, iCal supports subscribing to iCalendar feeds, and conveniently your Mac includes a copy of Apache httpd, so can easily run perl, python etc in response to a request. Throw in a library for accessing the API, and you have all the ingredients needed. I put this together in Python using Beatbox, it makes API calls to login and to query events, and to generate an iCalendar formated response, You then subscribe to the url on your local Mac in iCal to show the data in iCal with the rest of your calendars.

  • Download the code, this has the 2 files for beatbox, and the third is the iCalendar generator.
  • Unzip this and drop the 3 files into your /Library/WebServer/CGI-Executables folder.
  • From System preferences -> Sharing make sure that Web Sharing is turned on.
  • Quickly test it in safari, goto http://localhost/cgi-bin/ if everything works, you should see something that starts like
    PRODID:-//PocketSoap//pyCal 1.0//EN
    X-WR-CALNAME:Salesforce calendar : Simon Fell
  • Goto iCal, goto the calendar menu and pick subscribe, paste the URL from safari into the URL box, and then in the resulting dialog, pick how often you want it to auto-refresh (I'd suggest no more often than once a hour).

That's it!, you're good to go, you should have all your upcoming events now showing in iCal.