Skip to content

scripts: add contact-to-vcf converter with deduplication#161

Open
KJ7LNW wants to merge 1 commit into
libyal:mainfrom
KJ7LNW:contact-to-vcf
Open

scripts: add contact-to-vcf converter with deduplication#161
KJ7LNW wants to merge 1 commit into
libyal:mainfrom
KJ7LNW:contact-to-vcf

Conversation

@KJ7LNW

@KJ7LNW KJ7LNW commented Jun 29, 2026

Copy link
Copy Markdown

Description

libpff exports one Contact.txt per item, producing duplicate records across large mailbox archives. This adds a converter that merges those records into a single vCard .vcf file.

Type of Change

  • Feature (non-breaking change that adds functionality)

Implementation Details

A standalone script reads Contact.txt paths from stdin, parses each into a structured record, deduplicates, and emits vCard 3.0 to stdout.

  • key contacts on first real email, falling back to display name
  • filter Exchange internal addresses (/o=) from email fields
  • accumulate phones and emails when merging duplicate keys
  • map phone label substrings to vCard TEL type tokens
  • emit vCard 3.0 blocks with value escaping
  • report input/error/skip/merge/unique tallies to stderr

libpff exports one Contact.txt per item, leading to duplicate records
when processing large mailbox archives. This script reads a list of
Contact.txt paths from stdin, merges duplicates keyed on primary email
or display name, and emits a single vCard 3.0 .vcf file to stdout.

- parse Contact.txt fields into a structured dict per file
- filter Exchange internal addresses (/o=) from email fields
- key contacts on first real email, falling back to display name
- accumulate phones and emails when merging duplicate keys
- map phone label substrings to vCard TEL type tokens
- emit vCard 3.0 blocks with proper value escaping
- report input/error/skip/merge/unique tallies to stderr

Signed-off-by: Eric Wheeler <git-default@z.ewheeler.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant