From ef039d6a65c01c8184a528f40f883244e39f6743 Mon Sep 17 00:00:00 2001 From: Ian Duffy <1243435+imduffy15@users.noreply.github.com> Date: Sun, 9 Aug 2020 17:25:22 +0100 Subject: [PATCH] Fix Kodi play_media media type casing (#38665) * [KODI] Fix casing issue Alexa and the Services UI on HA feeds in a media type of "channel" for media type. The Kodi code looks for a "CHANNEL" instead, as a result the functionality fails. * Update homeassistant/components/kodi/media_player.py Co-authored-by: Chris Talkington * Update homeassistant/components/kodi/media_player.py Co-authored-by: Chris Talkington * Update homeassistant/components/kodi/media_player.py Co-authored-by: Chris Talkington * Update homeassistant/components/kodi/media_player.py Co-authored-by: Chris Talkington Co-authored-by: Chris Talkington --- homeassistant/components/kodi/media_player.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/kodi/media_player.py b/homeassistant/components/kodi/media_player.py index 81f8696a31a..e2dc15bab41 100644 --- a/homeassistant/components/kodi/media_player.py +++ b/homeassistant/components/kodi/media_player.py @@ -774,13 +774,15 @@ class KodiDevice(MediaPlayerEntity): @cmd async def async_play_media(self, media_type, media_id, **kwargs): """Send the play_media command to the media player.""" - if media_type == "CHANNEL": + media_type_lower = media_type.lower() + + if media_type_lower == MEDIA_TYPE_CHANNEL: await self.server.Player.Open({"item": {"channelid": int(media_id)}}) - elif media_type == "PLAYLIST": + elif media_type_lower == MEDIA_TYPE_PLAYLIST: await self.server.Player.Open({"item": {"playlistid": int(media_id)}}) - elif media_type == "DIRECTORY": + elif media_type_lower == "directory": await self.server.Player.Open({"item": {"directory": str(media_id)}}) - elif media_type == "PLUGIN": + elif media_type_lower == "plugin": await self.server.Player.Open({"item": {"file": str(media_id)}}) else: await self.server.Player.Open({"item": {"file": str(media_id)}})