comparison multimerge.py @ 97:524915af5e87

Cosmetics.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 06 Oct 2016 15:23:54 +0300
parents b5cc76f18256
children fe3bfabf0b5f
comparison
equal deleted inserted replaced
96:6e8e3695cfaa 97:524915af5e87
512 512
513 ## Now, we fetch and collect events 513 ## Now, we fetch and collect events
514 gcm_debug(3, u"Fetching calendar events .. ") 514 gcm_debug(3, u"Fetching calendar events .. ")
515 src_events = [] 515 src_events = []
516 for calendar in src_calendars: 516 for calendar in src_calendars:
517 gcm_debug(4, u"- "+calendar["id"]) 517 gcm_debug(4, u"- {0} ({1})".format(calendar["id"], calendar["summary"]))
518 try: 518 try:
519 result = service.events().list( 519 result = service.events().list(
520 timeZone="EEST", 520 timeZone="EEST",
521 calendarId=calendar["id"], 521 calendarId=calendar["id"],
522 singleEvents=True, 522 singleEvents=True,
526 except Exception as e: 526 except Exception as e:
527 gcm_fatal(u"Failed to fetch calendar events for {0}:\n\n{1}\n\nERROR: {2}\n".format(calendar["id"], calendar, str(e))) 527 gcm_fatal(u"Failed to fetch calendar events for {0}:\n\n{1}\n\nERROR: {2}\n".format(calendar["id"], calendar, str(e)))
528 528
529 c_found = None 529 c_found = None
530 if "colorId" in calendar and calendar["colorId"] in colors["calendar"]: 530 if "colorId" in calendar and calendar["colorId"] in colors["calendar"]:
531 gcm_debug(4, u"Calendar color: {0}".format(colors["calendar"][calendar["colorId"]])) 531 gcm_debug(4, u" Calendar color: {0}".format(colors["calendar"][calendar["colorId"]]))
532 c_found = gcm_find_nearest_color(colors["event"], colors["calendar"][calendar["colorId"]], 100) 532 c_found = gcm_find_nearest_color(colors["event"], colors["calendar"][calendar["colorId"]], 100)
533 if c_found: 533 if c_found:
534 gcm_debug(4, u"Found nearest event color ID: {0}, {1}".format(c_found, colors["event"][c_found])) 534 gcm_debug(4, u" Found nearest event color ID: {0}, {1}".format(c_found, colors["event"][c_found]))
535 else: 535 else:
536 gcm_debug(4, u"No matching event color found!") 536 gcm_debug(4, u" No matching event color found!")
537 537
538 # Add events, if any, to main list 538 # Add events, if any, to main list
539 events = gcm_generate_ids(result.get("items", []), calendar["id"], "___") 539 events = gcm_generate_ids(result.get("items", []), calendar["id"], "___")
540 if events: 540 if events:
541 for event in events: 541 for event in events: