Skip to content

Commit

Permalink
Shifted bulky sections to the project wiki
Browse files Browse the repository at this point in the history
  • Loading branch information
sahasatvik committed Apr 12, 2021
1 parent d7afc0d commit 384405d
Showing 1 changed file with 15 additions and 39 deletions.
54 changes: 15 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@
This is a bot which lets you interact with WeLearn from the command line. It can
- Download all files/resources from your courses and organize them in designated folders.
- Show your assignments, filter due assignments.
- Add your assignments to Google Calendar.

Using the [Moodle Web Services API](https://docs.moodle.org/dev/Web_services) makes `welearn_bot` fast and robust.

Go to our [project wiki](https://github.com/ParthBibekar/Welearn-bot/wiki) to learn more about configuring and using the script.
Developers may be interested in the article on [using the Moodle Web Service module](https://github.com/ParthBibekar/Welearn-bot/wiki/Using-the-Moodle-Web-Service-module),
which shows you how to use the accompanying `moodlews.service` module to write your own script for interacting with WeLearn, or indeed any other Moodle service.

### Demo
[![asciicast](https://asciinema.org/a/LuVrCehQKXCBeCeXNRUZqgLdm.svg)](https://asciinema.org/a/LuVrCehQKXCBeCeXNRUZqgLdm)
Expand All @@ -19,7 +23,7 @@ Clone this repo or download the source code, and navigate to that directory. To
```
pip install -r requirements.txt
```
You can now simply call the `welearn_bot` script using `python3`.
You can now simply call the `welearn_bot` script within the `src` directory using `python3`.

## Configuration
On \*nix systems (linux, macos), create a `~/.welearnrc` file; on Windows, create a `welearn.ini` in your `C:/Users/USERNAME/` folder.
Expand All @@ -40,50 +44,20 @@ ES5505

You may omit any or all of your `[auth]` credentials, in which case you will be prompted each time you run the program.

The `ALL` keyword will act as shorthand for the course names present in the `[courses]` section.
This way, you can choose to omit redundant courses in this section.


For more control over the organization of your files, add the `[files]` section to your config.
```
[files]
ignore = mp4,mkv
pathprefix = ~/welearn
```

All files with extensions listed in the `ignore` option will be not be downloaded.
This is useful for ignoring typically large files such as video files.
This setting is overridden by the `--ignoretypes` command line option, which in turn is overridden by the `--forcedownload` flag

The `pathprefix` is used to specify a common path for storing all your WeLearn course directories, which in turn store
your resources and assignment files.
This is overriden by the `--pathprefix` command line option.
There are many more configuration options to explore, such as the `[files]` and `[gcal]` sections - for a detailed breakdown, please consult our
wiki page on [writing your configuration file](https://github.com/ParthBibekar/Welearn-bot/wiki/Writing-your-configuration-file).

### Google calendar integration
Integration with Google Calendar is completely optional. This feature allows you to save your assignment dates directly to Google Calendar, when you use the `--gcalendar` option.
You will have to authenticate using OAuth2.0 - follow the given step.

- Go to the [Google Cloud Console](https://console.cloud.google.com/), while logged in to your desired account. If you are new to the platform, you will be prompted to agree and continue.
- Click on _Create Project_. Enter a suitable name, and leave the organization blank.
- In the search bar, search for "Google Calendar API", and enable it.
- Click on _Credentials_ > _Configure Consent Screen_.
- Choose _External_. Enter the "App Name", "User support email" and "Developer Contact Information" with your desired values. Click _Save and Continue_.
- Fill in the "Test User's Email ID" with the address which you will be using to add events. Click _Save and Continue_ > _Back to Dashboard_.
- In "API's & Services", click on _Credentials_ > _Create Credentials_ > _OAuth client ID_. Set the Application type to "Desktop app", add a suitable client name, and click _Create_. Upon being prompted, click _OK_.
- In the "OAuth 2.0 Client ID's", click on the client name you just created. You'll see a page with "Client ID" and "Client secret" values
given on the right. Copy these and add the following lines to your config file (`.welearnrc` or `welearn.ini`), filling in your values.
You can also choose which calendar within your Google Calendar account to push events to.

You will have to authenticate using OAuth2.0 and add some lines to your configuration file.
Please follow the steps in the [Google Calendar integration](https://github.com/ParthBibekar/Welearn-bot/wiki/Google-Calendar-integration) article.
At the end, your configuration file will have a section of the following form.
```
[gcal]
client_id = xxxxxxxxxxxxxxx.apps.googleusercontent.com
client_secret = xxxxxxxxxxxxxxxxx
```
When you run the program using the `--gcalendar` option for the first time, you will be taken to an OAuth2.0 login page in your browser.
You will stay logged in for at most a day.

If you want your events to be saved to a calendar other than your primary one, go to Google Calendar and create a new calendar.
Once it appears under "My Calendars", open its settings, scroll down to "Integrate calendar" and copy the "Calendar ID".
Update your config with this line under the `[gcal]` section.
```
calendar_id = c_xxxxxxxxxxxxxxxxxxxxxxxxxx@group.calendar.google.com
```

Expand Down Expand Up @@ -114,6 +88,7 @@ optional arguments:
-p PATHPREFIX, --pathprefix PATHPREFIX
save the downloads to a custom path, overrides .welearnrc
```
See our article on [using command line options](https://github.com/ParthBibekar/Welearn-bot/wiki/Using-command-line-options) for a detailed breakdown.

## Examples
### Testing your setup
Expand Down Expand Up @@ -172,3 +147,4 @@ and put all the course directories in the `~/notes` folder, run
```
welearn_bot files PH2202 -fp ~/notes
```

0 comments on commit 384405d

Please sign in to comment.