self-hosting my calendar, follow-up

February 27th, 2014 by lucas

Following my blog post on the topic, I played a bit with various options.

But let’s explain my use case (which might be quite specific). I need to deal with three main sources of events:

  • the Zimbra instance from my lab. It provides a CalDav interface.
  • the ICS export from my University’s teaching timetable.
  • a calendar for personal stuff. I don’t want to use my lab’s Zimbra for that.

Additionally, I follow some ICS feeds for some colleagues and other events.
I tend to access my calendar mostly on my computer, and sometimes on my N900 phone.

None of the web interfaces I looked at enabled me to (1) manage different calendars hosted on different CalDav servers; (2) subscribe to ICS feeds; (3) provide a CalDav interface to synchronize my phone.

I ended up using a radicale instance for my personal calendar, which was extremely easy to set up. It’s unfortunately a bit slow when there are many events (1600 since 2010 in my case), so I ended up importing only future events, and I will probably have to cleanup from time to time.

I switched to using IceDove with the Lightning add-on to manage all my calendars and ICS feeds. It’s unfortunately slower and less user-friendly than Google Calendar, but I’ll live with it.

On my N900, I used syncevolution to synchronize my various CalDav calendars. It works fine, but understanding how to configure it is rather tricky due to the number of concepts involved (templates, databases, servers, contexts, …). The synchronization is quite slow (several minutes for the 400-events Zimbra calendar), but works.

I also wanted a way to export my calendars to colleagues (both in a “free/busy” version, and in a “full information” version). I quickly hacked something using ruby-agcaldav (which is not packaged in Debian, and required quite a few dependencies, but it was easy to generate packages for all of them using gem2deb — the situation with other languages did not look better).
The resulting script is:

require 'agcaldav'
require 'date'

cal = => 'LABCALDAVSERVER', :user => 'xx', :password => "xx")
ev = cal.find_events(:start => '2014-02-01', :end => '2200-01-01')

cal = => 'RADICALESERVER', :user => 'xx', :password => "xx")
ev2 = cal.find_events(:start => '2014-02-01', :end => '2200-01-01')

limit = (Time::now - 7*86400).to_datetime

# create new empty calendars
ncpriv =
ncpub =

(ev + ev2).each do |e|
next if e.end < limit # drop old events to keep the calendar small

# build event for the free/busy calendar
pe =
pe.start = e.start
pe.end = e.end
pe.klass = "PRIVATE"
pe.transp = e.transp

# build event for the calendar with event information
pube =
pube.start = e.start
pube.end = e.end
pube.transp = e.transp
if not e.klass == "PRIVATE"
pube.summary = e.summary
pube.location = e.location

# export free/busy calendar
fd = File::new('xx.ics', 'w')
fd.puts ncpriv.to_ical

# export calendar with event information
fd = File::new('yy-Zeeh9bie.ics', 'w')
fd.puts ncpub.to_ical

So, mostly everything works. The only thing that doesn't is that I haven't found a way to subscribe to an ICS feed on my N900. Any ideas?

2 Responses to “self-hosting my calendar, follow-up”

  1. gregoa wrote on 02/28/14 at 1:42 am :

    my workaround for getting ICS feeds into my calendar on the N900 uses maecaltool:

    so I’ve created empty calendars, and then I have a shell script which basically does for a list of calendars:

    wget -q -O foo.ics "$URL"
    maecaltool --operation import --calendar "foo" --file "foo.ics" --verify [--clear] && rm -f "foo.ics"

    (besides that I’m “fixing” some of the .ics files before importing since the silly N900 calendar is quite silly^Wpicky.)

    far from perfect but good enough to have the calendars on my N900.

  2. lucas wrote on 02/28/14 at 2:52 pm :

    @gregoa: thanks!