The great Manish Sinha has blogged about the development of Zeitgeist-Sharp bindings. Since I am too lazy/busy and preparing some new stuff for UDS, I just posted his whole blog post.

Introduction to Zeitgeist

I hope many of you must have heard about Zeitgeist, an event logging framework which is becoming mature day by day. In the language of Zeitgeist developers, here is the definition

Zeitgeist is a service which logs the users’s activities and events, anywhere from files opened to websites visited and conversations.
It makes this information readily available for other applications to use.
It is able to establish relationships between items based on similarity and usage patterns.

Zeitgeist sits as a daemon and activates a Session bus (DBus) over which applications can send their events. Using a great DBus API, events can be logged, retrieved and also monitored asynchronously. If you want you can also write extensions for the daemon(like full-text-search and blacklist). It is developed using python and uses nepomuk ontologies to establish relations between various events.

API Wrappers

The daemon is useless if the apps dont push data into it. So, some of the developers of zeitgeist engine have a python client binding which wraps the bus and gives a higher level view of the API. Authors of Python wrapper are Seif LotfyMarkus KornSiegfried Gevatter and Mikkel Kamstrup Erlandsen.

There is one wrapper which is complete and is called libzeitgeist. It is C/Vala binding over Zeitgeist API. It is written by Mikkel Kamstrup Erlandsen and Michal Hruby

Are all apps written in python? Is Banshee/Tomboy/F-spot written in python? One great aspect of FOSS is that all the developers are free to choose the language and technology of their choice. Banshee/Tomboy/F-spot devs chose their technologies. The technology chosen is just a part of the reason an application can be great. The real work is in actually making a great application in which Banshee/Tomboy and F-spot devs have succeeded.

You might be thinking that Mono apps would have had zeitgeist integration by now? The answer is sadly no. Seif Lotfy had once tried implementing Tomboy integration. The problem faced is that the API wrapping code has to be replicated in all the apps. Solution: Make it a separate library named zeitgeist-sharp

Once the library matures, the efforts on integrating zeitgeist in mono apps reduces considerably and you can see all your favorite mono apps being powered with Zeitgeist. Banshee can have last.fm style logging on what music you have listened. This information contains the tracks played by other players which you have used on the computer (like mpd or Rhythmbox or Clementine)

The Solution

One fine day, Seif pinged me and asked if I can write a mono wrapper over the API since the daemon team is too busy. I created most of the wrapper functionality with constant support from Seif. I was later joined by Mirco Bauer(meebey) who is on Debian CLI Team. He did the QA and writing the build scripts. Later I wrote the unit tests.

We are about to release the library, but as all of you know, code is never perfect. To achieve as much perfection as possible, we need you help. If you are free, you can test out the code. The process is very simple. Get these packages. The version in the brackets are preferred ones

  • MonoDevelop (2.4)
  • Monodevelop-debugger-mdb (2.4.3)
  • monodevelop-nunit (2.4)
  • ndesk-dbus-glib devel (0.4.1-3)
  • ndesk-dbus devel (0.6.0-4)
  • mono-devel (2.6.7)
  • bzr

If you are on Ubuntu 10.10, just one command can suffice

sudo apt-get install mono-devel monodevelop monodevelop-debugger-mdb libndesk-dbus-glib1.0-cil-dev monodevelop-nunit bzr

Get the trunk code by

bzr branch lp:zeitgeist-sharp

  1. Goto the folder, double click on the Zeitgeist.sln file.
  2. Click on Build>Build All
  3. Click on View> Unit Testing
  4. Click on Unit Testing dockable window and and click on Run Test button. Alternatively you can double-click on the first element in the tree expander
  5. All the unit tests should pass and should show Tests: 84 Failed: 0 Ignored: 0

Here are the screenshots

Open Zeitgeist.sln in MonoDevelop 2.4How to show the Unit Test dockable window

How to run the Unit Tests

The expected output after running unittests

All the tests should pass, so that we can be confident of the first release. If a test fails, please right click on the failure message, click Copy and file a bug. Please check whether the bug has already been filed. Please note that this is not a release.

License: The code is released under MIT/X11 License.

If you have time and have lots of excitement, then you can catch us at #zeitgeist on Freenode. I am m4n1sh, seif goes by seif, seif_ or seiflotfy and Mirco as meebey

Hoping on getting a lot of community love.