Skip to content
Snippets Groups Projects
Commit 42ead06f authored by David Huss's avatar David Huss :speech_balloon:
Browse files

Try life updating id_patterns from server

parent 41bba04c
Branches
No related tags found
No related merge requests found
......@@ -320,6 +320,17 @@ def read_key_input(input_queue, config, logger):
time.sleep(0.01)
def update_id_patterns() -> 'Config':
if config["server"]["port"] == 80:
protocol = "http"
else:
protocol = "https"
url = '{}://{}/config/database/id_patterns'.format(protocol, config["server"]["address"].rstrip("/"))
r = requests.get(url)
print(r.text)
# config["client"]["id_patterns"]
def main():
logging.info('Starting main() in {}'.format(APPLICATION_NAME))
......@@ -344,6 +355,8 @@ def main():
# Set the LED to display readyness
dispatch_led("startup", config)
last_pattern_update = None
# On the main thread handle communications between the two other threads. That means:
# If there is sth. on the input queue, put it onto the output queue if it fits the
# specified format
......@@ -360,6 +373,10 @@ def main():
else:
time.sleep(0.01)
if last_pattern_update is None or time.time() - last_pattern_update > config["server"]["update_frequency"]:
last_pattern_update = time.time()
update_id_patterns()
time.sleep(0.01)
......
......@@ -21,6 +21,7 @@ address = "127.0.0.1"
port = 80
timeout = 5
verify_cert = true
update_frequency = 10
[client]
location = "lerchenfeld/mensa"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment