Skip to content

Commit

Permalink
Make source and target configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
huanlui committed Jun 22, 2021
1 parent 391fe09 commit 534b160
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions gcalsync.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@
from src.calendar import Calendar
import sys

def main(clientCalendarId):
twCalendar = Calendar("tw", "primary")

clientCalendar = Calendar("tw", clientCalendarId )

twCalendar.copyAllEventsFrom(clientCalendar, DatePeriod.weeks(1))
def main(sourceAccountName, sourceCalendarId, targetAccountName, targetCalendarId):
sourceCalendar = Calendar(sourceAccountName, sourceCalendarId)
targetCalendar = Calendar(targetAccountName, targetCalendarId)

targetCalendar.copyAllEventsFrom(sourceCalendar, DatePeriod.weeks(1))

if __name__ == '__main__':
main(sys.argv[1])
if len(sys.argv) < 4:
print(f"Usage python3 gcalsync sourceAccountName sourceCalendarId targetAccountName targetCalendarId")

main(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4])
## Pass as first an single argument the ID of your client calendar visible from your TW account
## use twCalendar.printCalendars() to see all your calendars and find out this id.
## use twCalendar.printCalendars() to see all your calendars and find out this id.

0 comments on commit 534b160

Please sign in to comment.