From 621a1e995f5bc6fb09e3fd3daa3d7608d91777f1 Mon Sep 17 00:00:00 2001 From: lonkaars Date: Wed, 16 Mar 2022 20:54:00 +0100 Subject: fix duplicate decsync entries --- main.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/main.py b/main.py index cd4daea..fa1805b 100755 --- a/main.py +++ b/main.py @@ -48,17 +48,16 @@ def create_task_ical(event): if not desctext: return None description, uid = description_parser(desctext) todo.add("description", description) - todo.add("uid", description) + todo.add("uid", uid) cal.add_component(todo) - return cal.to_ical() + return (cal.to_ical(), uid) def task_handler(config, ds, event): - epoch = time.time() - timestamp = f"{int(epoch)}{int((epoch % 1) * 10 ** 9)}" - ical = create_task_ical(event) - if not ical: return - ds.set_entry(["resources", timestamp], str(event.decoded('uid'), 'utf-8'), str(ical, 'utf-8')) + temp = create_task_ical(event) + if not temp: return + ical, uid = temp + ds.set_entry(["resources", uid], str(event.decoded('uid'), 'utf-8'), str(ical, 'utf-8')) def main(): config = load_config() -- cgit v1.2.3