This commit is contained in:
Tyrel Souza 2018-08-28 20:17:29 -04:00
parent aaa96d5aeb
commit a0089c5661

32
good.py
View File

@ -1,8 +1,17 @@
import requests
import json
import os
import sys
from selenium import webdriver
import datetime
from PIL import ImageFont
import inkyphat
def main():
fake_pages = {'2014': 7375, '2015': 23508, '2016': 17696, '2017': 19706, '2018': 9388}
#pages = print(get_goodreads_pages())
draw(fake_pages)
def get_goodreads_pages():
@ -29,11 +38,28 @@ def get_goodreads_pages():
stats = driver.execute_script('return page_stats')
return stats
def draw(pages):
colour = 'red'
inkyphat.set_colour(colour)
inkyphat.set_border(inkyphat.BLACK)
inkyphat.set_image("./background.png")
p2018 = str(pages['2018'])
#font = ImageFont.truetype(inkyphat.fonts.AmaticSCBold, 38)
#w, h = font.getsize(p2018)
## Center the text and align it with the name strip
#
#x = (inkyphat.WIDTH / 2) - (w / 2)
#y = 71 - (h / 2)
#
#inkyphat.text((x, y), p2018, inkyphat.BLACK, font)
#
## Partial update if using Inky pHAT display v1
inkyphat.show()
def main():
fake_pages = {'2014': 7375, '2015': 23508, '2016': 17696, '2017': 19706, '2018': 9388}
#print(get_goodreads_pages())
if __name__ == "__main__":
main()