Goobook

A love-hate relationship. That’s what I have with this tool. I wasn’t able to set it up on Ubuntu 10.04 TLS, probably to due to the version of fucking python,  but it worked like a charm on Ubuntu 11.04. But it’s that useful, that I regularly miss it on the 10.04 system and I’m getting a creepy smile all over my face when I can make use of it on another machine.

What it does? That’s simple: It puts your Gmail address-book on the command-line.  That’s what it does. When you use mutt (Mutt, IMAP and elinks) for writing e-mails or you just need an e-mail-address from your address-book a simple

$ goobook query <contactname>

will do the trick. Integrated with mutt (Mutt, IMAP and elinks) you get auto-completion (when pressing <TAB>) from the address-book (explained below).

But time to get started.

Installation

In order to install goobook and (hopefully) get it up and running download the source version 1.3. There are newer alpha releases, but they didn’t work so well for me and ran into some trouble from time to time. Version 1.3 does its job.

Unpack it and run the installation:

$ tar -xzvf goobook-*.tar.gz
$ cd goobook-*
$ sudo python ./setup.py install

That’s it.

Configuration

Goobook checks your  ~.netrc file for the credentials.

machine google.com
login your@google.email
password secret

If you don’t like that you’re free to put it into ~/.goobookrc. As you like.

When you’re dealing with ~/.goobookrc anyway, have a look in the additional configuration parameters. You can create a configuration template and modify it accordingly.

$ goobook config-template > ~/.goobookrc`

It will look like this:

[DEFAULT]
# If not given here, email and password is taken from .netrc using
# machine google.com
;email: user@gmail.com
;password: top secret
# The following are optional, defaults are shown
;cache_filename: ~/.goobook_cache
;cache_expiry_hours: 24

The installation guide provides you with information about PGP integration for storing the login credentials secure as well. In order to get goobook into mutt on the <TAB>-key, you modify your .muttrc:

To query the address book (normally bound to “Q” key):

set query_command="goobook query '%s'"`

If you want to be able to use <TAB> to complete email addresses instead of add this:

bind editor <Tab> complete-query

You can add contacts to the address book via goobook as well, but I don’t use that feature, since I’m managing my contacts at a different point. Having read access is enough for me here. The installation guide will provide you with additional information if you need them.

Problems

There weren’t many. And if, so I could solve them that easily with the provided documentation, that I can’t remember them. Beside the initially mentioned fucking python problems, I only stumble into minor ones.

Caching

If you change your contact details somewhere else, update the Gmail entries and then expect goobook to come up with the right details while using the cache-function, you might end up with a surprise. The caching actually works. It means actually that goobook will not ask Gmail every time it wants to have an address, but will store all information locally and just occasionally update that information. All at once. That means when you add a contact it will be not cached by goobook immediately, new addresses don’t show up right away. Well, you probably configured caching yourself, so stop complaining.

What you can do about it, is to empty the cache and ask goobook to reload the cache.

$ goobook reload

That will cause goobook to query new data from your address-book and that includes all changes you’ve recently done.