Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Single .vcf file #319

Open
avidseeker opened this issue Apr 16, 2023 · 8 comments
Open

Single .vcf file #319

avidseeker opened this issue Apr 16, 2023 · 8 comments

Comments

@avidseeker
Copy link

Whenever a new contact is added, khard creates a whole new .vcf file just for that contact.

Typical contact services combine all contacts into one .vcf file. E.g: friends.vcf, work.vcf, academic.vcf, and so on...

It would be more cleaner if khard can combine events into a single vcf file and keeps it updated.

@lucc
Copy link
Owner

lucc commented Apr 16, 2023

This is a design decision of khard, see the docs. If you really think khard needs to do it this way you will have to present a more thorough argument. E.g:
I do not know which "typical" other services you are talking about. Please also clarify what you mean by "cleaner", I personally consider it cleaner if each contact is in one file. One address book is represented by one folder of .vcf files.

If you just need a bunch of contacts in one file for some other use case outside of khard you can combine them easily:

khard file | xargs -d '\n' cat
# or 
khard file some search terms | xargs -d '\n' cat

@lucc
Copy link
Owner

lucc commented Apr 16, 2023

Or are you maybe looking for the possibility to manage separated address books? Then look for the [addressbooks] section in the config file and the --addressbook command line option.

@lucc lucc added the waiting Waiting for more information label Apr 16, 2023
@avidseeker
Copy link
Author

which "typical" other services

Google, Protonmail, and all the rest of contact apps expect to import and export one .vcf file (unless the intention is to send one contact card).

what you mean by "cleaner"

By cleaner I mean that I can easily know where a contact is saved just by looking at the filenames, and that I don't need extra work for that contact to be imported/exported with its group.

@lucc
Copy link
Owner

lucc commented Apr 17, 2023

To be honest I am not sold. This sounds like very explicit use case which might also be handled by a custom shell script instead of rewriting the internals of khard.

That being said if you want to work on this here is what you might try (unless you come up with a better idea):

  • write a new address book class in khard/address_book.py to handle an address book in one big file.
  • either modify the logic in khard/carddav_object.py or add new classes to abstract the differences between vcards in single files and vcards as part of a collection in big files.
  • check that the editing logic in khard/khard.py works with both cases
  • add a config option to define if an address book is a vdir or a single vcf file

That would be the rough plan, I probably missed many details but they will inevitably come up once you start coding.

@lucc lucc added enhancement help wanted and removed waiting Waiting for more information labels Apr 17, 2023
@hhartzer
Copy link

Could you suggest a way to convert a single .vcf file into multiple .vcf files, one per contact?

I'm using this Android app to export my contacts, and they come as a single .vcf file.

Thank you!

@scheibler
Copy link
Collaborator

A couple of years ago I've extended an already existing python script to do this:
https://www.eric-scheibler.de/downloads/split_vcalendar.py

Basic usage: python split_vcalendar.py all_in_one_file.vcf output_folder

More details at : https://www.eric-scheibler.de/en/blog/2014/10/Sync-calendars-and-address-books-between-Linux-and-Android/#import-calendars

Maybe you could give it a try?

@lucc
Copy link
Owner

lucc commented Nov 29, 2024

I am using https://github.com/jakeogh/vcardtool to split the export from my phone.

@hhartzer
Copy link

hhartzer commented Dec 7, 2024

I will give one of those a try. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants