diff options
author | Tobias Brox <tobias@redpill-linpro.com> | 2020-06-06 21:58:21 +0200 |
---|---|---|
committer | Tobias Brox <tobias@redpill-linpro.com> | 2020-06-06 21:58:21 +0200 |
commit | 82f0151e57dbbcfc6fb4844e3508777715feb6bb (patch) | |
tree | a8b87fdbf7d2e9db9189cd47e0cd1d1045840fa1 | |
parent | c8fcb2e743274553274334e24cc8e508ec7c6be2 (diff) | |
download | calendar-cli-82f0151e57dbbcfc6fb4844e3508777715feb6bb.zip |
bugfix for https://github.com/tobixen/calendar-cli/issues/11 - don't treat timezone information as an event
-rwxr-xr-x | calendar-cli.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/calendar-cli.py b/calendar-cli.py index 3bedae1..4f58ce5 100755 --- a/calendar-cli.py +++ b/calendar-cli.py @@ -494,12 +494,14 @@ def calendar_agenda(caldav_conn, args): tzinfo = args.timezone events__ = event_cal.instance.components() for event in events__: - dtstart = event.dtstart.value if hasattr(event, 'dtstart') else _now() - if not isinstance(dtstart, datetime): - dtstart = datetime(dtstart.year, dtstart.month, dtstart.day) - if not dtstart.tzinfo: - dtstart = _tz(args.timezone).localize(dtstart) - events.append({'dtstart': dtstart, 'instance': event}) + if event.name != 'vevent': + continue + dtstart = event.dtstart.value if hasattr(event, 'dtstart') else _now() + if not isinstance(dtstart, datetime): + dtstart = datetime(dtstart.year, dtstart.month, dtstart.day) + if not dtstart.tzinfo: + dtstart = _tz(args.timezone).localize(dtstart) + events.append({'dtstart': dtstart, 'instance': event}) ## changed to use the "key"-parameter at 2019-09-18, as needed for python3. ## this will probably cause regression on sufficiently old versions of python events.sort(key=lambda a: a['dtstart']) |