From 765a5c235a765b26bbd09028dd3d1f110a9455a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20M=C3=BCller?= Date: Thu, 11 Mar 2021 20:31:27 +0100 Subject: [PATCH] Fixing problem where the uids have automatically got a random suffix which prevented a correct update detection --- main.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index 15a93f8..b3737b2 100644 --- a/main.py +++ b/main.py @@ -27,6 +27,7 @@ def crawl(): end=datetime.strptime((datetime.now() + timedelta(days=365)).strftime('%Y-%m-%d'), '%Y-%m-%d')) except ValueError as error: # Value error sometimes happens because of a problem with dateutil and timezones + print("error") exit(1) # ______ __ __ __ __ __ __ ____ _____ ____ __ @@ -81,17 +82,18 @@ def crawl(): # Also removes the timezone from all the datetime objects evtIdx = {} for event in events: + # Remove random last part of uid + uid = event.uid + if '_' in uid: + event.uid = uid[:(uid.rindex('_'))] + if not event.uid in evtIdx.keys(): # Event not known yet uid = event.uid - # Remove random last part of uid - uid = uid[:(uid.rindex('_'))] event.uid = uid + '---0' evtIdx[uid] = 1 else: uid = event.uid - # Remove random last part of uid - uid = uid[:(uid.rindex('_'))] event.uid = uid + '---' + str(evtIdx[uid]) evtIdx[uid] += 1 # Remove timezones