vcf_to_obsidian
vcf-to-obsidian-vcf-contacts
A Python module that batch-converts VCF files into Markdown files that are compatible with obsidian-vcf-contacts plugin for ObsidianMD.
Author: Ian Dennis Miller License: MIT
Submodules
Classes
Class responsible for reading and parsing VCF files. |
|
Class responsible for generating Markdown content from vCard objects. |
|
Class responsible for generating output filenames from vCard objects. |
|
Class responsible for converting VCF files to Markdown format. |
Package Contents
- class vcf_to_obsidian.VCFReader[source]
Class responsible for reading and parsing VCF files.
- class vcf_to_obsidian.MarkdownWriter[source]
Class responsible for generating Markdown content from vCard objects.
- class vcf_to_obsidian.FilenameGenerator[source]
Class responsible for generating output filenames from vCard objects.
- generate_filename(vcard, vcf_path)[source]
Generate an output filename based on vCard data with priority logic.
Priority: 1. Full Name (FN) field 2. Constructed name from given + family names 3. UID field 4. Original VCF filename
- Parameters:
vcard – vobject vCard object
vcf_path (Path) – Original VCF file path
- Returns:
Safe filename (without extension)
- Return type:
str
- class vcf_to_obsidian.VCFConverter[source]
Class responsible for converting VCF files to Markdown format.
- reader
- writer
- filename_gen
- _extract_rev_timestamp_from_markdown(markdown_path)[source]
Extract REV timestamp from existing Markdown file.
- Parameters:
markdown_path (Path) – Path to the Markdown file
- Returns:
REV timestamp as datetime object, or None if not found
- Return type:
datetime or None
- _should_skip_conversion(vcf_path, markdown_path)[source]
Check if conversion should be skipped based on file modification times.
- Parameters:
vcf_path (Path) – Path to the VCF file
markdown_path (Path) – Path to the Markdown file
- Returns:
True if conversion should be skipped, False otherwise
- Return type:
bool
- convert_vcf_to_markdown(vcf_path, output_dir)[source]
Convert a single VCF file to Markdown format.
- Parameters:
vcf_path (Path) – Path to the VCF file
output_dir (Path) – Output directory for Markdown files
- Returns:
True if successful, False otherwise
- Return type:
bool
- convert_vcf_files_from_sources(folder_sources, file_sources, output_dir, ignore_files=None, verbose=False)[source]
Convert VCF files from multiple sources (folders and individual files) to Markdown format.
This method collects VCF files from the specified sources, applies ignore filters, and processes them directly using convert_vcf_to_markdown.
- Parameters:
folder_sources (list) – List of Path objects for directories containing VCF files
file_sources (list) – List of Path objects for individual VCF files
output_dir (Path) – Output directory for Markdown files
ignore_files (list, optional) – List of Path objects for files to ignore
verbose (bool) – Whether to enable verbose output
- Returns:
(successful_count, total_count, all_vcf_files)
- Return type:
tuple
- process_tasks(folder, obsidian, file, verbose, ignore)[source]
Process VCF conversion tasks from CLI arguments.
This method handles the complete CLI workflow including validation, file collection, processing, and reporting.
- Parameters:
folder – Tuple/list of folder paths containing VCF files
obsidian – Path to destination directory for Markdown files
file – Tuple/list of individual VCF file paths to process
verbose – Boolean flag for verbose output
ignore – Tuple/list of VCF file paths to ignore