Rapla formatting

This commit is contained in:
2024-10-08 10:00:21 +02:00
parent 34822bfc93
commit f27d54798c

View File

@ -103,7 +103,7 @@ async def getNewRapla(url: str, testing=False):
elif parsed[0] == 2:
return await buildICALfromKey(parsed[1], onlyUpdate=False, testing=testing)
fileInURL = url.find("file=")
kurs = url[fileInURL + 5:].upper()
kurs = url[fileInURL + 5:].replace(" ", "").upper()
if url[-5:] != ".ical":
try:
async with httpx.AsyncClient() as s:
@ -210,7 +210,7 @@ async def buildICALfromKey(url, onlyUpdate, testing=False):
else:
return 200
else:
kursname = page.text[page.text.find("<title>") + 7:page.text.find("</title>")]
kursname = page.text[page.text.find("<title>") + 7:page.text.find("</title>")].replace(" ", "")
if testing:
assert "TMT22B1" in kursname
if len(kursname) > 15:
@ -238,6 +238,7 @@ async def buildICALfromKey(url, onlyUpdate, testing=False):
event.add('LOCATION', jsonday['ressources'])
event.add('DTSTART', parse(jsonday['startDate'], dayfirst=True))
event.add('DTEND', parse(jsonday['endDate'], dayfirst=True))
event.add('UID', jsonday['UID'])
try:
teacher = icalendar.vCalAddress(value=jsonday['persons'])
teacher.params["CN"] = jsonday['persons']