Skip to content

Commit

Permalink
- New file khard-runner.py
Browse files Browse the repository at this point in the history
- Handle base64 encoded attributes on all vcard versions (previously only 3.0 was supported)
- Minor README file changes
  • Loading branch information
scheibler committed Aug 14, 2016
1 parent 0ea99e9 commit 79dc119
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 6 deletions.
33 changes: 29 additions & 4 deletions README.md
Expand Up @@ -24,6 +24,7 @@ With version 0.11.0, khard changed from python2 to python3. So if you come from
version, it may be necessary to reinstall in a newly created python3 virtual environment.



Prerequisites
-------------

Expand All @@ -41,9 +42,12 @@ sudo easy_install pip
```



Installation
------------

### From pypi ###

Khard is installable via pip. I recommend virtualenv to create a separate python3 environment. So
your system stays clean. Additionally you don't have to struggle with different python instances,
especially if your operating system still defaults to python2.
Expand All @@ -67,14 +71,24 @@ ln -s ~/.virtualenvs/khard/bin/khard ~/.virtualenvs/bin

More information about virtualenv at http://docs.python-guide.org/en/latest/dev/virtualenvs/

To get the example config file and the other extra data, you can clone from git:

```
### From source ###

If you instead want to run the source code directly, you may install required python modules by
hand, clone from git and run the khard-runner.py script:

~~~
pip install --user atomicwrites, configobj, pyyaml, vobject
git clone https://github.com/scheibler/khard.git
cd khard/
```
./khard-runner.py [action [options]]
~~~


Or download and extract with pip:
### Configuration ###

To get the example config file and the other extra data, you can clone from git (see above) or
download package from pypi:

```
pip install --download /tmp --no-deps --no-use-wheel khard
Expand All @@ -90,6 +104,9 @@ mkdir ~/.config/khard/
cp misc/khard/khard.conf.example ~/.config/khard/khard.conf
```


### Davcontroller ###

Khard also contains a helper script called davcontroller. It's designed to create and remove address
books and calendars at the server. I have created davcontroller cause my previously used CalDAV
server (Darwin calendarserver) offered no simple way to create new address books and calendars. But
Expand All @@ -115,6 +132,7 @@ cd CalDAVClientLibrary
```



Usage
-----

Expand Down Expand Up @@ -252,6 +270,7 @@ khard remove [-a addr_name] [-u uid|search terms [search terms ...]]
```



davcontroller
-------------

Expand All @@ -268,6 +287,7 @@ Possible actions are: list, new-addressbook, new-calendar and remove. After crea
must adapt your vdirsyncer config.



mutt
----

Expand Down Expand Up @@ -299,6 +319,7 @@ macro index,pager A \
Then navigate to an email message in mutt's index view and press "A" to start the address import dialog.



Alot
----

Expand All @@ -315,6 +336,7 @@ Add the following lines to your alot config file:
```



Twinkle
-------

Expand Down Expand Up @@ -358,6 +380,7 @@ script_remote_release=/home/USERNAME/.twinkle/scripts/incoming_call_ended.py
```



Zsh
---

Expand All @@ -374,6 +397,7 @@ compinit
```



sdiff
-----

Expand All @@ -385,6 +409,7 @@ merge_editor = /path/to/sdiff_khard_wrapper.sh
```



Related projects
----------------

Expand Down
6 changes: 6 additions & 0 deletions khard-runner.py
@@ -0,0 +1,6 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from khard.khard import main
if __name__ == '__main__':
main()
10 changes: 8 additions & 2 deletions khard/carddav_object.py
Expand Up @@ -825,9 +825,15 @@ def filter_base64_encoded_attributes(self, contents):
re.search("^\S.*$", line, re.IGNORECASE):
# skipped all the indented lines and found the next attribute
append_line = True
if append_line and \
re.search("^\S.*;encoding=b[;:].*$", line, re.IGNORECASE):
if append_line and ( \
re.search(
"^\S.*;encoding=base64[;:].*$", line, re.IGNORECASE) \
or re.search(
"^\S.*;encoding=b[;:].*$", line, re.IGNORECASE) \
or re.search(
"^\S.*:data.*[;:]base64,.*$", line, re.IGNORECASE)):
# found an attribute with base64 encoding
# for vcard versions 2.1, 3.0 or 4.0
# skip that due to a bug in the vobject library
# refers to khard issues #80 and #86
append_line = False
Expand Down

0 comments on commit 79dc119

Please sign in to comment.