Add checks before access
This commit is contained in:
parent
2aa0ae2bcd
commit
9fed2a710b
10
mpdlisten.py
10
mpdlisten.py
|
@ -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':
|
||||
|
|
Loading…
Reference in New Issue