https://github.com/relikd/abcddb2vcard
Convert abcddb AddressBook format to vCard. Export profile images from vCard.
https://github.com/relikd/abcddb2vcard
abcddb addressbook macos vcard
Last synced: 10 months ago
JSON representation
Convert abcddb AddressBook format to vCard. Export profile images from vCard.
- Host: GitHub
- URL: https://github.com/relikd/abcddb2vcard
- Owner: relikd
- License: mit
- Created: 2021-06-05T18:49:53.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2024-01-27T16:12:45.000Z (over 2 years ago)
- Last Synced: 2025-03-28T15:21:30.726Z (over 1 year ago)
- Topics: abcddb, addressbook, macos, vcard
- Language: Python
- Homepage:
- Size: 32.2 KB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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
```sh
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
```sh
python3 abcddb2vcard.py outdir -s 'path/%{fullname}.vcf'
```
#### Extract contact images
```sh
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.