sw: Allow empty duration

This commit is contained in:
Markus Koch 2020-07-19 18:38:06 +02:00
parent 7efac00348
commit a8d947544b

View File

@ -179,8 +179,11 @@ class radioserv:
# Playback info # Playback info
try: try:
cm, cs = divmod(round(float(status['elapsed'])), 60) cm, cs = divmod(round(float(status['elapsed'])), 60)
dm, ds = divmod(round(float(status['duration'])), 60) if "duration" in status:
info = "#%d/%d %d:%02d/%d:%02d" % (int(status['song']) + 1, int(status['playlistlength']), cm, cs, dm, ds) dm, ds = divmod(round(float(status['duration'])), 60)
info = "#%d/%d %d:%02d/%d:%02d" % (int(status['song']) + 1, int(status['playlistlength']), cm, cs, dm, ds)
else:
info = "Radio %02d:%02d" % (cm, cs)
except: except:
info = "Stopped" info = "Stopped"
if (info != last_info): if (info != last_info):