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 <chris@talkingtontech.com>

* Update homeassistant/components/kodi/media_player.py

Co-authored-by: Chris Talkington <chris@talkingtontech.com>

* Update homeassistant/components/kodi/media_player.py

Co-authored-by: Chris Talkington <chris@talkingtontech.com>

* Update homeassistant/components/kodi/media_player.py

Co-authored-by: Chris Talkington <chris@talkingtontech.com>

Co-authored-by: Chris Talkington <chris@talkingtontech.com>
This commit is contained in:
Ian Duffy 2020-08-09 17:25:22 +01:00 committed by GitHub
parent f526deaa87
commit ef039d6a65
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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)}})