Skip to content
This repository has been archived by the owner on Aug 9, 2024. It is now read-only.

antoniosubasic/exad

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

exad is an EXam ADministration

It is built for the HTBLA Leonding, but should also work with other schools. It scrapes exams from WebUntis, parses their information and can store them in a .csv file (which can be imported to Google Calendar) or directly push them to Google Calendar (for that, Google API and Google OAuth 2.0 must be set up).

Requirements

.NET 8 or higher

Setup

  1. Download the source code
  2. Unzip the folder
  3. When running dotnet run for the first time, the config file is automatically generated in ~/.config/exad/config.json
  4. In the config.json configure the following:
    • calendar-id (optional): The ID of the Google Calendar to push the exams to (I recommend creating a new calendar, so the program doesn't have to mess with your personal calendar)
    • schoolurl: The URL which WebUnits uses for the school (to get it, go to your school's WebUntis page and copy the domain, e.g.: mese.webuntis.com)
    • schoolname: The name which WebUnits uses for the school (to get it, go to your school's WebUntis page and copy the name from the top-left corner, e.g.: HTBLA Linz-Leonding)
    • username: The username of the WebUntis account
    • password: The password of the WebUntis account
  5. (optional) Setup the Google API:
    • Go to the Google API Console and create a new project - top left: Select a project > New project. Then, name your project and click create
    • Now, go to the Library tab in the side bar and search for "Google Calendar". Click on the Google Calendar API card and click Enable
    • After that, click on Credentials tab under the "Google Calendar API" and then Configure Consent Screen
    • Select External as the user type. Then fill out the required fields (should only be "App Information" and "Developer Contact Information"). As the app name, you can choose whatever you want and as the email you can choose your normal email (we won't be publishing this project anyway so the contact information isn't important). After that, click Save and continue
    • Under Scopes, select Add or remove scopes and type filter for "auth/calendar.events" and select the scopes auth/calendar.events and auth/calendar.events.owned that appear. Then, click Update and Save and continue
    • Under "Test users", add yourself as the test user (the email you enter will later be used to log into the consent screen), then click Save and continue
    • At the end you can review your information and then click Back to dashboard
    • Lastly, on go to the Credentials tab in the side bar and click Create credentials. Select OAuth client ID. Select Desktop app as the application type, give it a name and click Create. A new window will open, showing you the client ID and client secret. Download the JSON file and save at this path in your home directory ~/.exad/client_secrets.json
  6. (optional) Setup a subjects-translator: In the Classes.cs there is a method called TranslateSubject() which translates the raw subject names from Webuntis any subject names you want. You can change the method to your liking. If you don't want to translate any subjects, just leave the method as it is.

Usage

Run dotnet run -- --help to see the help page

  1. dotnet run -- save -o <output-file>.csv to save the exams to a .csv file (default for output-file is events.csv)
  2. dotnet run -- push to push the exams to the Google Calendar