Fix empty list in kodi media_player (#121250)

Co-authored-by: Franck Nijhof <frenck@frenck.nl>
This commit is contained in:
Rasmus Lundsgaard 2024-07-06 19:20:14 +02:00 committed by GitHub
parent 98370fd9a0
commit 99476d9337
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -641,12 +641,10 @@ class KodiEntity(MediaPlayerEntity):
if self.state == MediaPlayerState.OFF:
return state_attr
hdr_type = (
self._item.get("streamdetails", {}).get("video", [{}])[0].get("hdrtype")
)
if hdr_type == "":
state_attr["dynamic_range"] = "sdr"
else:
state_attr["dynamic_range"] = "sdr"
if (video_details := self._item.get("streamdetails", {}).get("video")) and (
hdr_type := video_details[0].get("hdrtype")
):
state_attr["dynamic_range"] = hdr_type
return state_attr