Git Product home page Git Product logo

org-contacts2vcard's Introduction

## 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 org-contacts contact information of GNU Emacs with Org-mode to Android 4.4 contact 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 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 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 my current Emacs configuration on github.

Example

Please take a look at the example org-contact file testdata/testcontacts.org

The file example_invocation.sh gives you some impression on how to invoke this script.

Please note that with 2020-11-15 I switched the international number prefix (IDD) from 00 to + because sources like this tells me this is safer.

Contact Images

In testdata/testcontacts.org you will notice contact photographs are included like this:

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

photo: is a custom link which is defined in 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 #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 Python PEP8 and some ideas from Test Driven Development (TDD).

Local Variables

org-contacts2vcard's People

Contributors

novoid avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

org-contacts2vcard's Issues

Add some informations

Hi,

I'm not comfortable with python but I think it could be interesting that the export allowed by this script integrates :

  • a "note" entry from :Note: in the org file.
  • a complete address as mentioned in the description (separation of street, zip code and city).

Currently, an entry like this :

image

Gives an export like this:

BEGIN:VCARD
VERSION:4.0
FN:Paul Smith
TEL:1423567654
EMAIL:[email protected]
EMAIL:[email protected]
END:VCARD

Some random contacts and some random contact images aren't imported

I analyzed the situation in detail in 2014 and created this issue on 2020-10-20 in order to communicate this issue to other users. (My internal heading for detailed analysis: id:2014-01-12-org-contacts2vcard-issue)

Issue Description

The issue is that (1) some contacts may not get imported to the Android contact database and (2) some of the imported contacts that got photographs associated do not get their contact image set.

Example numbers: 41 missing contacts when importing 732 contacts.

Analysis

In short, I could not get any pattern when comparing different contacts and different photographs. The "selection" of missing data seems random but constant for the same vcard file: one vcard file results in same set of missing data when imported multiple times. When same set of vcard data is re-arranged within the vcard file, the set of missing data changes.

In other words: When order of contacts in the VCard is changed, different contacts may get omitted and different images may not get imported. When I import previously failed contacts in a separate file (the missing contact is the only entry in this file), the contacts get imported flawlessly.

Therefore, it does seem to be no issue of the image files or contact data.

When I export the Android contacts to a file and re-imports this file, some contacts also get lost:

  • my contacts file has 773 entries
  • 732 contacts shown in contacts on Android (41 missing)
  • 646 contacts in re-export VCF file found
    • another 86 missing additionally
    • totals to 127 missing for the round-trip

Meanwhile, I consider this being an Android bug in all versions since at least 2014 which is quite puzzling to me.

  • re-evaluate import success and missing images with Android 9 or newer (since I stopped analyzing the issue after 2014-12)
  • get feedback from other users with completely different contact data and contact images

Workaround/Mitigation

  1. I'm deriving two vcard files from my contacts.org: one without the images and one with the images.
  2. I purge the Android contact database, removing all contacts and all contact images.
  3. Then I import both vcard files which then results in a maximum of imported contacts.

This is no 100 percent solution, just a minimization of the set of missing contact data.

Help Needed

If you do have any input on this issue, please let me know!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.