如何通过编程方式向Gnome Contacts导入数据?
导入联系人到Gnome Contacts的实操困境与尝试
我最近一直在琢磨怎么用Python或者命令行把联系人导入Gnome Contacts,也愿意动手写点代码来解决,但翻遍了资料居然找不到靠谱的官方文档。Gnome Contacts是基于libfolks库开发的,这个库自带了folks-import工具,可气的是它连手册页都没有,跑folks-import --help出来的内容参考价值极低,输出如下:
Usage: folks-import [OPTION…] — import meta-contact information to libfolks Help Options: -h, --help Show help options Application Options: -s, --source=name Source backend name (default: ‘pidgin’) --source-filename Source filename (default: specific to source backend)
我查到本地联系人其实存在~/.local/share/evolution/addressbook/system/contacts.db,这是个SQLite3数据库,理论上我可以直接往里面写数据,但因为完全没有完善的结构文档,我不敢轻易这么操作——而且仔细看了下,这个数据库里还嵌了二进制和vCard数据,随便改很容易搞崩整个地址簿。
已尝试的相关操作
在Ubuntu 18.04上,我已经成功安装了必要的工具,命令如下:
sudo apt install gnome-contacts folks-tools
也试过查看本地联系人数据库的内容,用的是这条命令:
sqlite3 ~/.local/share/evolution/addressbook/system/contacts.db .dump
无效的相关搜索结果
我也搜过不少相关问题,但都没能解决我的核心需求:
- How can I access gnome-contacts or its data from gjs
- How to get Empathy contact list in GNOME shell extensions?
- Getting list of contacts with Gnome-Shell JS interface
- python GTK3 limit label width
- Where does system-address-book pull data from?
内容的提问来源于stack exchange,提问作者bitinerant
相关产品推荐
相关产品推荐

