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() composer = Radio.getComposer(track) title = Radio.getTitle(track) cache_file = '/tmp/cache' last_track = '' if os.path.exists(cache_file): cache = open(cache_file, 'rt') play_history = json.loads(cache.readline()) cache.close() if play_history['current_track'] == composer + ' ' + title: print("skipping " + composer + ' ' + title) # No need to update the display, it's already up to date sys.exit()
from radio import Radio track = Radio.fetchTrack() if track: composer = Radio.getComposer(track) title = Radio.getTitle(track) if composer: print(composer + " - " + title) else: print(title) else: print("Special Programming")