Denon improvements (#5251)

* denonavr: Expose input as title when in non playing modes

Signed-off-by: Anton Lundin <glance@acc.umu.se>

* denon: Pop from the intended end of the list

Pop from front of list, so we start with NSE0, then NSE1X and so on.

Signed-off-by: Anton Lundin <glance@acc.umu.se>

* denonavr: Don't provide broken media_url's

Only return a media_url if we're in a state that might provide one.

Signed-off-by: Anton Lundin <glance@acc.umu.se>

* denonavr: Only expose player support when in a player mode

This changes so the denonavr only exposes the media player support, when
in a mode that supports media playing.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
This commit is contained in:
Anton Lundin 2017-01-17 08:04:50 +01:00 committed by Paulus Schoutsen
parent 784b87eb2f
commit fd5c2ad08f
3 changed files with 14 additions and 7 deletions

View File

@ -150,7 +150,7 @@ class DenonDevice(MediaPlayerDevice):
answer_codes = ["NSE0", "NSE1X", "NSE2X", "NSE3X", "NSE4", "NSE5",
"NSE6", "NSE7", "NSE8"]
for line in self.telnet_request(telnet, 'NSE', all_lines=True):
self._mediainfo += line[len(answer_codes.pop()):] + '\n'
self._mediainfo += line[len(answer_codes.pop(0)):] + '\n'
else:
self._mediainfo = self.source

View File

@ -19,7 +19,7 @@ from homeassistant.const import (
CONF_NAME, STATE_ON)
import homeassistant.helpers.config_validation as cv
REQUIREMENTS = ['denonavr==0.3.0']
REQUIREMENTS = ['denonavr==0.3.1']
_LOGGER = logging.getLogger(__name__)
@ -28,7 +28,9 @@ KEY_DENON_CACHE = 'denonavr_hosts'
SUPPORT_DENON = SUPPORT_VOLUME_STEP | SUPPORT_VOLUME_MUTE | \
SUPPORT_TURN_ON | SUPPORT_TURN_OFF | \
SUPPORT_SELECT_SOURCE | SUPPORT_PLAY_MEDIA | \
SUPPORT_SELECT_SOURCE | SUPPORT_VOLUME_SET
SUPPORT_MEDIA_MODES = SUPPORT_PLAY_MEDIA | \
SUPPORT_PAUSE | SUPPORT_PREVIOUS_TRACK | \
SUPPORT_NEXT_TRACK | SUPPORT_VOLUME_SET | SUPPORT_PLAY
@ -167,7 +169,10 @@ class DenonDevice(MediaPlayerDevice):
@property
def supported_media_commands(self):
"""Flag of media commands that are supported."""
return SUPPORT_DENON
if self._current_source in self._receiver.netaudio_func_list:
return SUPPORT_DENON | SUPPORT_MEDIA_MODES
else:
return SUPPORT_DENON
@property
def media_content_id(self):
@ -190,7 +195,7 @@ class DenonDevice(MediaPlayerDevice):
@property
def media_image_url(self):
"""Image url of current playing media."""
if self._power == "ON":
if self._current_source in self._receiver.playing_func_list:
return self._media_image_url
else:
return None
@ -198,7 +203,9 @@ class DenonDevice(MediaPlayerDevice):
@property
def media_title(self):
"""Title of current playing media."""
if self._title is not None:
if self._current_source not in self._receiver.playing_func_list:
return self._current_source
elif self._title is not None:
return self._title
else:
return self._frequency

View File

@ -82,7 +82,7 @@ colorlog>2.1,<3
concord232==0.14
# homeassistant.components.media_player.denonavr
denonavr==0.3.0
denonavr==0.3.1
# homeassistant.components.media_player.directv
directpy==0.1