Skip to content

Boucanier/Convert-schedule-to-pdf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Convert-schedule-to-pdf

Python Discord

This project is a schedule scrapper that will convert it into a pdf file.

Requirements

To run the code, you need to have the following packages installed :

  • Python 3.10 or above (sudo apt install python3)
  • requests module (pip install requests)
  • BeautifulSoup module (pip install bs4)
  • xlsxwriter module (pip install xlsxwriter)
  • discord module (pip install discord) : only for discord bot
  • pil module (pip install pil) : only for discord bot
  • lxml parser module (pip install lxml)
  • LibreOffice 7.3 or above (sudo apt install libreoffice)
  • xdg-utils (sudo apt install xdg-utils) : only for Linux distribution

To install all these requirements on a Debian based Linux distribution, you can run the script installation.sh. If you are using another distribution or system, you can run the following command to install the python modules :

pip install -r requirements.txt

Description

Local program

Run src/main.py, then enter the element you want your schedule based on (1 : group, 2 : staff, 3 : room), refresh the list of schedule (4 : refresh), create or reset the SQL database (5 : DB creation), update the SQL database (6 : DB update) or exit the program (7 : quit).

If you chose to get a schedule based on room or staff (option 3 or 4), the program will get the schedule of every group and then you will have to specify a room/professor. The program will filter every schedule with your choice and merge everything together. Once you have created a schedule based on a room/professor, the program will not refresh every schedule unless you refresh it with option 4 in the menu.

If you choose to create the SQL database, then it will create a file called schedule.db in the data directory. This DB contain tables for staff, modules, rooms, groups and courses. When you create/reset the DB, every table is dropped. Then the tables for staff, modules, rooms and groups are filled with data.

If you choose to update the DB, it will add all missing staff, rooms, modules and groups to the corresponding tables. Then it will delete every course for the current week and the next 3 weeks. After that, it will insert the missing courses in the table.

Then the program will create a xlsx file and a pdf file from it. It will open the pdf file automatically.

Discord bot

To run the discord bot, make sure that you have a config folder with this files : token.json and bot_config.json. Each file contain respectively this information :

  • token.json :
{
  "token": "[your bot token]"
}
  • bot_config.json :
{
  "to_ping": "[ping id]",
  "default_group": "[your default group (for whole university)]",
  "precised_group": "[your default precised group (your group)]",
  "default_channel": 123456789,
  "output_dir": "[your_files_output_directory/]", 
  "send_time": [0, 0],
}

Then, run the bot.py file from the project root.

About

pdf format schedule converter and statistics generator

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published