diff options
author | Florian Tham <fgtham@gmail.com> | 2016-04-17 22:53:39 +0200 |
---|---|---|
committer | Florian Tham <fgtham@gmail.com> | 2016-04-17 22:53:39 +0200 |
commit | eb39cd21adfb8fbb27a6ffe41ab96c7ab984cf9a (patch) | |
tree | 5ba18518328c61a6b837159e6670e859297691e5 | |
parent | 38969f2c2eedb70ddcfb9a301c075641fdd48fe6 (diff) | |
download | calendar-cli-eb39cd21adfb8fbb27a6ffe41ab96c7ab984cf9a.zip |
add calendar event description and location
-rwxr-xr-x | calendar-cli.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/calendar-cli.py b/calendar-cli.py index c34cdf7..f73f7d6 100755 --- a/calendar-cli.py +++ b/calendar-cli.py @@ -63,6 +63,8 @@ time_units = { vtodo_txt_one = ['location', 'description', 'geo', 'organizer', 'summary'] vtodo_txt_many = ['categories', 'comment', 'contact', 'resources'] +vcal_txt_one = ['location', 'description'] +vcal_txt_many = [] def niy(*args, **kwargs): if 'feature' in kwargs: @@ -246,6 +248,12 @@ def calendar_add(caldav_conn, args): ## maybe we should generate some uid? uid = uuid.uuid1() event.add('uid', str(uid)) + for attr in vcal_txt_one + vcal_txt_many: + if attr == 'summary': + continue + val = getattr(args, 'set_'+attr) + if val: + event.add(attr, val) event.add('summary', ' '.join(args.summary)) cal.add_component(event) _calendar_addics(caldav_conn, cal.to_ical(), uid, args) @@ -652,6 +660,10 @@ def main(): calendar_add_parser.add_argument('event_time', help="Timestamp and duration of the event. See the documentation for event_time specifications") calendar_add_parser.add_argument('summary', nargs='+') calendar_add_parser.set_defaults(func=calendar_add) + + for attr in vcal_txt_one + vcal_txt_many: + calendar_add_parser.add_argument('--set-'+attr, help='Set '+attr) + calendar_addics_parser = calendar_subparsers.add_parser('addics') calendar_addics_parser.add_argument('--file', help="ICS file to upload", default='-') calendar_addics_parser.set_defaults(func=calendar_addics) |