## Time-stamp: <2013-03-01 14:02:09 vk> ## -*- coding: utf-8 -*- ## This file is best viewed with GNU Emacs Org-mode: http://orgmode.org/
This Python script converts a given iCalendar file and filters out everything except:
- dates and times (DTSTART and DTEND)
- UIDs
- pre-configured tags from the CATEGORIES field
Please refer to the Features section below for details.
Source: https://github.com/novoid/convert_iCal_to_free-busy-only
- target group: Privacy-concerned users of Org-mode who want to publish their free/busy list online
- skills necessary: invoking a Python script (command line)
My use case: I generate my iCalendar files with Org-mode using its iCalendar-export for Google Calendar synchronization. The filtered iCalendar file is used to feed a Google Calendar account which holds only my free/busy information.
I do not want to give everybody access to my Google Calendar because of privacy issues. Additionally, I do like the principle of least necessary permissions. I would never share my detailed Google calendar with a bigger group of people.
However, with a filtered iCalendar file on my web server, I can create a Google Calendar which contains only the time/date information of my events. I am happy to share this information with all of my friends since there is minimum of information about my calendar and maximum of information about when I am free or busy.
Pre-configured tags like “company” or “@office” optionally can be written to the location and summary field.
Yes, Google Calendar does provide a free/busy only sharing option. However, at the one hand, I want to be absolutely sure about what’s happening here. On the other hand, I want to have a more fine grained control on what information should be published. Some tags I find handy to include, others not.
The entry …
BEGIN:VEVENT UID: TS-4e622ec4-ffac-4097-82c6-3b12632d3e33 DTSTART:20130116T120000 DTEND:20130116T140000 SUMMARY:Going to my doctor DESCRIPTION: Neck pain is already disturbing my productivity. CATEGORIES:neck,@town END:VEVENT
… gets transformed into …
BEGIN:VEVENT UID: TS-4e622ec4-ffac-4097-82c6-3b12632d3e33 DTSTART:20130116T120000 DTEND:20130116T140000 SUMMARY: busy LOCATION: town END:VEVENT
… with default settings and …
BEGIN:VEVENT UID: TS-4e622ec4-ffac-4097-82c6-3b12632d3e33 DTSTART:20130116T120000 DTEND:20130116T140000 SUMMARY: health LOCATION: town END:VEVENT
… when you decide to automatically replace the “neck” tag with “health”.
- 100% control over your personal data
- more fine-grained control on what information is published and what not
- most probably you’ll need an additional Google account for your
free/busy calendar
- I don’t want to see every event twice: the detailed information and the filtered event as well
- it’s a “works-for-me” solution and not a big, fancy product
- you have to be comfortable in using the shell and such
- things that are not altered:
- complete header
- dates and times (DTSTART and DTEND)
- UID
- BEGIN:VEVENT and END:VEVENT
- things that are modified:
- SUMMARY: replaced with DEFAULT_SUMMARY (set in the header of the Python file)
- things that are ignored
- everything else
You can define a list of pairs in CATEGORIES (in the header of the Python file). For example: [“foo”,”something descriptive”]
In each CATEGORIES field (like “CATEGORIES: foo,bar”), the script is looking for matches (here: “foo”) and takes the replacement string (here: “something descriptive”) as the new SUMMARY field in the iCalendar entry.
Additionally, if any category starts with an @-sign, it will be added to the LOCATION field. For example: “@home” will result in “home” in the LOCATION field.
You can define @-tags in the CATEGORIES list as well: [“@home”, “at my flat”] will result in LOCATION entries with “at my flat”.
Similarily, SUMMARY is a list of pairs where strings are searched in the summary field and corresponding replacement strings are added to the new summary line. I am using this with [“DND”, “phone will be turned off”]: if “DND” is found in the description, my phone goes to silent mode automatically (using Tasker). It’s cool to be able to add this to the free/busy list.
Something which I do as well: If the old summary line starts with ” ? “, the event is not finalized/fixed. It might not happen at all. I replace this indicator with a hint in the new summary line.
In SHOW_SUMMARY_TAG you can define a tag for entries, where the original summary should be included in the output. For example, when I use the tag “public” for an event, its summary does not get filtered out.
I am looking for your ideas:
If you want to contribute to this cool project, please fork and contribute!