mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-01-25 23:11:02 +08:00
commit
3db19ff3a2
@ -1,145 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (3 open source tools to manage your contacts)
|
||||
[#]: via: (https://opensource.com/article/20/1/sync-contacts-locally)
|
||||
[#]: author: (Kevin Sonney https://opensource.com/users/ksonney)
|
||||
|
||||
3 open source tools to manage your contacts
|
||||
======
|
||||
Access your contacts more quickly by syncing them locally. Learn how in
|
||||
the sixth in our series on 20 ways to be more productive with open
|
||||
source in 2020.
|
||||
![Team communication, chat][1]
|
||||
|
||||
Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using.
|
||||
|
||||
### Open source tools for contact management
|
||||
|
||||
In previous articles in this series, I explained how to synchronize your [mail][2] and [calendars][3] locally. Hopefully, that has sped up accessing your mail and calendar. Now I'll talk about contacts, which you can use to send mail and calendar invites.
|
||||
|
||||
![abook][4]
|
||||
|
||||
I have collected a lot of email addresses over the course of my, well, life so far. And managing all that data can be a bit of a pain. There are web-based services, but they aren't as fast as a local copy.
|
||||
|
||||
A few days ago, I talked about [vdirsyncer][5] for managing calendars. Vdirsyncer also handles contacts using the CardDAV protocol. Vdirsyncer supports **google_contacts** and **carddav** to do contact synchronizations in addition to the **filesystem** store it uses for calendars, but the **fileext** setting will change, so you won't be trying to store contacts in calendar files.
|
||||
|
||||
I added a configuration block to the config file and mirrored my contacts from Google. Extra steps are required to set it up. Once the Google setup is complete, the configuration is pretty simple:
|
||||
|
||||
|
||||
```
|
||||
[pair address_sync]
|
||||
a = "googlecard"
|
||||
b = "localcard"
|
||||
collections = ["from a", "from b"]
|
||||
conflict_resolution = "a wins"
|
||||
|
||||
[storage googlecard]
|
||||
type = "google_contacts"
|
||||
token_file = "~/.vdirsyncer/google_token"
|
||||
client_id = "my_client_id"
|
||||
client_secret = "my_client_secret"
|
||||
|
||||
[storage localcard]
|
||||
type = "filesystem"
|
||||
path = "~/.calendars/Addresses/"
|
||||
fileext = ".vcf"
|
||||
```
|
||||
|
||||
Now when I run **vdirsyncer discover**, it finds my Google contacts, and **vdirsyncer sync** copies them to my local machine. But again, that's only half the story. Now I want to read and use the contacts. Enter [khard][6] and [abook][7].
|
||||
|
||||
![khard search][8]
|
||||
|
||||
Why two applications? Each has its own use case, and in this case, more is better. Khard does for addresses what [khal][9] does for calendar entries. You'll probably want to install the latest release via pip if your distribution ships an older version. Once khard is installed, you need to create **~/.config/khard/khard.conf** because khard doesn't have a nifty configuration wizard the way khal does. Mine looks like this:
|
||||
|
||||
|
||||
```
|
||||
[addressbooks]
|
||||
[[addresses]]
|
||||
path = ~/.calendars/Addresses/default/
|
||||
|
||||
[general]
|
||||
debug = no
|
||||
default_action = list
|
||||
editor = vim, -i, NONE
|
||||
merge_editor = vimdiff
|
||||
|
||||
[contact table]
|
||||
display = first_name
|
||||
group_by_addressbook = no
|
||||
reverse = no
|
||||
show_nicknames = yes
|
||||
show_uids = no
|
||||
sort = last_name
|
||||
localize_dates = yes
|
||||
|
||||
[vcard]
|
||||
preferred_version = 3.0
|
||||
search_in_source_files = yes
|
||||
skip_unparsable = no
|
||||
```
|
||||
|
||||
This defines the source address book (and gives it a friendly name), as well as what to display and what do use to edit contacts. Running **khard list** will list all the entries, and **khard list <[some@email.adr][10]>** will search for a specific entry. If you want to add or edit an entry, the **add** and **edit** commands launch the configured editor with the same basic template, the only difference being that the **add** template will be blank.
|
||||
|
||||
![editing in khard][11]
|
||||
|
||||
Abook requires you to import and export VCF files but offers some nice features for lookups. To convert your files to the abook format, first install abook and create the **~/.abook** default directory. Now tell abook to parse all the files and put them into the **~/.abook/addresses** file:
|
||||
|
||||
|
||||
```
|
||||
apt install abook
|
||||
ls ~/.calendars/Addresses/default/* | xargs cat | abook --convert --informat vcard --outformat abook > ~/.abook/addresses
|
||||
```
|
||||
|
||||
Now run **abook**, and you'll have a very nice UI to browse, search, and edit the entries. Exporting them back to individual entries is a bit of a pain, so I do most of my edits with khard and have a cron job to import them into abook.
|
||||
|
||||
Abook can also search on the command line and has a lot of documentation about integrating it with mail clients. For example, you can use abook for lookups in the [Notmuch][12] email client [alot][13] by adding some information to the **.config/alot/config** file:
|
||||
|
||||
|
||||
```
|
||||
[accounts]
|
||||
[[Personal]]
|
||||
realname = Kevin Sonney
|
||||
address = [kevin@sonney.com][14]
|
||||
alias_regexp = kevin\[+.+@sonney.com][15]
|
||||
gpg_key = 7BB612C9
|
||||
sendmail_command = msmtp --account=Personal -t
|
||||
# ~ expansion works
|
||||
sent_box = maildir://~/Maildir/Sent
|
||||
draft_box = maildir://~/Maildir/Drafts
|
||||
[[[abook]]]
|
||||
type = abook
|
||||
```
|
||||
|
||||
And there you have it: fast lookup of your contacts to go with your mail and calendars!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/1/sync-contacts-locally
|
||||
|
||||
作者:[Kevin Sonney][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/ksonney
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/talk_chat_team_mobile_desktop.png?itok=d7sRtKfQ (Team communication, chat)
|
||||
[2]: https://opensource.com/article/20/1/sync-email-offlineimap
|
||||
[3]: https://opensource.com/article/20/1/open-source-calendar
|
||||
[4]: https://opensource.com/sites/default/files/uploads/productivity_6-1.png (abook)
|
||||
[5]: https://github.com/pimutils/vdirsyncer
|
||||
[6]: https://github.com/scheibler/khard
|
||||
[7]: http://abook.sourceforge.net/
|
||||
[8]: https://opensource.com/sites/default/files/uploads/productivity_6-2.png (khard search)
|
||||
[9]: https://khal.readthedocs.io/en/v0.9.2/index.html
|
||||
[10]: mailto:some@email.adr
|
||||
[11]: https://opensource.com/sites/default/files/uploads/productivity_6-3.png (editing in khard)
|
||||
[12]: https://opensource.com/article/20/1/organize-email-notmuch
|
||||
[13]: https://github.com/pazz/alot
|
||||
[14]: mailto:kevin@sonney.com
|
||||
[15]: mailto:+.+@sonney.com
|
@ -0,0 +1,143 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (3 open source tools to manage your contacts)
|
||||
[#]: via: (https://opensource.com/article/20/1/sync-contacts-locally)
|
||||
[#]: author: (Kevin Sonney https://opensource.com/users/ksonney)
|
||||
|
||||
用于联系人管理的开源工具
|
||||
======
|
||||
通过将联系人同步到本地从而更快访问它。在我们的 20 个使用开源提升生产力的系列的第六篇文章中了解该如何做。
|
||||
![Team communication, chat][1]
|
||||
|
||||
去年,我在 19 天里给你介绍了 19 个新(对你而言)的生产力工具。今年,我换了一种方式:使用你在使用或者还没使用的工具,构建一个使你可以在新一年更加高效的环境。
|
||||
|
||||
### 用于联系人管理的开源工具
|
||||
|
||||
在本系列之前的文章中,我解释了如何在本地同步你的[邮件][2]和[日历][3]。希望这些加速了你访问邮件和日历。现在,我将讨论联系人同步,你可以使用这些发送邮件和日历邀请。
|
||||
|
||||
![abook][4]
|
||||
|
||||
我目前收集了很多邮件地址。管理这些数据可能有点麻烦。有基于 Web 的服务,但它们不如本地副本快。
|
||||
|
||||
几天前,我谈到了用于管理日历的 [vdirsyncer][5]。vdirsyncer 还使用 CardDAV 协议处理联系人。vdirsyncer 除了可以使用**文件系统**存储日历外,还支持 **google_contacts** 和 **carddav** 进行联系人同步,但 **fileext** 设置将更改,因此你无法在日历文件中存储联系人。
|
||||
|
||||
我在配置文件添加了一块配置,并从 Google 镜像了我的联系人。设置它需要额外的步骤。从 Google 镜像完成后,配置非常简单:
|
||||
|
||||
|
||||
```
|
||||
[pair address_sync]
|
||||
a = "googlecard"
|
||||
b = "localcard"
|
||||
collections = ["from a", "from b"]
|
||||
conflict_resolution = "a wins"
|
||||
|
||||
[storage googlecard]
|
||||
type = "google_contacts"
|
||||
token_file = "~/.vdirsyncer/google_token"
|
||||
client_id = "my_client_id"
|
||||
client_secret = "my_client_secret"
|
||||
|
||||
[storage localcard]
|
||||
type = "filesystem"
|
||||
path = "~/.calendars/Addresses/"
|
||||
fileext = ".vcf"
|
||||
```
|
||||
|
||||
现在,当我运行 **vdirsyncer discover** 时,它会找到我的 Google 联系人,并且 **vdirsyncer sync** 将它们复制到我的本地计算机。但同样,这只进行到一半。现在我想查看和使用联系人。输入 [khard][6] 和 [abook][7]。
|
||||
|
||||
![khard search][8]
|
||||
|
||||
为什么选择两个应用?因为每个都有它自己的使用场景,在这里,越多越好。khard 用于管理地址,类似于 [khal][9] 用于管理日历条目。如果你的发行版附带了旧版本,你可能需要通过 pip 安装最新版本。安装 khard 后,你需要创建 **~/.config/khard/khard.conf**,因为 khard 没有与 khal 那样漂亮的配置向导。我的看起来像这样:
|
||||
|
||||
|
||||
```
|
||||
[addressbooks]
|
||||
[[addresses]]
|
||||
path = ~/.calendars/Addresses/default/
|
||||
|
||||
[general]
|
||||
debug = no
|
||||
default_action = list
|
||||
editor = vim, -i, NONE
|
||||
merge_editor = vimdiff
|
||||
|
||||
[contact table]
|
||||
display = first_name
|
||||
group_by_addressbook = no
|
||||
reverse = no
|
||||
show_nicknames = yes
|
||||
show_uids = no
|
||||
sort = last_name
|
||||
localize_dates = yes
|
||||
|
||||
[vcard]
|
||||
preferred_version = 3.0
|
||||
search_in_source_files = yes
|
||||
skip_unparsable = no
|
||||
```
|
||||
|
||||
这会定义源通讯簿(并给它一个友好的名称)、显示内容和联系人编辑程序。运行 **khard list** 将列出所有条目,**khard list <[some@email.adr][10]>** 可以搜索特定条目。如果要添加或编辑条目,**add** 和 **edit** 命令将使用相同的基本模板打开配置的编辑器,唯一的区别是 **add** 命令的模板将为空。
|
||||
|
||||
![editing in khard][11]
|
||||
|
||||
abook 需要你导入和导出 VCF 文件,但它为查找提供了一些不错的功能。要将文件转换为 abook 格式,请先安装 abook 并创建 **~/.abook** 默认目录。然后让 abook 解析所有文件,并将它们放入 **~/.abook/addresses** 文件中:
|
||||
|
||||
|
||||
```
|
||||
apt install abook
|
||||
ls ~/.calendars/Addresses/default/* | xargs cat | abook --convert --informat vcard --outformat abook > ~/.abook/addresses
|
||||
```
|
||||
|
||||
现在运行 **abook**,你将有一个非常好的 UI 来浏览、搜索和编辑条目。将它们导出到单个文件有点痛苦,所以我用 khard 进行大部分编辑,并有一个 cron 任务将它们导入到 abook 中。
|
||||
|
||||
abook 还可在命令行中搜索,并有大量有关将其与邮件客户端集成的文档。例如,你可以在 **.config/alot/config** 文件中添加一些信息,从而在 [Nmuch][12] 的邮件客户端 [alot][13] 中使用 abook 查询联系人:
|
||||
|
||||
|
||||
```
|
||||
[accounts]
|
||||
[[Personal]]
|
||||
realname = Kevin Sonney
|
||||
address = [kevin@sonney.com][14]
|
||||
alias_regexp = kevin\[+.+@sonney.com][15]
|
||||
gpg_key = 7BB612C9
|
||||
sendmail_command = msmtp --account=Personal -t
|
||||
# ~ expansion works
|
||||
sent_box = maildir://~/Maildir/Sent
|
||||
draft_box = maildir://~/Maildir/Drafts
|
||||
[[[abook]]]
|
||||
type = abook
|
||||
```
|
||||
|
||||
这样你就可以在邮件和日历中快速查找联系人了!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/1/sync-contacts-locally
|
||||
|
||||
作者:[Kevin Sonney][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/ksonney
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/talk_chat_team_mobile_desktop.png?itok=d7sRtKfQ (Team communication, chat)
|
||||
[2]: https://opensource.com/article/20/1/sync-email-offlineimap
|
||||
[3]: https://opensource.com/article/20/1/open-source-calendar
|
||||
[4]: https://opensource.com/sites/default/files/uploads/productivity_6-1.png (abook)
|
||||
[5]: https://github.com/pimutils/vdirsyncer
|
||||
[6]: https://github.com/scheibler/khard
|
||||
[7]: http://abook.sourceforge.net/
|
||||
[8]: https://opensource.com/sites/default/files/uploads/productivity_6-2.png (khard search)
|
||||
[9]: https://khal.readthedocs.io/en/v0.9.2/index.html
|
||||
[10]: mailto:some@email.adr
|
||||
[11]: https://opensource.com/sites/default/files/uploads/productivity_6-3.png (editing in khard)
|
||||
[12]: https://opensource.com/article/20/1/organize-email-notmuch
|
||||
[13]: https://github.com/pazz/alot
|
||||
[14]: mailto:kevin@sonney.com
|
||||
[15]: mailto:+.+@sonney.com
|
Loading…
Reference in New Issue
Block a user