emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [Org-contacts] 3 2 1 go?


From: Andrea Crotti
Subject: Re: [O] [Org-contacts] 3 2 1 go?
Date: Sun, 06 Mar 2011 08:31:00 +0100
User-agent: Gnus/5.110014 (No Gnus v0.14) Emacs/24.0.50 (darwin)

Michael Käufl <address@hidden> writes:

> No it's not.  As you can see here [1], Julien Danjou has already started
> to inlucde more features.  For now org-contacts supportes mail addresses
> and irc nicknames.  And I'm sure a lot more will follow.
>

Good to know :)
So I think I will avoid trying BBDB after all, I can start with this already.

I have a first thing working well enough for the translation, I use
contacts to get the fields: http://gnufoo.org/contacts/contacts.html

It's very stupid now since it only takes one email and no other fields,
but it's ready for enhancements.
Anyway it 

--8<---------------cut here---------------start------------->8---
#!/usr/bin/env python

"""
Get the contacts with http://gnufoo.org/contacts/contacts.html
 and print out a org-contacts valid output
"""

import subprocess

FMT = [("first name", "fn"),
       ("last name", "ln"),
       ("home mail", "he"),
       ("work mail", "we"),
       ("other mail", "oe"),
       ("birthday", "b")]

cmd = "contacts -H -S -f '%s'" % (';'.join('%' + x[1] for x in FMT))

proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
out, err = proc.communicate()

org_contact_template = """* %s
:PROPERTIES:
:EMAIL:   %s
:END:
"""

for line in out.splitlines():
    s = line.split(';')
    if s[2]:
        print org_contact_template % (' '.join((s[0], s[1])), s[2])
--8<---------------cut here---------------end--------------->8---



reply via email to

[Prev in Thread] Current Thread [Next in Thread]