Importing foreign (non-iCal) calendars into Google Calendar

August 19, 2008 at 3:24 pm | In Free State Project, Python |

Google Calendar is highly useful. I use it to keep track of all my appointments and due dates and I get helpful reminders when dates approach via email and SMS. Not only that, but it allows me to collaborate with other people's calendars as well, and they don't even have to use Google Calendar because Google supports the industry standard iCalendar format. Things are great.

Unfortunately, iCalendar format is pretty new, and not everyone is using it.

Because Google Calendar is so useful, it is annoying when you find a calendar that is not in iCal format. Two of note that I want to follow are

Both of these calendars are running Simple Machines Forum, version 1.x which does not support iCalendar format (presumably they will in 2.0).

So I wrote an exporter: Download SMF iCal exporter

The exporter scrapes the calendar page on an SMF enabled site and dumps out an iCal compatible file.

Usage: smf_ical_converter.py -u http://yourforum.com/index.php -o cal.ics

Download a SMF 1.x forum calendar and dump in iCal format

Options:
  --version             show program's version number and exit
  -h, --help            show this help message and exit
  -u URL, --url=URL     URL of forum (up to and including /index.php)
  -n Name, --name=Name  Name of the Forum / Calendar (name goes in .ics file)
  -i EXPR, --ignore-re=EXPR
                        Ignore any event containing this regular expression
                        (specify as many -i as you want)
  -o File, --output=File
                        iCal filename to write
  -v, --verbose         Be verbose about process
  --months-backward=NUM
                        Number of months to go backward
  --months-forward=NUM  Number of months to go forward

I have this tool running in a cron job to keep up to date with the two above mentioned calendars. You can import these URLs directly into your Google Calendar:

Update 09/16/08: I uploaded version 2 of this application. It has a better README and it now supports user specific date ranges.


6 Comments »

RSS feed for comments on this post. TrackBack URI

  1. Hey, thanks for the great article and attention to this ever frustrating problem! :D

    As I am s bit new to PHP, etc.. and have dry feet when it comes to Python.. can you give me a step by step on how to set this up to simply create 1 'dump' of the SMF calendar data to be imported into Google Calendar??

    Thanks again!!
    I know a lot of others that I'll be directing here as well.. they need this info!
    J

    Comment by Jesse — September 15, 2008 #

  2. Hi Jesse,

    I'm assuming you've got Python installed. If not check out the Python Beginners Guide.

    Once you've got the script downloaded, on the command line you'd type something like this:

    python /path/to/smf_ical_converter.py -u http://nhunderground.com/forum/index.php -n "NH Underground" -i "Birthdays:" -o /path/to/nh-underground.ics

    The /path/to/ parts in there would simply be a directory of your choosing.

    The -i "Birthdays:" part tells the application to ignore any calendar entry with the text "Birthdays:" in it. In this case I didn't want all the NHFree birthdays showing up on my google calendar.

    the -n "NH Underground" part is simply a name that I gave to the calendar and is the name that the calendar imports as inside google.

    Let me know how it works out for you and what you're using it for, I'm glad its of use to people out there.

    -Ryan

    Comment by ryan — September 16, 2008 #

  3. Hi again Jesse,

    I uploaded version 2 of the script, it has a better README in it. I didn't realize how bad the first one was. (it was more of a note to myself than a README)

    Thanks for dropping by,

    Ryan

    Comment by ryan — September 16, 2008 #

  4. hi there Ryan, I am very glad to read this post. I was just today putting together a nationwide calender (in Google Calendar of course) or anarchist meetups and events. And high on my list is NHU and FSP… of course I have the same problem with lack of iCal as you :-/ I'm going to give this script a go. A couple questions: First, is there anyway you can be a middle man until FSP and NHU have iCal enabled sites? I mean, could you share a calendar that I could add to my own calendar? Second, if you don't want to do that, a question about the script. Do I need to clear my calender before I re-import (say once a month), I mean, will re-importing the .ics files create dupe entries?

    Comment by Gavin — October 23, 2008 #

  5. Hi Gavin,

    At the bottom of the post is an ical file for NHU. Unless there is some sort of problem, those files are updated every 2 hours.

    I import those into google calendar (by URL, not by uploading) and google automatically captures the updated ics file every so often. How often that is, I have no idea.

    Feel free to use the ics files above whenever you need them. I can't guarantee they will always work, but I'll do my best.

    By the way, I don't have any ics file for the FSP because they have their own ical file that they host here: http://www.freestateproject.org/event/ical/all/all

    Comment by ryan — October 24, 2008 #

  6. great!

    Comment by Gavin — October 24, 2008 #

Leave a comment

XHTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Powered by WordPress.
Entries and comments feeds. Valid XHTML and CSS. ^Top^
XML Sitemap