-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsitTimeTableGrabber.py
59 lines (51 loc) · 2 KB
/
sitTimeTableGrabber.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
## @file sitTimeTableGrabber.py
#
# @brief GUI with instructions to grab timetable from in4sit
# Copyright 2022, Jodie Moh, All rights reserved.
#
# @author Jodie Moh
from txtToCsv import parseScheduleTxt, createCSVFile
from csvToIcs import parseIcsFromCsv
import easygui
def main():
message = "Login to 'IN4SIT', click on 'Course Management' > 'My Weekly Schedule' > 'List View'." +\
"\nFrom there, highlight and copy the entire table(s) inclusive of the table title and save it in a .txt file." +\
"\nClick on continue once the txt file has been created."
title = "SIT Time Table Grabber Help Box"
continueText = "Continue"
output = easygui.msgbox(message, title, continueText)
if(output is None):
return
message = "Open the .txt file that you have saved."
output = easygui.msgbox(message, title, continueText)
if(output is None):
return
try:
data = parseScheduleTxt()
except Exception as e:
print(e)
message = "An error has occured, did you select the right text file?"
easygui.msgbox(message, title)
return
try:
createCSVFile(data)
except Exception as e:
print(e)
message = "An error has occured, csv file cannot be created. \nPlease ensure that the .txt file used is valid."
easygui.msgbox(message, title)
return
message = "Continue to convert the created .csv file into .ics format."
output = easygui.buttonbox(message, title, ["Exit", continueText])
if(output is None or output == "Exit"):
return
elif(output == continueText):
try:
parseIcsFromCsv()
except Exception as e:
print(e)
message = "An error has occured, ical file cannot be created. \nPlease ensure that the .txt or .csv file used is valid."
easygui.msgbox(message, title)
return
message = "Open the .ical file in your calendar application to import!"
output = easygui.msgbox(message, title, "Bye!")
main()