Remove turn_on and turn_off feature for clients (#18234)
* Enhancements for DirecTV media player
Following enhancements have been made:
1. Added debug logging
2. Added ability to change channel using select_source service of the remote platform.
3. State will now show paused if a recorded program is paused, for live TV playing will always be returned.
4. Added the following attributes:
a. media_position: current position of the media (in seconds)
b. media_position_updated_at: timestamp when media_position was updated.
c. source: current source (channel).
d. media_isbeingrecorded: if current media is being recorded or not.
e. media_rating: TV/Movie rating of the media
f. media_recorded: if current media is recorded or live TV
g. media_starttime: Timestamp media was aired
Reordered properties to follow same order as how they are in __init__.py of remote platform.
* Fixed error and cleaned up few items
Fixed an issue when determining if a program is recorded or not.
Cleaned up some coding.
* Added available property
Added available property
* Disable feature TURN_ON and TURN_OFF for DVR clients
Disable the feature turn_on and turn_off for DVR clients.
* self._is_client and raise NotImplementedError
Updated setting self._is_client
Raise NotImplementedError if turn_on or turn_off is called for clients.
This commit is contained in:
committed by
Paulus Schoutsen
parent
83b4e56978
commit
cdcc818bf9
@@ -36,6 +36,10 @@ SUPPORT_DTV = SUPPORT_PAUSE | SUPPORT_TURN_ON | SUPPORT_TURN_OFF | \
|
||||
SUPPORT_PLAY_MEDIA | SUPPORT_SELECT_SOURCE | SUPPORT_STOP | \
|
||||
SUPPORT_NEXT_TRACK | SUPPORT_PREVIOUS_TRACK | SUPPORT_PLAY
|
||||
|
||||
SUPPORT_DTV_CLIENT = SUPPORT_PAUSE | \
|
||||
SUPPORT_PLAY_MEDIA | SUPPORT_SELECT_SOURCE | SUPPORT_STOP | \
|
||||
SUPPORT_NEXT_TRACK | SUPPORT_PREVIOUS_TRACK | SUPPORT_PLAY
|
||||
|
||||
DATA_DIRECTV = 'data_directv'
|
||||
|
||||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
||||
@@ -126,10 +130,15 @@ class DirecTvDevice(MediaPlayerDevice):
|
||||
self._paused = None
|
||||
self._last_position = None
|
||||
self._is_recorded = None
|
||||
self._is_client = device != '0'
|
||||
self._assumed_state = None
|
||||
self._available = False
|
||||
|
||||
_LOGGER.debug("Created DirecTV device for %s", self._name)
|
||||
if self._is_client:
|
||||
_LOGGER.debug("Created DirecTV client %s for device %s",
|
||||
self._name, device)
|
||||
else:
|
||||
_LOGGER.debug("Created DirecTV device for %s", self._name)
|
||||
|
||||
def update(self):
|
||||
"""Retrieve latest state."""
|
||||
@@ -290,7 +299,7 @@ class DirecTvDevice(MediaPlayerDevice):
|
||||
@property
|
||||
def supported_features(self):
|
||||
"""Flag media player features that are supported."""
|
||||
return SUPPORT_DTV
|
||||
return SUPPORT_DTV_CLIENT if self._is_client else SUPPORT_DTV
|
||||
|
||||
@property
|
||||
def media_currently_recording(self):
|
||||
@@ -327,11 +336,17 @@ class DirecTvDevice(MediaPlayerDevice):
|
||||
|
||||
def turn_on(self):
|
||||
"""Turn on the receiver."""
|
||||
if self._is_client:
|
||||
raise NotImplementedError()
|
||||
|
||||
_LOGGER.debug("Turn on %s", self._name)
|
||||
self.dtv.key_press('poweron')
|
||||
|
||||
def turn_off(self):
|
||||
"""Turn off the receiver."""
|
||||
if self._is_client:
|
||||
raise NotImplementedError()
|
||||
|
||||
_LOGGER.debug("Turn off %s", self._name)
|
||||
self.dtv.key_press('poweroff')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user