Convert AddressBook database (.abcddb) to Contacts VCards file (.vcf)
Project description
abcddb2vcard
This python script reads an AddressBook database file (AddressBook-v22.abcddb
) and export its content to a vCard file (.vcf
).
I created this script to automate my contacts backup procedure. The output of this script should be exactly the same as dragging and dropping the “All Contacts” card.
Usage
python3 abcddb2vcard.py backup/contacts_$(date +"%Y-%m-%d").vcf
assuming db is located at "~/Library/Application Support/AddressBook/AddressBook-v22.abcddb"
Export into individual files
python3 abcddb2vcard.py outdir -s 'path/%{fullname}.vcf'
Extract contact images
python3 vcard2image.py AllContacts.vcf ./profile_pics/
Supported data fields
firstname
, lastname
, middlename
, nameprefix
, namesuffix
, nickname
, maidenname
, phonetic_firstname
, phonetic_middlename
, phonetic_lastname
, phonetic_organization
, organization
, department
, jobtitle
, birthday
, [email]
, [phone]
, [address]
, [socialprofile]
, note
, [url]
, [xmpp-service]
, image
, iscompany
Limitations
The image
field currently only supports JPG images.
I have honestly no idea where PNG images are stored.
For PNGs the database only stores a UUID instead of the file itself.
If you happen to know where I can find these, open an issue or pull request.
Disclaimer
You should check the output for yourself before using it in a production environment. I have tested the script with many arbitrary fields, however there may be some edge cases missing. Feel free to create an issue for missing or wrong field values.
Note: The output of diff
or FileMerge.app
can be different to this output.
Apples does some weird transformations on vcf export that are not only unnecessary but in many cases break the re-import of the file.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file abcddb2vcard-1.1.0.tar.gz
.
File metadata
- Download URL: abcddb2vcard-1.1.0.tar.gz
- Upload date:
- Size: 10.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0ae6643c0d2aa97e3baa9599472532429333e28972b7834b7b576aa1c5a01fa6 |
|
MD5 | a011f56f4b1ff53c222b6254e4473abf |
|
BLAKE2b-256 | 9ffe7835e1642830bcc0cc524f23c3b19e1f0ac873b8124464d1c0c881bc5518 |
File details
Details for the file abcddb2vcard-1.1.0-py3-none-any.whl
.
File metadata
- Download URL: abcddb2vcard-1.1.0-py3-none-any.whl
- Upload date:
- Size: 10.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8097d5da149d3e65719362e44d7d1d12948b395e8768540c0ff303c1f1e57ab9 |
|
MD5 | 243e54ea61c7ae96a71af27efef54e1f |
|
BLAKE2b-256 | 3f46df6d0c724f7b05be1be1afe1b8fce8c19a623d2a5b822b61154b93abb11d |