diff --git a/config.py.example b/config.py.example index 27254fd575acc9c1fa6df3b8cd010a416665f876..53d80f9c653466db9f9c7732449abac8a5647123 100644 --- a/config.py.example +++ b/config.py.example @@ -19,3 +19,4 @@ SQLITE_INIT_SCHEMA = True SQLITE_INIT_DATA = False #LDAP_HOST = 'ldaps://rumo.fsmpi.rwth-aachen.de' +#ICAL_URL = 'https://user:password@mail.fsmpi.rwth-aachen.de/SOGo/....ics' diff --git a/meetings.py b/meetings.py index 57b3e505b6720a7836918ad2371f01a928e13af9..0eb0195fcb04fceca2140f7de6f6665102e3bd97 100644 --- a/meetings.py +++ b/meetings.py @@ -21,6 +21,7 @@ def get_next_meeting(): event = sorted(meetings, key=lambda e: e['DTSTART'].dt)[0] return str(event['UID']), event['DTSTART'].dt.replace(tzinfo=None) +@sched_func(60*60) def update_meeting(): try: uid, start = get_next_meeting() diff --git a/server.py b/server.py index 88c5683a8e423c3d7b76ac3599cfaf8399c0134c..8b00fbcebb20c1a10a6749ba6d3ca7181bc744b3 100644 --- a/server.py +++ b/server.py @@ -8,6 +8,7 @@ import sys import hashlib import random import sched +import time app = Flask(__name__) @@ -19,6 +20,7 @@ app.add_template_global(timedelta, name='timedelta') scheduler = sched.scheduler() def run_scheduler(): + time.sleep(1) # UWSGI does weird things on startup while True: scheduler.run() @@ -449,3 +451,5 @@ import feeds import importer import schedule import sorter +if 'ICAL_URL' in config: + import meetings