This Bash script automates converting a University of Guelph student's schedule (downloaded as a PDF from WebAdvisor) into a .ics
file for easy import into calendar applications such as Google, Apple, or Outlook Calendar. The script processes lectures, labs, and exams while handling recurring events to optimize performance.
-
PDF Conversion:
- Converts the WebAdvisor PDF schedule into a plain text file using
pdftotext
.
- Converts the WebAdvisor PDF schedule into a plain text file using
-
Recurring Event Support:
- Generates optimized recurring events for lectures, labs, and exams using ICS
RRULE
format.
- Generates optimized recurring events for lectures, labs, and exams using ICS
-
Calendar Integration:
- Outputs a
.ics
file compatible with calendar applications like Google Calendar, Apple Calendar, and Outlook.
- Outputs a
-
Fast Execution:
- Efficient parsing and caching mechanisms ensure quick execution, even for complex schedules.
-
Automate Schedule Parsing:
- Extract and organize course titles and event details from the PDF into structured data.
-
Generate
.ics
File:- Automate the creation of an iCalendar file for easy import into calendar applications.
-
Optimize Performance:
- Handle recurring events to minimize file size and reduce execution time.
-
pdftotext
:- Converts PDF files to plain text for processing.
- Part of the
poppler-utils
package.
For Linux/macOS:
sudo apt install poppler-utils
For Windows (via Chocolatey):
- Install Chocolatey if it’s not already installed.
- Install
pdftotext
using Chocolatey:choco install poppler
-
Bash:
- The script requires a Bash-compatible shell (e.g., Git Bash on Windows, or Bash on Linux/macOS).
-
Download the Schedule PDF from WebAdvisor:
-
Log in to WebAdvisor using your University of Guelph student account.
-
Navigate to the Student Planning section.
-
Select Plan your Degree & Register for Classes.
-
Locate the Print button on the page (as shown below) and click it:
-
A new tab will open with your schedule in a printable format. Follow these steps to save it as a PDF:
-
-
Run the Script:
./script.sh
-
Provide the PDF Path: When prompted, enter the full path to your downloaded WebAdvisor schedule PDF.
-
View the Output:
- The script will generate a
Schedule.ics
file in the current directory.
- The script will generate a
A typical schedule from WebAdvisor might look like this:
CIS*2520*0110: Data Structures
LEC MWF 1:30 PM - 2:20 PM 9/5/2024 - 12/13/2024
LAB T 3:30 PM - 5:20 PM 9/5/2024 - 12/13/2024
EXAM F 2:30 PM - 4:30 PM 12/6/2024 - 12/6/2024
BEGIN:VCALENDAR
VERSION:2.0
CALSCALE:GREGORIAN
BEGIN:VEVENT
UID:abcd1234
DTSTAMP:20230901T123456Z
DTSTART:20230905T133000
DTEND:20230905T142000
RRULE:FREQ=WEEKLY;BYDAY=MO,WE,FR;UNTIL=20231213T235959Z
SUMMARY:Lecture for CIS*2520*0110
DESCRIPTION:Lecture session for CIS*2520*0110
LOCATION:Mackinnon Building Room 101
END:VEVENT
END:VCALENDAR
- The script is optimized for performance and can process schedules in less than 2 seconds for typical inputs.
-
Error Handling:
- Improve validation for missing or malformed input files.
-
Additional Features:
- Add support for holidays or exceptions in the schedule.
-
Implement Outlook and Google Calendar APIs
- Offer direct imports from the script into Outlook or Google Calendar using their respective APIs.
-
Improved User Interface (With Help from Matthew Jarzynowski):
- Provide clearer prompts and progress messages for users.