emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Andrea Crotti <andrea.crotti.0@gmail.com>
To: "Michael Käufl" <org-mode@lists.michael-kaeufl.de>
Cc: emacs-orgmode@gnu.org
Subject: Re: [Org-contacts] 3 2 1 go?
Date: Sun, 06 Mar 2011 08:31:00 +0100	[thread overview]
Message-ID: <m17hcc3du3.fsf@ip1-201.halifax.rwth-aachen.de> (raw)
In-Reply-To: <87pqq5dkf6.fsf@phenom.fritz.box> ("Michael Käufl"'s message of "Sun, 06 Mar 2011 03:58:37 +0100")

Michael Käufl <org-mode@lists.michael-kaeufl.de> 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	other threads:[~2011-03-06  7:31 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-05 22:58 [Org-contacts] 3 2 1 go? Andrea Crotti
2011-03-06  2:58 ` Michael Käufl
2011-03-06  7:31   ` Andrea Crotti [this message]
2011-03-07 11:25     ` Andrea Crotti
2011-03-07 14:53       ` Julien Danjou
2011-03-07 17:51         ` Re: [O] " Michael Käufl
2011-03-07 11:12 ` Julien Danjou
2011-03-08  9:37   ` Andrea Crotti
2011-03-08  9:44     ` Julien Danjou
2011-03-08  9:57       ` Andrea Crotti
2011-03-08 21:45       ` Michael Käufl
2011-03-08 22:17   ` Michael Käufl
2011-03-09  8:23     ` Julien Danjou
2011-03-11  8:40       ` Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m17hcc3du3.fsf@ip1-201.halifax.rwth-aachen.de \
    --to=andrea.crotti.0@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=org-mode@lists.michael-kaeufl.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).