update math parsing for sem 2
This commit is contained in:
parent
6461cfcfb1
commit
5492068022
1 changed files with 7 additions and 4 deletions
11
parse_csv.py
11
parse_csv.py
|
@ -10,17 +10,20 @@ def cleanup(text):
|
|||
|
||||
calendar = Calendar()
|
||||
|
||||
CLASS_START = time(hour=9, minute=33)
|
||||
CLASS_END = time(hour=10, minute=48)
|
||||
CLASS_START = time(hour=12, minute=7)
|
||||
CLASS_END = time(hour=1+12, minute=26)
|
||||
|
||||
math = list(reader(open('MPM2D Calendar Semester 1.csv', newline='')))
|
||||
math = list(reader(open('math calendar.csv', newline='')))
|
||||
dates = []
|
||||
for i in range(0, len(math), 2):
|
||||
if i+1 >= len(math):
|
||||
break
|
||||
for k in range(len(math[i])):
|
||||
event = cleanup(math[i+1][k])
|
||||
if event.lower() == "pa day" or event.lower() == "pd day" or "break" in event.lower():
|
||||
continue
|
||||
year = "2025 " if "January" in math[i][k] else "2024 "
|
||||
# year = "2025 " if "January" in math[i][k] else "2024 "
|
||||
year = "2025 "
|
||||
day = datetime.strptime(year + math[i][k], "%Y %B %d").date()
|
||||
calendar.events.append(
|
||||
Event(summary=event, start=datetime.combine(day, CLASS_START), end=datetime.combine(day, CLASS_END))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue