<commit_before># google_home_calendars
Python script for organising work and personal calendars to make Google Home better

# The problem
Your most important calendar is your work one, but Google Home needs to be connected to your peronsal Google account. Google is adding support for multiple linked accounts, but it won't handle multiple accounts for the same voice (person).

# The solution
You can give your work Google account full permission over your personal calendars. This script uses your work credentials to copy - safely! - your work events into your primary personal calendar, and then also into two separate secondary calendars in your personal account.

You keep the separation you need for yourself, but the Google Assistant can now see everything you're doing, and be much more helpful.

I run the script hourly with cron, from a linux server.

# Feature details
The script
- Works with events as old as six months ago, and up to six months into the future
- Ignores events that have been cancelled!
- Ignores events that you've declined, because you don't need multiple records of stuff you're not doing
- Tags your work events as they're copied into your personal account, by adding a line to the description, "## sync'd from work ##
- Removes all attendees from the copies of your work events...
- ... and fixes you as the organiser of everything, in those copies. Your work account should remain in control!

# Apologies
- There are bits of the code that I'm sure are inelegant and inefficient.
- I've used OAuth for authentication with Google. I run the script locally and then allow the credentials token to be pushed to my server. This which works for me, but no doubt it's stupid and bad pratice or something.

# On that note
- The .gitignore file on Github excludes files in the credentials folder so that would need changing if you're going to handle the credentials like I do.
<commit_msg>fix formatting<commit_after># google_home_calendars
Python script for organising work and personal calendars to make Google Home better

## The problem
Your most important calendar is your work one, but Google Home needs to be connected to your peronsal Google account. Google is adding support for multiple linked accounts, but it won't handle multiple accounts for the same voice (person).

## The solution
You can give your work Google account full permission over your personal calendars. This script uses your work credentials to copy - safely! - your work events into your primary personal calendar, and then also into two separate secondary calendars in your personal account.

You keep the separation you need for yourself, but the Google Assistant can now see everything you're doing, and be much more helpful.

I run the script hourly with cron, from a linux server.

## Feature details
The script
- Works with events as old as six months ago, and up to six months into the future
- Ignores events that have been cancelled!
- Ignores events that you've declined, because you don't need multiple records of stuff you're not doing
- Tags your work events as they're copied into your personal account, by adding a line to the description, "## sync'd from work ##
- Removes all attendees from the copies of your work events...
- ... and fixes you as the organiser of everything, in those copies. Your work account should remain in control!

## Apologies
- There are bits of the code that I'm sure are inelegant and inefficient.
- I've used OAuth for authentication with Google. I run the script locally and then allow the credentials token to be pushed to my server. This which works for me, but no doubt it's stupid and bad pratice or something.

## On that note
- The .gitignore file on Github excludes files in the credentials folder so that would need changing if you're going to handle the credentials like I do.

{'fraction_non_alphanumeric': 0.038781884435190005, 'fraction_numerical': 0.0, 'mean_word_length': 4.264383561643836, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5227506', 'n_tokens_mistral': 919, 'n_tokens_neox': 869, 'n_words': 617}