From 924afb597b006a04900428fab3745ff3e406f590 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Szumy=C5=82owicz?= Date: Sat, 1 Sep 2018 14:53:14 +0100 Subject: [PATCH] initial commit --- beer/main.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 beer/main.py diff --git a/beer/main.py b/beer/main.py new file mode 100644 index 0000000..8cf530d --- /dev/null +++ b/beer/main.py @@ -0,0 +1,25 @@ +"""What's on tap?! +""" +___name___ = "beer" +___license___ = "MIT" +___dependencies___ = ["app", "sleep", "wifi", "http", "ugfx_helper"] +___categories___ = ["EMF"] + +import wifi, ugfx, http, ujson, app +from tilda import Buttons +from time import sleep + +ugfx.init() +ugfx.clear() + +while (not Buttons.is_pressed(Buttons.BTN_A)) and (not Buttons.is_pressed(Buttons.BTN_B)) and (not Buttons.is_pressed(Buttons.BTN_Menu)): + + bar_json = http.get("https://bar.emf.camp/location/Bar.json").raise_for_status().content + bar = ujson.loads(bar_json) + + for idx, beer in enumerate(bar['location']): + ugfx.text(5, 5+idx*15, beer['description'], ugfx.RED) + + sleep(60) + +app.restart_to_default() \ No newline at end of file