-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinsertMultiCal.py
executable file
·43 lines (33 loc) · 1.15 KB
/
insertMultiCal.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/python
from __future__ import print_function
import datetime
import getpass
import sys
import GoogleCalendar
print('Google Username: ', end='')
user = sys.stdin.readline().strip()
passwd = getpass.getpass('Password for {0}: '.format(user))
try:
calendar = GoogleCalendar.GoogleCalendar(user, passwd)
except GoogleCalendar.BadAuthentication as e:
print(e, file=sys.stderr)
sys.exit(1)
# ---------------------------------
# Edit this section to correspond to your list of events
mainEventDate = datetime.datetime(2012, 03, 01)
events = (
#( DayOffset, 'Event Title', 'Event Location', 'Event Content'),
( 0, 'Main Event', 'Australia', "We're finally in Australia!"),
( -1, 'Plane Trip', None, "Don't forget to catch your flight"),
( -2, 'Book your taxi for Australia', None, None),
( -3, 'Find your passport', None, "It's probably in the dresser"),
( 7, 'Recovery from vacation', 'Home', None),
)
# ---------------------------------
for event in events:
calendar.insertAllDayEvent(
date = primaryEventDate + datetime.timedelta(days=event[0]),
title = event[1],
where = event[2],
content = event[3]
)