Saturday, October 21, 2006

Python Skype API

Hrmph. My Python wrapper using the ctypes module which comes with Python 2.5 segfaults. I can check if Skype is running, using the IsSkypeRunning() call, but as soon as I try to use SetSkypeDelegate() it segfaults. Now I'm downloading ctypes 1.0.1, perhaps there's more docs and examples there. Especially on how to use the Structure class with Python callbacks.

Update: No avail. Either SF is down or I don't know what. I'm unable to download the ctypes stuff.

Skype API

I just discovered the Skype API. I know, Skype is not open-source, but hey ...

The API is quite cool. Apart from the pretty obvious API access to the voice call and chat stuff, there's an API for transparently sending raw streams between programs. So, one could use the Skype API to use a pretty nifty transparent channel to send data between applications. They call this the Application2Application Protocol.

This could be the last building block I need for a pet project I have, the Personal Information Server. There I need a method to communicate with different PIS in a P2P manner, no DNS name resolution and stuff. Transparent "just works" type of communication.

Using the PIS one would mark certain types of information managed by the PIS as "public", and other PIS (those from your friends, co-workers, company , ...) would
query any "new" stuff and incorporate this new stuff into their own information store.

Using the Skype API, this could work out pretty nifty:

  • You start up your PIS instance
  • the PIS instance checks whether or not you're online with Skype
  • if you're online:
  • check if my buddies are online and have their PIS started
  • fetch the new stuff (contact info's, phone numbers, events, blogs, ...)

So, in theory, if you start up your PIS, it begins to sync with your peer PIS from your friends. That way, contacts and events stay synchronized, even if you're not online all the time, and even if you're behind a firewall.

You could also have more than one PIS, one on the road on your laptop, one at home, etc.

Nifty.

I think I'll play around with this stuff a bit. I've found no python bindings yet, but hey, at last we all have ctypes now with python 2.5, don't we ;)

Horrible week.

Phew, this was a horrible week.

Really.

First, I had to boot our old SGI Octane machine because a customer wanted a new release of an CAD Model analysis tool we wrote. Thanks god it booted. And, thanks god again I didn't threw that pile of old, heavy, bulk and green hardware on the junkyard. Pure laziness, oh my.

Actually the recompile of our internal C based libs ran very smooth, and the python part of the program ran immediately. Testing took some time, though. That machine is no speed demon, thus analyzing a mere 24MiB worth of 3d CAD data took well over an hour. It produced tons of trace, using my hackery of sys.settrace() and my C tracing library. Well, I shipped it.

Then another customer filled their trac with tickets, all assigned to me. They're using a web application we wrote using Plone as an base to manage CAD drawings. They have lots of CAD drawings. Unfortunately they use Plone 2.1.1, which we migrated to from 2.0.5, which would well be worth a story of its own. Plone 2.1.1 seems to be a bad performer. We ran the profiling tools and killed the performance hogs, which turned out to have nothing to do with my application at all. Now they report that the command line tools I wrote to post/update/revoke drawings, which follow some sort of meta work flow on their own, does not delete drawings which became invalid. Oh well. Of course, on my test system the stuff works. Grrr.

On top of that I try to wrap my head around the new (?) and shiny (??) new python web application frameworks. Currently I'm investigating the possibilities of twisted, zope 3, turbogears and the new WSGI shipped with python 2.5. Much to learn. It seems I've missed most of the new development in that area which happened the last 1 1/2 years or so.

Google's GData API

I'm currently investigating the use of the GData API when it comes to create a command line blog posting tool written in pure python.

Well, it seems that there's no Python API for the pure Google Data stuff yet (I know about the Google Base Data API).

But from what I've understood this is all pure HTML POST and GET using an extended version of the ATOM XML schema. Using urllib and ElementTree in python its just plain simple to actually get your blog feeds. They've even built in some sort of query language.

Unfortunately, to authenticate with Google using your Google account, there's a bit more involved. The Java guys have it better here: There's a nice high-level API. Doh.

Authentication is, as far as I understood, needed to post blog entries.

Note to myself:
  • Investigate Google Authentication wrt. Plone PAS
  • provide a pure python script which posts to a blog
  • hook script into a plone work flow to publish atricles from plone to blogs. Create a new content type for that, track blog post IDs we got back from google inside plone. Use Five and notifiers to update blog if Plone document changes. This would be a PIS module.