From a3e36e6c66dff6eb33bc15847b7666df0b098eeb Mon Sep 17 00:00:00 2001 From: led-spb Date: Sat, 3 Feb 2018 01:54:54 +0300 Subject: [PATCH] Adding information about current TV channel to WebOS media player (#11339) * Added Channel attribute to webos media pplayer * webostv: Current TV channel display as media_title * Added displaying information about the current TV channel for WebOS platform * Fixed PEP8 requirements --- homeassistant/components/media_player/webostv.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/homeassistant/components/media_player/webostv.py b/homeassistant/components/media_player/webostv.py index fed442e140e..2081fc95223 100644 --- a/homeassistant/components/media_player/webostv.py +++ b/homeassistant/components/media_player/webostv.py @@ -174,6 +174,7 @@ class LgWebOSDevice(MediaPlayerDevice): self._state = STATE_UNKNOWN self._source_list = {} self._app_list = {} + self._channel = None @util.Throttle(MIN_TIME_BETWEEN_SCANS, MIN_TIME_BETWEEN_FORCED_SCANS) def update(self): @@ -189,10 +190,12 @@ class LgWebOSDevice(MediaPlayerDevice): self._state = STATE_OFF self._current_source = None self._current_source_id = None + self._channel = None if self._state is not STATE_OFF: self._muted = self._client.get_muted() self._volume = self._client.get_volume() + self._channel = self._client.get_current_channel() self._source_list = {} self._app_list = {} @@ -225,6 +228,7 @@ class LgWebOSDevice(MediaPlayerDevice): self._state = STATE_OFF self._current_source = None self._current_source_id = None + self._channel = None @property def name(self): @@ -261,6 +265,14 @@ class LgWebOSDevice(MediaPlayerDevice): """Content type of current playing media.""" return MEDIA_TYPE_CHANNEL + @property + def media_title(self): + """Title of current playing media.""" + if (self._channel is not None) and ('channelName' in self._channel): + return self._channel['channelName'] + else: + return None + @property def media_image_url(self): """Image url of current playing media."""