From 8392967e1f10c0893947bae6f16f750cc2ec008c Mon Sep 17 00:00:00 2001 From: Tobias Brox Date: Fri, 14 Mar 2014 17:14:22 +0100 Subject: version 0.6 - with relatively smooth agenda functionlity --- README.md | 30 ++---------------------------- calendar-cli.py | 18 +++++++++++++----- 2 files changed, 15 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index 5f16d67..20ec43f 100644 --- a/README.md +++ b/README.md @@ -112,20 +112,6 @@ Objectives * It should be possible to get out lists ("agenda") of calendar items and todo-items. * Interface for copying calendar items between calendars, even between calendars on distinct caldav servers -<<<<<<< HEAD -Milestones ----------- - -* CLI-interface for creating ical calendar events (working as of version 0.01) -* CalDAV login (working as of version 0.02) -* Push calendar item into CalDAV server (working as of version 0.02, but both an URL for the caldav server and an URL for the actual calendar has to be given) -* Config file with CalDAV connection details (working as of version 0.03) -* Replace calendar-URL with calendar-path (working as of version 0.04) -* Find default calendar-path (working as of version 0.04) -* Show agenda -* CLI-interface for creating ical todo events -* Push todo item into CalDAV server - Status ------ @@ -136,26 +122,14 @@ Status 2013-10-05: version 0.04 - no need to specify URL for the default calendar 2013-12 - 2014-03: helped cyrilrbt on making a new release of the caldav library 2014-03-07: version 0.05 - rewrote parts of the tool to using the caldav library. Nice!!! -======= +2014-03-14: version 0.6 - now agenda works quite smooth. I think this is becoming a useful tool. + Roadmap ------- * Allow specification of event duration when adding events to calendar -* Show agenda. Hope to have this in place during January 2014. (I've obeen hitting a snag in the underlying library, and will probably have to replace it). * Delete events. Needed for making a functional test suite. * Fix a functional test suite. * CLI-interface for creating ical todo events * Wrap it into an easy-to-install package * Fix easy-to-use symlinks -History -------- - -* 2013-09-15: Made a repository at github and wrote up this README. -* 2013-09-24: version 0.01 - supports creating an ical-file based on command line parameters -* 2013-09-28: version 0.02 - possible to add a calendar item to the caldav server -* 2013-10-02: version 0.03 - support for configuration file -* 2013-10-05: version 0.04 - no need to specify URL for the default calendar -* 2013-10-10: Attempts on implementing "agenda" stalled a bit due to problems with the library used. Considering to switch library. -* 2013-11-30: version 0.05 - added the calendar "addics" command for adding an ics file -* 2013-12-02: Some merging of work between the "agenda" branch and the master branch; causing a minor API change (new option --nocaldav has to be specified if running the utility without connecting to a caldav server) ->>>>>>> master diff --git a/calendar-cli.py b/calendar-cli.py index 8961356..ebdb5f8 100755 --- a/calendar-cli.py +++ b/calendar-cli.py @@ -16,7 +16,7 @@ import os import logging import sys -__version__ = "0.6.1" +__version__ = "0.6" __author__ = "Tobias Brox" __author_short__ = "tobixen" __copyright__ = "Copyright 2013, Tobias Brox" @@ -130,11 +130,17 @@ def calendar_agenda(caldav_conn, args): if args.nocaldav: raise ValueError("Agenda with --nocaldav only makes sense together with --icalendar") - dtstart = dateutil.parser.parse(args.from_time) + if args.from_time: + dtstart = dateutil.parser.parse(args.from_time) + else: + dtstart = datetime.now() if args.to_time: dtend = dateutil.parser.parse(args.to_time) - else: - dtend = dtstart + timedelta(1,0) + elif args.agenda_mins: + dtend = dtstart + timedelta(0,0,args.agenda_mins) + elif args.agenda_days: + dtend = dtstart + timedelta(args.agenda_days) + ## TODO: time zone ## No need with "expand" - as for now the method below throws away the expanded data :-( We get a list of URLs, and then we need to do a get on each and one of them ... events_ = find_calendar(caldav_conn, args).date_search(dtstart, dtend) @@ -228,8 +234,10 @@ def main(): calendar_addics_parser.set_defaults(func=calendar_addics) calendar_agenda_parser = calendar_subparsers.add_parser('agenda') - calendar_agenda_parser.add_argument('from_time', help="Fetch calendar events from this timestamp. See the documentation for time specifications") + calendar_agenda_parser.add_argument('--from-time', help="Fetch calendar events from this timestamp. See the documentation for time specifications. Defaults to now") calendar_agenda_parser.add_argument('--to-time', help="Fetch calendar until this timestamp") + calendar_agenda_parser.add_argument('--agenda-mins', help="Fetch calendar for so many minutes", type=int) + calendar_agenda_parser.add_argument('--agenda-days', help="Fetch calendar for so many days", type=int, default=7) calendar_agenda_parser.set_defaults(func=calendar_agenda) todo_parser = subparsers.add_parser('todo') -- cgit v1.2.3