Skip to main content

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. But as far as I see, Apple converts PNG to JPG before storing the image. If you encounter a db which includes other image types, please let me know.

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

abcddb2vcard-1.2.0.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

abcddb2vcard-1.2.0-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

Details for the file abcddb2vcard-1.2.0.tar.gz.

File metadata

  • Download URL: abcddb2vcard-1.2.0.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.2

File hashes

Hashes for abcddb2vcard-1.2.0.tar.gz
Algorithm Hash digest
SHA256 96d3ba12524bab87b4a993295852b7f3dee78e559d4fe2683f98f9d96b2b2d0c
MD5 38138d060bf0553c00444fda1f0da28f
BLAKE2b-256 5ef21b0c7d9ce5b92ac756fa6eb7e7f5a497866546cb3f93868f39fbc85a6e3f

See more details on using hashes here.

File details

Details for the file abcddb2vcard-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: abcddb2vcard-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 11.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.2

File hashes

Hashes for abcddb2vcard-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d11fd7b2270349c6053402c934123dbda5ce6a4c68917ac75d3b9e3e5bae6540
MD5 b2a2bffe7e245d6796ee6b6b3ad50db2
BLAKE2b-256 9953f66b9cb556f19ec46ce62b64b50c9798b3725bec8e7932808e77bd206d97

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page