Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d9de27a40a | ||
|
|
6ddcd028bf | ||
|
|
f3ecab5da7 | ||
|
|
c66d2057b4 | ||
|
|
f9eeb2af74 |
26
CHANGELOG.md
26
CHANGELOG.md
@@ -5,6 +5,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project does adhere to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
|
||||
## [1.2.2] – 2026-01-18
|
||||
### Changed
|
||||
- Update readme
|
||||
|
||||
|
||||
## [1.2.1] – 2025-12-03
|
||||
### Fixed
|
||||
- Soft-fail on unknown social service types. (continue export even if a service field fails)
|
||||
@@ -13,7 +18,12 @@ and this project does adhere to [Semantic Versioning](https://semver.org/spec/v2
|
||||
|
||||
## [1.2.0] – 2025-06-09
|
||||
### Added
|
||||
- Support for exporting external image files
|
||||
- Support for external images (referenced only by id within db)
|
||||
- Warning for missing `-wal` & `-shm` files
|
||||
- Warning for missing (and hidden) `.AddressBook-v22_SUPPORT` image storage folder
|
||||
|
||||
### Removed
|
||||
- Warning for missing column `ZSERVICENAME` (column is not that important anyway)
|
||||
|
||||
|
||||
## [1.1.1] – 2025-06-09
|
||||
@@ -23,16 +33,24 @@ and this project does adhere to [Semantic Versioning](https://semver.org/spec/v2
|
||||
|
||||
## [1.1.0] – 2024-01-27
|
||||
### Added
|
||||
- Multi-file export
|
||||
- Multi-file output. Use a formatter string to export each vcard individually.
|
||||
|
||||
### Fixed
|
||||
- Ignore non-existing columns
|
||||
- Continue processing of remaining entries if a single contact card fails to process
|
||||
- Ignore table columns that do not exist (e.g., `ZTHUMBNAILIMAGEDATA`)
|
||||
|
||||
|
||||
## [1.0.1] – 2023-02-21
|
||||
Initial release
|
||||
### Added
|
||||
- Types
|
||||
- `abcddb2vcard` is now available on PyPi (`pip3 install abcddb2vcard`, then use `abcddb2vcard` or `vcard2img` in your shell)
|
||||
|
||||
### Fixed
|
||||
- Crash when processing data fields with no corresponding Contact record
|
||||
|
||||
|
||||
|
||||
[1.2.2]: https://github.com/relikd/abcddb2vcard/compare/v1.2.1...v1.2.2
|
||||
[1.2.1]: https://github.com/relikd/abcddb2vcard/compare/v1.2.0...v1.2.1
|
||||
[1.2.0]: https://github.com/relikd/abcddb2vcard/compare/v1.1.1...v1.2.0
|
||||
[1.1.1]: https://github.com/relikd/abcddb2vcard/compare/v1.1.0...v1.1.1
|
||||
|
||||
4
Makefile
4
Makefile
@@ -1,3 +1,7 @@
|
||||
.PHONY: help
|
||||
help:
|
||||
@echo available commands: install, uninstall, dist, publish
|
||||
|
||||
.PHONY: install
|
||||
install:
|
||||
[ -z "$${VIRTUAL_ENV}" ] \
|
||||
|
||||
121
README.md
121
README.md
@@ -3,47 +3,130 @@
|
||||
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.
|
||||
The output of this script should be exactly the same as dragging and dropping the "All Contacts" card.
|
||||
|
||||
|
||||
### Usage
|
||||
## Installation
|
||||
|
||||
To install `abcddb2vcard` from [PyPi](https://pypi.org/project/abcddb2vcard/), use `pip`:
|
||||
|
||||
```sh
|
||||
python3 abcddb2vcard.py backup/contacts_$(date +"%Y-%m-%d").vcf
|
||||
pip install abcddb2vcard
|
||||
```
|
||||
|
||||
> assuming db is located at "~/Library/Application Support/AddressBook/AddressBook-v22.abcddb"
|
||||
`abcddb2vcard` can then be used from any working directory in the Terminal.
|
||||
|
||||
#### Export into individual files
|
||||
To uninstall:
|
||||
|
||||
```sh
|
||||
python3 abcddb2vcard.py outdir -s 'path/%{fullname}.vcf'
|
||||
```
|
||||
|
||||
#### Extract contact images
|
||||
|
||||
```sh
|
||||
python3 vcard2image.py AllContacts.vcf ./profile_pics/
|
||||
pip uninstall abcddb2vcard
|
||||
```
|
||||
|
||||
|
||||
### Supported data fields
|
||||
## Usage
|
||||
|
||||
`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`
|
||||
Export all contacts
|
||||
|
||||
```sh
|
||||
abcddb2vcard backup/contacts_$(date +"%Y-%m-%d").vcf
|
||||
```
|
||||
|
||||
Export into individual files
|
||||
|
||||
```sh
|
||||
abcddb2vcard outdir -s 'path/%{fullname}.vcf'
|
||||
```
|
||||
|
||||
Extract contact images
|
||||
|
||||
```sh
|
||||
vcard2img AllContacts.vcf ./profile_pics/
|
||||
```
|
||||
|
||||
|
||||
### Limitations
|
||||
### Usage help
|
||||
|
||||
The `image` field currently only supports JPG images.
|
||||
#### abcddb2vcard
|
||||
|
||||
```
|
||||
usage: abcddb2vcard [-h] [-f] [--dry-run] [-i AddressBook.abcddb] [-s FORMAT]
|
||||
outfile.vcf
|
||||
|
||||
Extract data from AddressBook database (.abcddb) to Contacts VCards file
|
||||
(.vcf)
|
||||
|
||||
positional arguments:
|
||||
outfile.vcf VCard output file.
|
||||
|
||||
optional arguments:
|
||||
-h, --help show this help message and exit
|
||||
-f, --force Overwrite existing output file.
|
||||
--dry-run Do not write file(s), just print filenames.
|
||||
-i AddressBook.abcddb, --input AddressBook.abcddb
|
||||
Specify another abcddb input file. Default:
|
||||
~/Library/Application Support/AddressBook/AddressBook-v22.abcddb
|
||||
-s FORMAT, --split FORMAT
|
||||
Output into several vcf files instead of a single
|
||||
file. File format can use any field of type Record.
|
||||
E.g. "%{id}_%{fullname}.vcf".
|
||||
```
|
||||
|
||||
#### vcard2img
|
||||
|
||||
```
|
||||
usage: vcard2img [-h] infile.vcf outdir
|
||||
|
||||
Extract all profile pictures from a Contacts VCards file (.vcf)
|
||||
|
||||
positional arguments:
|
||||
infile.vcf VCard input file.
|
||||
outdir Output directory.
|
||||
|
||||
optional arguments:
|
||||
-h, --help show this help message and exit
|
||||
```
|
||||
|
||||
|
||||
## 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
|
||||
|
||||
Currently, the `image` field 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
|
||||
## 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.
|
||||
> **Note:** The output of `diff` or `FileMerge.app` can be different to this output.
|
||||
Apple uses some data transformations (on vcf export) which are not only unnecessary but may break the re-import of the file.
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
'''
|
||||
Convert AddressBook database (.abcddb) to Contacts VCards file (.vcf)
|
||||
'''
|
||||
__version__ = '1.2.1'
|
||||
__version__ = '1.2.2'
|
||||
|
||||
from .ABCDDB import ABCDDB
|
||||
|
||||
Reference in New Issue
Block a user