comparison multimerge.py @ 27:824c3e5c6757

Work on event merging.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 04 Jul 2016 23:46:36 +0300
parents 1267d61f6224
children 90886d9296cb
comparison
equal deleted inserted replaced
26:1267d61f6224 27:824c3e5c6757
402 gcm_debug(u"Found {0} event(s).".format(len(dst_events))) 402 gcm_debug(u"Found {0} event(s).".format(len(dst_events)))
403 else: 403 else:
404 gcm_debug(u"No current events.") 404 gcm_debug(u"No current events.")
405 405
406 406
407 ## Start merging events ..
408 gcm_debug("Re-merging events to target calendar ..")
409 dst_gcm_ids = map(lambda x: x["gcm_id"], dst_events)
410 src_ids = map(lambda x: x["id"], src_events)
411 dst_ids = map(lambda x: x["id"], dst_events)
412 rm_ids = [x for x in dst_ids if x not in src_ids]
413
414 for event in src_events:
415 # Does the event exist already in the target?
416 if event["gcm_id"] in dst_gcm_ids:
417 # Yes. Thus, we just update the event
418 else:
419 ## Insert new event
420
421 gcm_debug("Finished.")