Just moozing

Before you can check your notes, you must make them…

Zim tasks in calendar

leave a comment »

zim logoI my last post, I wrote about python sandwiches. Naturally I felt inspired, and made one myself. This one takes the zim tasks list and converts it into an .ics file, that may be used in e.g. thunderbird or any other standards compliant calendar program.

I put the program on github, and I even wrote a readme.

 

Following my own outline from the previous blog post.

 

How does the input data look?

My initial plan was to use the zim python modules, and “ask zim” for the data. I got kind of lost in the structure, and decided to read from the task cache sqlite file directly.

I created a simple zim notebook, generated the index cache file, and set up thunderbird to read from the resulting .ics file to verify that it was working correctly.

 

What do you want output to be?

I want it to be an .ics file. This is the default calendar file format. I have used it before and know that it is easy to output and that it may read in most calendar programs.

And it is just a file, so we may overwrite it easily.

 

Find appropriate python modules

First plan was to use zims native modules, but I ended up with the sqlite3 python module. For output, I use icalendar.

These modules can do a lot more than what is needed, but I decided to keep it basic.

 

Code it

I did and put it on github.

 

Match the output with your example

I always want automated tests, but this program is 30 lines, so I decided against it. Had I been strict, I would have hand written an .ics file to compare the result against.

Having a simple way of testing, gives you the option of adding extra data/tests when the program fails for some input data. This is very useful.

 

Improvements and wishlist

  • Use zims task module instead of directly using sqlite. This will have at least two benefits: 1) future proofing it with respect to changing database structures, flies locations and such and 2) get easy access to “tags”.
  • Add some content to the events. Only having the heading is not always enough. Adding e.g. the tags to the description of the event, so “on hover” in thunderbird reveals more information.
  • Better handling of subtasks, so they don’t all appear in the event list.
Advertisements

Written by moozing

February 2, 2016 at 12:00

Posted in Tech

Tagged with , , ,

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

%d bloggers like this: