diff options
author | Marvin Borner | 2019-12-28 17:40:46 +0100 |
---|---|---|
committer | Marvin Borner | 2019-12-28 17:40:46 +0100 |
commit | 72434f20e207a3785bd6e99246445b26272c2ead (patch) | |
tree | b2432410eae3240d0981b79abb459791734fe57d | |
parent | 9ab9b43476dee0e85c6fd277ca5acb49a4cea87f (diff) |
Fixed world
-rw-r--r-- | epaper/main.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/epaper/main.py b/epaper/main.py index ab62542..f540d23 100644 --- a/epaper/main.py +++ b/epaper/main.py @@ -9,7 +9,7 @@ from datetime import date from datetime import datetime from PIL import Image,ImageDraw,ImageFont -font_size = 14 +font_size = 12 epd = epd2in13.EPD() epd.init(epd.FULL_UPDATE) @@ -20,7 +20,6 @@ draw = ImageDraw.Draw(image) font = ImageFont.truetype('/usr/share/fonts/truetype/wqy/wqy-microhei.ttc', font_size) resp = json.load(open("everything.schedule.json")) -print("marvin ist nicht toll") days = resp['schedule']['conference']['days'] conferences = [] for day in days: @@ -29,15 +28,15 @@ for day in days: conf_date = datetime.strptime(conference['date'].split('+')[0], '%Y-%m-%dT%H:%M:%S') offset = conf_date - datetime.now() if offset.seconds / 3600 < 3 and offset.seconds/3600 > 0 and offset.days==0: - print(offset.seconds / 3600) conferences.append(conference) + sorted_list = sorted(conferences, key=lambda i: i['date']) -print(sorted_list) -for i in range(1, 6): - draw.text((0, font_size * i + 2), conferences[i - 1]['title'], font=font, fill=0) +for i in range(0, 9, 2): + draw.text((0, font_size * i + 2), sorted_list[i]['start'] + ' - ' + sorted_list[i]['room'] + ':', font=font, fill=0) + draw.text((50, font_size * (i + 1) + 2), sorted_list[i]['title'], font=font, fill=0) epd.display(epd.getbuffer(image)) # time.sleep(10) # epd.Clear(0xFF) -epd.sleep()
\ No newline at end of file +# epd.sleep() |