forked from PhongT16/outlook_calendar_report_generator
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
34 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -90,6 +90,8 @@ def main(configs): | |
|
||
# Retrieve the group member emails | ||
group_members = utils.get_email_list(configs['group_name'], configs['email_list_update_interval']) | ||
#group_members = ["[email protected]"] | ||
|
||
|
||
# Get access token | ||
access_token = utils.acquire_access_token(app, configs['scopes']) | ||
|
@@ -100,16 +102,43 @@ def main(configs): | |
|
||
for group in [group_members[i : i + grouping] for i in range(0, len(group_members), grouping)]: | ||
individual_calendars = IndividualCalendar.get_individual_calendars(start_date, end_date, group, access_token) | ||
#print("Retrieved Individual Calendars from Outlook") | ||
#print(individual_calendars) | ||
individual_calendars_events.extend(IndividualCalendar.process_individual_calendars(individual_calendars, start_date, end_date)) | ||
|
||
print(f"Number of individual_calendars_events: {len(individual_calendars_events)}") | ||
# print("") | ||
print("individual_calendars_events: ") | ||
for e in individual_calendars_events: | ||
print(e) | ||
|
||
print("") | ||
print("----------------------------------------------") | ||
print("") | ||
|
||
# Retrieve the shared calendar and process it | ||
shared_calendar_id = SharedCalendar.get_shared_calendar_id(configs['shared_calendar_name'], access_token) | ||
debug_calendar = "NCSA Shared Calendar Two" | ||
# shared_calendar_id = SharedCalendar.get_shared_calendar_id(configs['shared_calendar_name'], access_token) | ||
shared_calendar_id = SharedCalendar.get_shared_calendar_id(debug_calendar, access_token) | ||
shared_calendar = SharedCalendar.get_shared_calendar(shared_calendar_id, start_date, end_date, access_token) | ||
#print("Retrieved Shared Calendar from Outlook") | ||
#print(shared_calendar) | ||
shared_calendar_events, event_ids = SharedCalendar.process_shared_calendar(shared_calendar, group_members) | ||
|
||
|
||
|
||
print(f"Number of shared_calendar_events: {len(shared_calendar_events)}") | ||
for e in shared_calendar_events: | ||
print(e) | ||
|
||
print("") | ||
# print("----------------------------------------------") | ||
|
||
# Update the shared calendar | ||
SharedCalendar.update_shared_calendar(individual_calendars_events, shared_calendar_events, event_ids, shared_calendar_id, configs['category_name'], configs['category_color'], access_token) | ||
|
||
# print("") | ||
print("*****************************************************") | ||
# print("") | ||
if args.manual_update: break | ||
|
||
count = count + 1 | ||
|
@@ -122,7 +151,8 @@ def main(configs): | |
if not path.exists(configs['vcs_directory']): | ||
raise KeyError(f"{configs['vcs_directory']} does not exist.") | ||
|
||
rotate_file_handler_info = handlers.RotatingFileHandler(f"{configs['vcs_directory']}vcs.log", mode='a', maxBytes=2000000, backupCount=2) | ||
debug_file = 'vcs_debug.log' | ||
rotate_file_handler_info = handlers.RotatingFileHandler(f"{configs['vcs_directory']}{debug_file}.log", mode='a', maxBytes=2000000, backupCount=2) | ||
rotate_file_handler_info .setFormatter(fmt=formater) | ||
rotate_file_handler_info .setLevel(logging.DEBUG) | ||
|
||
|