Dont store cookies + iCal refresh
This commit is contained in:
@ -3,6 +3,7 @@ from urllib.request import urlretrieve
|
||||
import icalendar
|
||||
import json
|
||||
import recurring_ical_events
|
||||
from init import scheduler
|
||||
|
||||
|
||||
def parseURL(url: str):
|
||||
@ -40,11 +41,20 @@ def getNewRapla(url: str):
|
||||
|
||||
file = open("calendars/list.json", "r+")
|
||||
jsoncal = json.load(file)
|
||||
jsoncal.update({kurs: "rapla" + kurs + ".ical"})
|
||||
jsoncal.update({kurs: ["rapla" + kurs + ".ical", url]})
|
||||
file.close()
|
||||
file = open("calendars/list.json", "w")
|
||||
json.dump(jsoncal, file, indent=4)
|
||||
return "rapla"+kurs+".ical"
|
||||
return "rapla" + kurs + ".ical"
|
||||
|
||||
|
||||
def getIcal(kurs: str):
|
||||
file = open("calendars/list.json", "r")
|
||||
jf = json.load(file)
|
||||
try:
|
||||
return jf[kurs]
|
||||
except KeyError:
|
||||
return None
|
||||
|
||||
|
||||
def getRaplas():
|
||||
@ -52,7 +62,18 @@ def getRaplas():
|
||||
jsonf = json.load(file)
|
||||
kursl = []
|
||||
filel = []
|
||||
urll = []
|
||||
for i in jsonf:
|
||||
kursl += [i]
|
||||
filel += [jsonf[i]]
|
||||
return sorted(kursl), sorted(filel)
|
||||
filel += [jsonf[i][0]]
|
||||
urll += [jsonf[i][1]]
|
||||
return sorted(kursl), sorted(filel), sorted(urll)
|
||||
|
||||
|
||||
@scheduler.task("interval", id="refreshRapla", minutes=30)
|
||||
def refreshRapla():
|
||||
filel = getRaplas()[1]
|
||||
urll = getRaplas()[2]
|
||||
for i in range(len(filel)):
|
||||
urlretrieve(urll[i], "calendars/"+filel[i])
|
||||
print("Update die Kalender...")
|
||||
|
||||
Reference in New Issue
Block a user