Add checks before access

This commit is contained in:
ABelliqueux 2024-09-06 21:11:23 +02:00
parent 2aa0ae2bcd
commit 9fed2a710b
1 changed files with 7 additions and 3 deletions

View File

@ -210,9 +210,13 @@ def update_display(device, currentsong:dict, status:dict, mode:str, cursor_pos:i
draw = ImageDraw.Draw(ui)
if mode == 'playback':
if len(currentsong):
draw.text((ui_text_x, 2), currentsong['artist'], fill="white", font=jfont)
draw.text((ui_text_x, 14), currentsong['title'], fill="white", font=jfont)
draw.text((ui_text_x, 26), currentsong['album'], fill="white", font=jfont)
# ~ draw.text((ui_text_x, 2), currentsong['artist'], fill="white", font=jfont)
# ~ draw.text((ui_text_x, 14), currentsong['title'], fill="white", font=jfont)
# ~ draw.text((ui_text_x, 26), currentsong['album'], fill="white", font=jfont)
if 'artist' in currentsong:
draw.text((ui_text_x, 2), currentsong['artist'], fill="white", font=jfont)
if 'title' in currentsong:
draw.text((ui_text_x, 14), currentsong['title'], fill="white", font=jfont)
if 'elapsed' in status:
draw.text((ui_text_x, 38), "{}/{}".format(sectomin(status['elapsed']), sectomin(status['duration'])), fill="white", font=jfont)
elif mode == 'browse':