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
try:
cm, cs = divmod(round(float(status['elapsed'])), 60)
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)
if "duration" in status:
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:
info = "Stopped"
if (info != last_info):