webui: handle playback_pos response with empty contents #13

Merged
oysteikt merged 1 commits from handle-empty-playback-pos-response into master 2024-08-05 21:16:57 +02:00
1 changed files with 1 additions and 1 deletions

View File

@ -294,7 +294,7 @@ class RemiApp(App):
except api.APIError:
playback_pos = None
if playback_pos:
if playback_pos and isinstance(playback_pos, dict) and playback_pos["current"] and playback_pos["total"]:
oysteikt marked this conversation as resolved Outdated
			if playback_pos and isinstance(playback_pos, dict) and "current" in playback_pos and "total" in playback_pos: 
```suggestion if playback_pos and isinstance(playback_pos, dict) and "current" in playback_pos and "total" in playback_pos: ```

ellers får du KeyError

ellers får du KeyError

glemte å godkjenne pending comments...

<sup>glemte å godkjenne pending comments...<sup>
slider_pos = playback_pos["current"] / playback_pos["total"] * 100
current = seconds_to_timestamp(playback_pos["current"])
total = seconds_to_timestamp(playback_pos["total"])