From f27d54798c0aa4fd8d18902e6e78d6c21dea93e0 Mon Sep 17 00:00:00 2001 From: paulmart-n Date: Tue, 8 Oct 2024 10:00:21 +0200 Subject: [PATCH] Rapla formatting --- fetchRAPLA.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fetchRAPLA.py b/fetchRAPLA.py index 93a93cf..26209f9 100644 --- a/fetchRAPLA.py +++ b/fetchRAPLA.py @@ -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("") + 7:page.text.find("")] + kursname = page.text[page.text.find("") + 7:page.text.find("")].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']