# HG changeset patch # User Matti Hamalainen # Date 1476783019 -10800 # Node ID 8b773358ad47909c11615de58e3b0a9fa0b2b50a # Parent c6771a596d77a9c66f15fb93f652d12f90c9c44d Use "id" field in source calendar events gcm_id generation, and "iCalUID" for the target calendar. diff -r c6771a596d77 -r 8b773358ad47 multimerge.py --- a/multimerge.py Tue Oct 18 12:29:13 2016 +0300 +++ b/multimerge.py Tue Oct 18 12:30:19 2016 +0300 @@ -133,13 +133,13 @@ ## Generate gcm IDs for given list of events -def gcm_generate_ids(events, calendar_id, sep): +def gcm_generate_ids(events, calendar_id, sep, field): if not events: return events - for ev in events: - ev["gcm_cal_id"] = calendar_id - ev["gcm_id"] = calendar_id + sep + ev["iCalUID"] + for event in events: + event["gcm_cal_id"] = calendar_id + event["gcm_id"] = calendar_id + sep + event[field] return events @@ -560,7 +560,7 @@ gcm_debug(4, u" No matching event color found!") # Add events, if any, to main list - events = gcm_generate_ids(gcm_fetch_events(calendar["id"], False), calendar["id"], "___") + events = gcm_generate_ids(gcm_fetch_events(calendar["id"], False), calendar["id"], "___", "id") if events: for event in events: if event["status"] != u"cancelled": @@ -574,7 +574,7 @@ ## Get current events gcm_debug(3, u"Fetching current target calendar events.") -dst_events = gcm_generate_ids(gcm_fetch_events(cfg.dst_id, True), "", "") +dst_events = gcm_generate_ids(gcm_fetch_events(cfg.dst_id, True), "", "", "iCalUID") gcm_debug(3, u"Found {0} event(s).".format(len(dst_events)))