Merge pull request #6 from cramermarius/master

Start on documentation and improve setup experience
This commit is contained in:
Gilles Castel 2020-05-19 16:56:51 +02:00 committed by GitHub
commit 503c32ae9e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 6 deletions

View file

@ -1,5 +1,13 @@
# Managing LaTeX lecture notes
This repository complements my [third blog post about my note taking setup](https://castel.dev/post/lecture-notes-3).
This repository complements my [third blog post about my note taking
setup](https://castel.dev/post/lecture-notes-3).
To get the calendar script working, follow step 1 and 2 of the [Google Calendar Python Quickstart](https://developers.google.com/calendar/quickstart/python), and place `credentials.json` in the `scripts` directory.
## Setup Google Calendar integration
To get the calendar script (`countdown.py`) working, follow step 1 and 2 of the [Google
Calendar Python Quickstart](https://developers.google.com/calendar/quickstart/python), and
place `credentials.json` in the `scripts` directory.
Then open `config.py` and edit the `ROOT` as well as the `USERCALENDARID`
variables to your own needs.

View file

@ -4,6 +4,13 @@ from pathlib import Path
def get_week(d=datetime.today()):
return (int(d.strftime("%W")) + 52 - 5) % 52
# default is 'primary', if you are using a separate calendar for your course schedule,
# your calendarId (which you can find by going to your Google Calendar settings, selecting
# the relevant calendar and scrolling down to Calendar ID) probably looks like
# xxxxxxxxxxxxxxxxxxxxxxxxxg@group.calendar.google.com
# example:
# USERCALENDARID = 'xxxxxxxxxxxxxxxxxxxxxxxxxg@group.calendar.google.com'
USERCALENDARID = 'primary'
CURRENT_COURSE_SYMLINK = Path('~/current_course').expanduser()
CURRENT_COURSE_ROOT = CURRENT_COURSE_SYMLINK.resolve()
CURRENT_COURSE_WATCH_FILE = Path('/tmp/current_course').resolve()

View file

@ -21,6 +21,7 @@ from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
from courses import Courses
from config import USERCALENDARID
courses = Courses()
@ -186,7 +187,7 @@ def main():
if 'dateTime' in event['start']
]
events = get_events('primary')
events = get_events(userCalendarId)
# events = get_events('primary') + get_events('school-calendar@import.calendar.google.com')
print('Done')