# HG changeset patch # User Matti Hamalainen # Date 1467665196 -10800 # Node ID 824c3e5c6757c2f7b9ccc1f273d0c7cdc272cded # Parent 1267d61f622485283e1ae5eb5da5e2a633d630b5 Work on event merging. diff -r 1267d61f6224 -r 824c3e5c6757 multimerge.py --- a/multimerge.py Mon Jul 04 15:47:11 2016 +0300 +++ b/multimerge.py Mon Jul 04 23:46:36 2016 +0300 @@ -404,3 +404,18 @@ gcm_debug(u"No current events.") +## Start merging events .. +gcm_debug("Re-merging events to target calendar ..") +dst_gcm_ids = map(lambda x: x["gcm_id"], dst_events) +src_ids = map(lambda x: x["id"], src_events) +dst_ids = map(lambda x: x["id"], dst_events) +rm_ids = [x for x in dst_ids if x not in src_ids] + +for event in src_events: + # Does the event exist already in the target? + if event["gcm_id"] in dst_gcm_ids: + # Yes. Thus, we just update the event + else: + ## Insert new event + +gcm_debug("Finished.")