summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Brox <tobias@redpill-linpro.com>2020-06-06 21:58:21 +0200
committerTobias Brox <tobias@redpill-linpro.com>2020-06-06 21:58:21 +0200
commit82f0151e57dbbcfc6fb4844e3508777715feb6bb (patch)
treea8b87fdbf7d2e9db9189cd47e0cd1d1045840fa1
parentc8fcb2e743274553274334e24cc8e508ec7c6be2 (diff)
downloadcalendar-cli-82f0151e57dbbcfc6fb4844e3508777715feb6bb.zip
bugfix for https://github.com/tobixen/calendar-cli/issues/11 - don't treat timezone information as an event
-rwxr-xr-xcalendar-cli.py14
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'])