Skip to content

Commit

Permalink
Adding information about current TV channel to WebOS media player (#1…
Browse files Browse the repository at this point in the history
…1339)

* 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
  • Loading branch information
led-spb authored and fabaff committed Feb 2, 2018
1 parent 730e0a0 commit a3e36e6
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions homeassistant/components/media_player/webostv.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ def __init__(self, host, name, customize, config, timeout,
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):
Expand All @@ -189,10 +190,12 @@ def update(self):
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 = {}
Expand Down Expand Up @@ -225,6 +228,7 @@ def update(self):
self._state = STATE_OFF
self._current_source = None
self._current_source_id = None
self._channel = None

@property
def name(self):
Expand Down Expand Up @@ -261,6 +265,14 @@ def media_content_type(self):
"""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."""
Expand Down

1 comment on commit a3e36e6

@MGiovanni
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you broke something...
ERROR:homeassistant.util.package:Unable to install package netdisco==1.2.4: Exception:
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.5/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/srv/homeassistant/lib/python3.5/site-packages/pip/commands/install.py", line 360, in run
prefix=options.prefix_path,
File "/srv/homeassistant/lib/python3.5/site-packages/pip/req/req_set.py", line 784, in install
**kwargs
File "/srv/homeassistant/lib/python3.5/site-packages/pip/req/req_install.py", line 851, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "/srv/homeassistant/lib/python3.5/site-packages/pip/req/req_install.py", line 1064, in move_wheel_files
isolated=self.isolated,
File "/srv/homeassistant/lib/python3.5/site-packages/pip/wheel.py", line 345, in move_wheel_files
clobber(source, lib_dir, True)
File "/srv/homeassistant/lib/python3.5/site-packages/pip/wheel.py", line 316, in clobber
ensure_dir(destdir)
File "/srv/homeassistant/lib/python3.5/site-packages/pip/utils/init.py", line 83, in ensure_dir
os.makedirs(path)
File "/usr/lib/python3.5/os.py", line 241, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/srv/homeassistant/lib/python3.5/site-packages/enum_compat-0.0.2.dist-info'
ERROR:homeassistant.setup:Not initializing discovery because could not install dependency netdisco==1.2.4
ERROR:homeassistant.setup:Setup failed for discovery: Could not install all requirements.

Please sign in to comment.