webui: handle playback_pos response with empty contents

This commit is contained in:
Oystein Kristoffer Tveit 2024-08-04 01:49:12 +02:00
parent b9444658fb
commit 771275cf84
Signed by: oysteikt
GPG Key ID: 9F2F7D8250F35146
1 changed files with 6 additions and 1 deletions

View File

@ -294,7 +294,12 @@ class RemiApp(App):
except api.APIError: except api.APIError:
playback_pos = None playback_pos = None
if playback_pos: if all([
playback_pos,
isinstance(playback_pos, dict),
playback_pos["current"],
playback_pos["total"],
]):
slider_pos = playback_pos["current"] / playback_pos["total"] * 100 slider_pos = playback_pos["current"] / playback_pos["total"] * 100
current = seconds_to_timestamp(playback_pos["current"]) current = seconds_to_timestamp(playback_pos["current"])
total = seconds_to_timestamp(playback_pos["total"]) total = seconds_to_timestamp(playback_pos["total"])