KISS

Keep It Simple Stupid

Creating birthdays calendar

| comments

Yesterday I pushed a v0.5 release of my new tiny utility b2c. It solves the problem of generating a birthdays calendar for fastmail. Fastmail does have an autogenerated birthdays calendar feature, but it lacks any settings to setup reminders, and there are no reminders for those events by default, which makes it mostly useless to me.

b2c is a tool that reads a vCard 3.0 contacts file and generates an iCalendar calendar file with one event for each contact that has birthday information. Unfortunately fastmail doesn’t have official APIs to access contacts and calendars, so the workaround is to export the vcf file with all contacts, run b2c, and import the generated ics calendar file to fastmail via the web interface. Since my contacts list is pretty static, this is good enough for me.

It’s interesting that about ten years ago, when I was using gmail, I had the exact same problem there and solved it with a python script that used goog APIs to get the contacts and create events. That script is long gone now I think, and it was goog-specific anyway, so I developed a new program.

I set the version to 0.5, not 1.0, because this code is based on a proof of concept — I’ll be testing the generated calendar for some time, and the tool may be useful to someone in its current state. A TODO here is to add more unit tests for the vCard parser to make sure parsing is indeed correct. The program doesn’t have understand any options at this time either and all the configuration is hardcoded, most importantly the name pattern for the events and the time of the alert for the events.

The program can parse both full birthdays (per RFC, e.g. BDAY:1984-12-01) and “partial”, year-less birthdays, which fastmail generates using this format: BDAY;X-APPLE-OMIT-YEAR=1604:1604-12-01. The generated events don’t care about the year because they are repeated yearly with the same name, starting with the year when you run the converter.

These two posts have some implementation details about the vCard parser:

The source code is on github: https://github.com/eunikolsky/b2c.

Comments