Timeout-Check + MERGE-Prep
This commit is contained in:
@ -7,6 +7,13 @@ from init import scheduler
|
||||
|
||||
|
||||
def parseURL(url: str):
|
||||
"""
|
||||
Konvertiert URLs ins korrekte Format. \n
|
||||
Konvertiert werden: http, www.; page=calendar \n
|
||||
In: https; page=ical
|
||||
:param url:
|
||||
:return str:
|
||||
"""
|
||||
rapla = url.find("rapla.")
|
||||
if rapla == -1:
|
||||
return 0
|
||||
@ -28,6 +35,13 @@ def parseURL(url: str):
|
||||
|
||||
|
||||
def getNewRapla(url: str):
|
||||
"""
|
||||
Speichert den iCal eines Raplas auf dem Server. \n
|
||||
Gibt Namen der Datei zurück. \n
|
||||
TODO: Standort zu Dateibezeichner hinzufügen, um Konflikte zu vermeiden.
|
||||
:param url:
|
||||
:return str:
|
||||
"""
|
||||
url = parseURL(url)
|
||||
if url == 0:
|
||||
return 0
|
||||
@ -49,6 +63,11 @@ def getNewRapla(url: str):
|
||||
|
||||
|
||||
def getIcal(kurs: str):
|
||||
"""
|
||||
Liefert den Namen der Datei des mitgegebenen Kurses.
|
||||
:param kurs:
|
||||
:return str:
|
||||
"""
|
||||
file = open("calendars/list.json", "r")
|
||||
jf = json.load(file)
|
||||
try:
|
||||
@ -58,6 +77,10 @@ def getIcal(kurs: str):
|
||||
|
||||
|
||||
def getRaplas():
|
||||
"""
|
||||
Liefert alle auf dem Server gespeicherten Raplas.
|
||||
:return (Kursliste, Dateiliste, URL-Liste):
|
||||
"""
|
||||
file = open("calendars/list.json", "r")
|
||||
jsonf = json.load(file)
|
||||
kursl = []
|
||||
@ -72,6 +95,9 @@ def getRaplas():
|
||||
|
||||
@scheduler.task("interval", id="refreshRapla", minutes=30)
|
||||
def refreshRapla():
|
||||
"""
|
||||
Aktualisiert alle 30 Minuten alle gespeicherten Raplas.
|
||||
"""
|
||||
filel = getRaplas()[1]
|
||||
urll = getRaplas()[2]
|
||||
for i in range(len(filel)):
|
||||
|
||||
Reference in New Issue
Block a user