On Mon, 2003-03-24 at 08:07, Dan Hensley wrote:
> On Mon, 2003-03-24 at 02:06, Michael A. Peters wrote:
> > Yes - but I've got a relatively large address book.
> > I can't seem to find a way to export my address book to a text file.
> > I poked around and tried evolution-addressbook-export but I don't get
> > any output :(
> > Basically - I don't want to have to manually go through my huge address
> > book and manually create a white list, and furthermore, I don't want to
> > have to update two files for every contact.
> > 
> > Is there any way to export the address book to a text file? Then at
> > least I could script it and throw it into a crontab or something ...
> 
> This was discussed a couple of months ago on the list, and I think it's
> been discussed several times.  I don't remember what came of it.  Seems
> like someone was going to try to write a script to access Evo's contact
> list directly.  Not sure if that ever got done.  You might try searching
> the archives to find out more.

Here's a Python script I hacked up a a few minutes ago.

exportcontacts.py > whitelist

will give you a list of all the email addresses in your Evo contacts
database.

If you needed something different, let me know.

Of course, you'll need to have Python installed, but I think that's a
pretty common part of most distros these days.


-- 
Cliff Wells, Software Engineer
Logiplex Corporation (www.logiplex.net)
(503) 978-6726 x308  (800) 735-0555 x308
#!/usr/bin/python

import bsddb, os, re

home = os.getenv('HOME')
dbname = '%s/evolution/local/Contacts/addressbook.db' % home

db = bsddb.hashopen(dbname, 'r')

regex = re.compile('EMAIL;INTERNET:(?P<contact>.*)')

for k in db.keys():
    for line in db[k].split('\n'):
        mo = regex.search(line)
        if mo:
            contact = mo.group('contact').strip()
            if contact:
                print contact
            break

db.close()

Reply via email to