Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shellbear/epical
Synchronize your Epitech events with Google calendar
https://github.com/shellbear/epical
epitech epitech-intra go golang google google-calendar google-calendar-api
Last synced: 5 days ago
JSON representation
Synchronize your Epitech events with Google calendar
- Host: GitHub
- URL: https://github.com/shellbear/epical
- Owner: shellbear
- License: mit
- Created: 2019-09-03T12:15:03.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-02-25T03:58:28.000Z (over 1 year ago)
- Last Synced: 2024-06-20T08:03:39.490Z (5 months ago)
- Topics: epitech, epitech-intra, go, golang, google, google-calendar, google-calendar-api
- Language: Go
- Homepage:
- Size: 5.36 MB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# EpiCal
A simple tool to synchronize your Epitech events with Google calendar.# Requirements
#### Epitech token
To run this script you have to use your Epitech auto login token which can be found [here](https://intra.epitech.eu/admin/autolog).
The URL is of the form `https://intra.epitech.eu/auth-XXX...`
The token used by the script is only the right part of the URL after the `auth-` part.#### Google calendar credentials
You have to enable the Google Calendar API for your account.
You can follow the [Google developer QuickStart](https://developers.google.com/calendar/quickstart/go) and click **ENABLE THE GOOGLE CALENDAR API** button.
Then in the resulting dialog click **DOWNLOAD CLIENT CONFIGURATION** and save the file credentials.json to your working directory.## Installation
#### With go CLI
```bash
go get -v -u github.com/ShellBear/epical/...
epical version
```#### Direct download
You can also download the binaries from the [releases](https://github.com/ShellBear/epical/releases) page.
## Commands
### Sync
A command to synchronize Epitech events with your Google calendar.
```bash
./epical --token YOUR_EPITECH_AUTOLOGIN_TOKEN sync
```### List
A command to list Epitech events.
```bash
./epical --token YOUR_EPITECH_AUTOLOGIN_TOKEN list
```### Clear
Delete all events previously created by EpiCal.
```bash
./epical clear
```## Options
#### Credentials
You can specify the Google Calendar API folder path containing `credentials.json` and `token.json` files using the `--credentials` or `-c` option.
```bash
./epical --token YOUR_EPITECH_AUTOLOGIN_TOKEN --credentials /run/secrets/ sync
```## Usage
The easiest way to run this tool is to execute it with a periodic cron job.
First, you need to generate the `token.json` file, which is the Google Calendar API token file.
Make sure you have the file `credentials.json` and then run the script for the first time:If the `credentials.json` file is in your current directory then you can just do:
```bash
epical --token YOUR_EPITECH_AUTOLOGIN_TOKEN
```Otherwise, you can specify the path of the folder where it can be found:
```bash
epical --token YOUR_EPITECH_AUTOLOGIN_TOKEN --credentials /run/secrets/
```Then a message will appear:
```
Go to the following link in your browser then type the authorization code:
https://accounts.google.com/o/oauth2/auth...
```Just open this link in a browser, sign in with your google account, and paste the code you received.
Then, the `token.json` will be generated automatically.Finally, make sure that cron is installed and that the `/etc/cron.hourly` folder exists.
Just create a script in the `/etc/cron.hourly` directory or any other cron directory of your choice:```bash
> cat /etc/cron.hourly/epical
#!/bin/shEPICAL_BINARY_PATH/epical --token YOUR_EPITECH_AUTOLOGIN_TOKEN -c CREDENTIALS_AND_TOKEN_FOLDER_PATH sync
```Then give execute permission to the script and check that everything is working correctly:
```bash
chmod +x /etc/cron.hourly/epical
run-parts -v /etc/cron.hourly/
```Congrats, you're done!
## Built With
- [cobra](https://github.com/spf13/cobra) - A Commander for modern Go CLI interactions
- [google-api-go-client](https://github.com/googleapis/google-api-go-client) - Google APIs for Go## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details