Example #1
0
else:
    img = Image.new("P", (inky_display.WIDTH, inky_display.HEIGHT))
    font_size = 20
    margin = 0

draw = ImageDraw.Draw(img)

font = ImageFont.truetype(FredokaOne, font_size)

lines = []

track = Radio.fetchTrack()
if not track:
    sys.exit()

timestamp = Radio.getStartTime(track)
composer = Radio.getComposer(track)
title = Radio.getTitle(track)

cache_file = '/tmp/cache'

if os.path.exists(cache_file):
    cache = open(cache_file, 'rt')
    play_history = json.loads(cache.readline())
    cache.close()

    if play_history['timestamp'] >= timestamp:
        print("skipping " + composer + ' ' + title)
        # No need to update the display, it's already up to date
        sys.exit()