More on exporting and importing

Playing around some more with Oracle Calendar’s export feature, and the resulting data file, to try to get my all-day events to show up properly in iCal. First off, Oracle Calendar can actually export into two different formats, vCal and iCalendar. iCalendar is actually a newer spec that grew out of vCal. Apple’s iCal can import either format. This is significant, because when I export in iCalendar format, the all-day events get imported into iCal properly. When I use vCal, they show up as one-minute meetings starting at midnight.

So… let’s just use iCalendar instead of vCal, right? Wrong. First off, I have no problem exporting a small date range (say, a month) in iCalendar format. When I try to export a 3-year date range, Oracle Calendar goes off into la-la land and never comes back. OK, well maybe it eventually comes back, but I gave up after about 20 minutes and killed it. This happened with multiple clients on multiple machines, so it’s not just the Mac. It’s either having a problem with one of my entries (which would be a bug), or it just plain takes forever. Either way, this makes it unusable for my purposes.

Not only that, when I managed to successfully export an iCalendar file, iCal wouldn’t import it. It imports the first entry and then seems to quit. Not sure which app is at fault here, but don’t really care.

That leaves me with vCal. Oracle Calendar will export three years of data in vCal format in about a minute or so. Not exactly lightning fast, but usable. Now, how to get iCal to treat my events as events and not 1-minute meetings?

Here’s the deal: the vCal spec uses the DTSTART and DTEND fields to identify meeting start and end times, respectively. If you leave out DTEND, it treats the entry as an untimed event. And it works. If I edit the vCal file and remove DTEND from an untimed event, iCal imports it properly. Here’s a Perl script to do it:

#!/usr/bin/perl
#
while (<>) {
    print;
    if (/^BEGIN:VEVENT/) {
        printEvent();
    }
}
exit 0;


sub printEvent() {
    my @evData = ();
    my $miscFlag = undef;
    while (<>) {
        push(@evData, $_);
        if (/^CATEGORIES:MISCELLANEOUS/) {
           nbsp;$miscFlag = 1;
        }
        elsif (/^END:VEVENT/) {
            foreach (@evData) {
                print unless (/^DTEND:/ && $miscFlag);
            }
            last;
        }
    }
  }

Advertisements

One thought on “More on exporting and importing

  1. Pingback: Fruddled Gruntbugglies » Blog Archive » More on iCalendar vs. vCalendar export

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s