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
This commit is contained in:
led-spb 2018-02-03 01:54:54 +03:00 committed by Fabian Affolter
parent 730e0a0094
commit a3e36e6c66

View File

@ -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."""