From 3e515a8f1ab472635d38c2e85d71e6bec22376d1 Mon Sep 17 00:00:00 2001 From: Lino Schmidt Date: Mon, 12 Jun 2023 09:33:50 +0200 Subject: [PATCH] Remove events with same name --- src/getCalendar.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/getCalendar.py b/src/getCalendar.py index eef38aa..a442e63 100644 --- a/src/getCalendar.py +++ b/src/getCalendar.py @@ -44,10 +44,16 @@ if calendar: # Sort the events by start time events.sort(key=lambda x: datetime.datetime.strptime(x[0], "%d.%m.%Y %H:%M:%S")) + + # Remove Events with same summary + summarys = [] + for summary in events: + if summary[1] not in summarys: + summarys.append(summary[1]) # Print the sorted events - for summary in events: - print('-', summary[1]) + for summary in summarys: + print('-', summary) else: print('Calendar not found.') \ No newline at end of file