From a8d947544be6ff424d777d7049cf8b0b41b66f45 Mon Sep 17 00:00:00 2001 From: Markus Koch Date: Sun, 19 Jul 2020 18:38:06 +0200 Subject: [PATCH] sw: Allow empty duration --- software/webradio.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/software/webradio.py b/software/webradio.py index 8bd5a9c..c0f27ec 100644 --- a/software/webradio.py +++ b/software/webradio.py @@ -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):