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 Franck Nijhof
parent a06af7ee93
commit 1133c41fa8
No known key found for this signature in database
GPG Key ID: D62583BA8AB11CA3

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