org-contacts2vcard

Converting Emacs Org-mode org-contacts contact information to VCard format suitable for importing to Android 4.4

GPL-3.0 License

Stars
23

Time-stamp: <2020-11-15 22:26:31 vk>

-- coding: utf-8 --

This file is best viewed with GNU Emacs Org-mode: http://orgmode.org/

  • org-contacts2vcard

This is a Python script that converts [[http://julien.danjou.info/projects/emacs-packages#org-contacts][org-contacts]] contact information of [[http://en.wikipedia.org/wiki/Emacs][GNU Emacs]] with [[http://orgmode.org/][Org-mode]] to Android 4.4 contact [[https://en.wikipedia.org/wiki/VCard][VCard]] import format.

Update 2020-10-20: I am still using this code to export my Org-contacts to my Android mobile phone (running Android 9). The reason why I wrote "version 4.4" above maybe was related to changes to the Android VCard format with version 4.4. I can't remember.

  • target group: users of [[http://orgmode.org/][Org-mode]] org-contacts who want to get their
    contact information to Android including:
    • First name
    • Last name
    • email addresses
    • phone numbers
    • user images
      • Note: the way contact images are referred to is personalized for
        me (see below). Therefore, you have to adopt either the script
        to your needs or you adopt my image method to your Org-mode :-)

** Customizations: org-contacts

My org-contacts-template is more elaborated than the one in [[http://orgmode.org/w/?p%3Dorg-mode.git%3Ba%3Dblob_plain%3Bf%3Dcontrib/lisp/org-contacts.el%3Bhb%3DHEAD][org-contacts.el]]. For example, I am using three separated properties for addresses (CITY, POSTALCODE, STREET) instead of one. If you are using different properties for certain entries, you might want to customize in your set-up.

As an example, here are my customizations: : (require 'org-contacts) : (custom-set-variables : '(org-contacts-files "~/share/all/org-mode/contacts.org") : '(org-contacts-address-property "CITY") : '(org-contacts-birthday-property "BORN") : '(org-contacts-icon-property "PHOTOGRAPH") : )

You can have a look on [[https://github.com/novoid/dot-emacs][my current Emacs configuration on github]].

** Example

Please take a look at the example org-contact file [[https://github.com/novoid/org-contacts2vcard/blob/master/testdata/testcontacts.org][testdata/testcontacts.org]]

The file [[https://github.com/novoid/org-contacts2vcard/blob/master/example_invocation.sh][example_invocation.sh]] gives you some impression on how to invoke this script.

Please note that with 2020-11-15 I switched the [[https://en.wikipedia.org/wiki/International_direct_dialing][international number prefix (IDD)]] from =00= to =+= because sources like [[https://www.studyabroad.com/resources/international-calling-codes][this]] tells me this is safer.

** Contact Images

In [[https://github.com/novoid/org-contacts2vcard/blob/master/testdata/testcontacts.org][testdata/testcontacts.org]] you will notice contact photographs are included like this:

: :PHOTOGRAPH: [[photo:FirstnameLastname.jpeg]]

photo: is a [[http://orgmode.org/org.html#Adding-hyperlink-types][custom link]] which is defined in [[https://github.com/novoid/dot-emacs/blob/master/org-mode.el][my org-mode configuration file]]:

: (setq org-link-abbrev-alist : '( : [...] : ("photo" . "file:~/people/all_photographs/%s") : [...] : ))

As you can see, I linked it to files in the folder $HOME/people/all_photographs.

If you use a similar definition, you are able to use my script without changes.

NOTE the open issue https://github.com/novoid/org-contacts2vcard/issues/1 for missing contacts and contact images which is still valid for 2020-11-15 and Android 11 on a Google Pixel 4a phome.

  • Contribute!

I am looking for your ideas:

If you want to contribute to this cool project, please fork and contribute!

I am using [[http://www.python.org/dev/peps/pep-0008/][Python PEP8]] and some ideas from [[http://en.wikipedia.org/wiki/Test-driven_development][Test Driven Development (TDD)]].

  • Local Variables :noexport:

Local Variables:

mode: auto-fill

mode: flyspell

eval: (ispell-change-dictionary "en_US")

End: