Skip to content
This repository has been archived by the owner on Feb 6, 2019. It is now read-only.

Restructure as Python package #9

Open
charlesreid1 opened this issue Sep 15, 2018 · 1 comment
Open

Restructure as Python package #9

charlesreid1 opened this issue Sep 15, 2018 · 1 comment

Comments

@charlesreid1
Copy link
Contributor

This package is basically one core script that already uses argparser to take input arguments.

We should convert it to a properly-packaged python cli tool.

Considerations

Create/Update flags, name flag, force sync flag: These flags all continue to work the same way

Calendar ics list: The file containing the list of all DCPPC calendars would be bundled as package data and made available to the command line utility. This would eliminate the current use of the -i flag.

First-Run Credentials: The user needs to enable the Google Calendar API for whatever account they're going to create DCPPC events on, and they need to create an OAuth app, and they need to obtain the API credentials for their OAuth app from the Google Cloud console. This is the client_secret.json file. The user then authenticates using the -a or --auth flag, which takes then through the process of enabling the calendars application to modify their Google Calendars account. This will open a browser locally, and they will log in with their Google account. They will then be given a credentials.json file to download.

Regular-Run Credentials: Once you have obtained credentials.json you can use it to run the calendar. The command line tool requires a credentials.json file be specified with the -i flag (re-using it - also it implies that this is a required input file, which it is).

Hypothetical Quickstart:

Get the repo and install the tool:

git clone <url>
cd <dir>
python setup.py build install

Now obtain client_secret.json from Google Cloud console if this is your first time running the calendar app.

cd ~/Downloads
ls client_secret.json

Authenticate to turn client_secret.json into credentials.json:

dcppc_calendar --auth -i client_secret.json

Now you're ready to run the command line tool. This will extract events from all calendars in the ical list (embedded as package data, contains all DCPPC groups) and either populate your calendar with new events, or update the event information if they already exist on your calendar.

# create new calendar named "My DCPPC Calendar"
# and populate with DCPPC events
dcppc_calendar -c -n "My DCPPC Calendar" -i credentials.json

# update an existing calendar named "My DCPPC Calendar" 
# and synchronize (add/delete/update) events
dcppc_calendar -u -n "My DCPPC Calendar" -i credentials.json

This uses the Google Calendar of whatever account logged in to create credentials.json.

@charlesreid1
Copy link
Contributor Author

This should be completed before #1 can be done

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant