Remove 'show all controls' option for Plex (#32391)

This commit is contained in:
Paulus Schoutsen 2020-03-04 14:42:50 -08:00 committed by GitHub
parent 0e436ac80e
commit dd7d8d4792
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 9 additions and 75 deletions

View File

@ -48,12 +48,15 @@ from .const import (
) )
from .server import PlexServer from .server import PlexServer
MEDIA_PLAYER_SCHEMA = vol.Schema( MEDIA_PLAYER_SCHEMA = vol.All(
{ cv.deprecated(CONF_SHOW_ALL_CONTROLS, invalidation_version="0.110"),
vol.Optional(CONF_USE_EPISODE_ART, default=False): cv.boolean, vol.Schema(
vol.Optional(CONF_SHOW_ALL_CONTROLS, default=False): cv.boolean, {
vol.Optional(CONF_IGNORE_NEW_SHARED_USERS, default=False): cv.boolean, vol.Optional(CONF_USE_EPISODE_ART, default=False): cv.boolean,
} vol.Optional(CONF_SHOW_ALL_CONTROLS): cv.boolean,
vol.Optional(CONF_IGNORE_NEW_SHARED_USERS, default=False): cv.boolean,
}
),
) )
SERVER_CONFIG_SCHEMA = vol.Schema( SERVER_CONFIG_SCHEMA = vol.Schema(

View File

@ -25,7 +25,6 @@ from .const import ( # pylint: disable=unused-import
CONF_MONITORED_USERS, CONF_MONITORED_USERS,
CONF_SERVER, CONF_SERVER,
CONF_SERVER_IDENTIFIER, CONF_SERVER_IDENTIFIER,
CONF_SHOW_ALL_CONTROLS,
CONF_USE_EPISODE_ART, CONF_USE_EPISODE_ART,
DEFAULT_VERIFY_SSL, DEFAULT_VERIFY_SSL,
DOMAIN, DOMAIN,
@ -272,9 +271,6 @@ class PlexOptionsFlowHandler(config_entries.OptionsFlow):
self.options[MP_DOMAIN][CONF_USE_EPISODE_ART] = user_input[ self.options[MP_DOMAIN][CONF_USE_EPISODE_ART] = user_input[
CONF_USE_EPISODE_ART CONF_USE_EPISODE_ART
] ]
self.options[MP_DOMAIN][CONF_SHOW_ALL_CONTROLS] = user_input[
CONF_SHOW_ALL_CONTROLS
]
self.options[MP_DOMAIN][CONF_IGNORE_NEW_SHARED_USERS] = user_input[ self.options[MP_DOMAIN][CONF_IGNORE_NEW_SHARED_USERS] = user_input[
CONF_IGNORE_NEW_SHARED_USERS CONF_IGNORE_NEW_SHARED_USERS
] ]
@ -315,10 +311,6 @@ class PlexOptionsFlowHandler(config_entries.OptionsFlow):
CONF_USE_EPISODE_ART, CONF_USE_EPISODE_ART,
default=plex_server.option_use_episode_art, default=plex_server.option_use_episode_art,
): bool, ): bool,
vol.Required(
CONF_SHOW_ALL_CONTROLS,
default=plex_server.option_show_all_controls,
): bool,
vol.Optional( vol.Optional(
CONF_MONITORED_USERS, default=default_accounts CONF_MONITORED_USERS, default=default_accounts
): cv.multi_select(available_accounts), ): cv.multi_select(available_accounts),

View File

@ -17,7 +17,6 @@ from homeassistant.components.media_player.const import (
SUPPORT_PLAY_MEDIA, SUPPORT_PLAY_MEDIA,
SUPPORT_PREVIOUS_TRACK, SUPPORT_PREVIOUS_TRACK,
SUPPORT_STOP, SUPPORT_STOP,
SUPPORT_TURN_OFF,
SUPPORT_VOLUME_MUTE, SUPPORT_VOLUME_MUTE,
SUPPORT_VOLUME_SET, SUPPORT_VOLUME_SET,
) )
@ -481,46 +480,6 @@ class PlexMediaPlayer(MediaPlayerDevice):
@property @property
def supported_features(self): def supported_features(self):
"""Flag media player features that are supported.""" """Flag media player features that are supported."""
# force show all controls
if self.plex_server.option_show_all_controls:
return (
SUPPORT_PAUSE
| SUPPORT_PREVIOUS_TRACK
| SUPPORT_NEXT_TRACK
| SUPPORT_STOP
| SUPPORT_VOLUME_SET
| SUPPORT_PLAY
| SUPPORT_PLAY_MEDIA
| SUPPORT_TURN_OFF
| SUPPORT_VOLUME_MUTE
)
# no mute support
if self.make.lower() == "shield android tv":
_LOGGER.debug(
"Shield Android TV client detected, disabling mute controls: %s",
self.name,
)
return (
SUPPORT_PAUSE
| SUPPORT_PREVIOUS_TRACK
| SUPPORT_NEXT_TRACK
| SUPPORT_STOP
| SUPPORT_VOLUME_SET
| SUPPORT_PLAY
| SUPPORT_PLAY_MEDIA
| SUPPORT_TURN_OFF
)
# Only supports play,pause,stop (and off which really is stop)
if self.make.lower().startswith("tivo"):
_LOGGER.debug(
"Tivo client detected, only enabling pause, play, "
"stop, and off controls: %s",
self.name,
)
return SUPPORT_PAUSE | SUPPORT_PLAY | SUPPORT_STOP | SUPPORT_TURN_OFF
if self.device and "playback" in self._device_protocol_capabilities: if self.device and "playback" in self._device_protocol_capabilities:
return ( return (
SUPPORT_PAUSE SUPPORT_PAUSE
@ -530,7 +489,6 @@ class PlexMediaPlayer(MediaPlayerDevice):
| SUPPORT_VOLUME_SET | SUPPORT_VOLUME_SET
| SUPPORT_PLAY | SUPPORT_PLAY
| SUPPORT_PLAY_MEDIA | SUPPORT_PLAY_MEDIA
| SUPPORT_TURN_OFF
| SUPPORT_VOLUME_MUTE | SUPPORT_VOLUME_MUTE
) )
@ -594,11 +552,6 @@ class PlexMediaPlayer(MediaPlayerDevice):
self.device.stop(self._active_media_plexapi_type) self.device.stop(self._active_media_plexapi_type)
self.plex_server.update_platforms() self.plex_server.update_platforms()
def turn_off(self):
"""Turn the client off."""
# Fake it since we can't turn the client off
self.media_stop()
def media_next_track(self): def media_next_track(self):
"""Send next track command.""" """Send next track command."""
if self.device and "playback" in self._device_protocol_capabilities: if self.device and "playback" in self._device_protocol_capabilities:

View File

@ -16,7 +16,6 @@ from .const import (
CONF_IGNORE_NEW_SHARED_USERS, CONF_IGNORE_NEW_SHARED_USERS,
CONF_MONITORED_USERS, CONF_MONITORED_USERS,
CONF_SERVER, CONF_SERVER,
CONF_SHOW_ALL_CONTROLS,
CONF_USE_EPISODE_ART, CONF_USE_EPISODE_ART,
DEFAULT_VERIFY_SSL, DEFAULT_VERIFY_SSL,
PLEX_NEW_MP_SIGNAL, PLEX_NEW_MP_SIGNAL,
@ -264,11 +263,6 @@ class PlexServer:
"""Return use_episode_art option.""" """Return use_episode_art option."""
return self.options[MP_DOMAIN][CONF_USE_EPISODE_ART] return self.options[MP_DOMAIN][CONF_USE_EPISODE_ART]
@property
def option_show_all_controls(self):
"""Return show_all_controls option."""
return self.options[MP_DOMAIN][CONF_SHOW_ALL_CONTROLS]
@property @property
def option_monitored_users(self): def option_monitored_users(self):
"""Return dict of monitored users option.""" """Return dict of monitored users option."""

View File

@ -36,7 +36,6 @@
"description": "Options for Plex Media Players", "description": "Options for Plex Media Players",
"data": { "data": {
"use_episode_art": "Use episode art", "use_episode_art": "Use episode art",
"show_all_controls": "Show all controls",
"ignore_new_shared_users": "Ignore new managed/shared users", "ignore_new_shared_users": "Ignore new managed/shared users",
"monitored_users": "Monitored users" "monitored_users": "Monitored users"
} }

View File

@ -26,7 +26,6 @@ MOCK_FILE_CONTENTS = {
DEFAULT_OPTIONS = { DEFAULT_OPTIONS = {
config_flow.MP_DOMAIN: { config_flow.MP_DOMAIN: {
config_flow.CONF_USE_EPISODE_ART: False, config_flow.CONF_USE_EPISODE_ART: False,
config_flow.CONF_SHOW_ALL_CONTROLS: False,
config_flow.CONF_IGNORE_NEW_SHARED_USERS: False, config_flow.CONF_IGNORE_NEW_SHARED_USERS: False,
} }
} }
@ -485,7 +484,6 @@ async def test_option_flow(hass):
result["flow_id"], result["flow_id"],
user_input={ user_input={
config_flow.CONF_USE_EPISODE_ART: True, config_flow.CONF_USE_EPISODE_ART: True,
config_flow.CONF_SHOW_ALL_CONTROLS: True,
config_flow.CONF_IGNORE_NEW_SHARED_USERS: True, config_flow.CONF_IGNORE_NEW_SHARED_USERS: True,
config_flow.CONF_MONITORED_USERS: list(mock_plex_server.accounts), config_flow.CONF_MONITORED_USERS: list(mock_plex_server.accounts),
}, },
@ -494,7 +492,6 @@ async def test_option_flow(hass):
assert result["data"] == { assert result["data"] == {
config_flow.MP_DOMAIN: { config_flow.MP_DOMAIN: {
config_flow.CONF_USE_EPISODE_ART: True, config_flow.CONF_USE_EPISODE_ART: True,
config_flow.CONF_SHOW_ALL_CONTROLS: True,
config_flow.CONF_IGNORE_NEW_SHARED_USERS: True, config_flow.CONF_IGNORE_NEW_SHARED_USERS: True,
config_flow.CONF_MONITORED_USERS: { config_flow.CONF_MONITORED_USERS: {
user: {"enabled": True} for user in mock_plex_server.accounts user: {"enabled": True} for user in mock_plex_server.accounts
@ -530,7 +527,6 @@ async def test_option_flow_loading_saved_users(hass):
result["flow_id"], result["flow_id"],
user_input={ user_input={
config_flow.CONF_USE_EPISODE_ART: True, config_flow.CONF_USE_EPISODE_ART: True,
config_flow.CONF_SHOW_ALL_CONTROLS: True,
config_flow.CONF_IGNORE_NEW_SHARED_USERS: True, config_flow.CONF_IGNORE_NEW_SHARED_USERS: True,
config_flow.CONF_MONITORED_USERS: list(mock_plex_server.accounts), config_flow.CONF_MONITORED_USERS: list(mock_plex_server.accounts),
}, },
@ -539,7 +535,6 @@ async def test_option_flow_loading_saved_users(hass):
assert result["data"] == { assert result["data"] == {
config_flow.MP_DOMAIN: { config_flow.MP_DOMAIN: {
config_flow.CONF_USE_EPISODE_ART: True, config_flow.CONF_USE_EPISODE_ART: True,
config_flow.CONF_SHOW_ALL_CONTROLS: True,
config_flow.CONF_IGNORE_NEW_SHARED_USERS: True, config_flow.CONF_IGNORE_NEW_SHARED_USERS: True,
config_flow.CONF_MONITORED_USERS: { config_flow.CONF_MONITORED_USERS: {
user: {"enabled": True} for user in mock_plex_server.accounts user: {"enabled": True} for user in mock_plex_server.accounts
@ -580,7 +575,6 @@ async def test_option_flow_new_users_available(hass):
result["flow_id"], result["flow_id"],
user_input={ user_input={
config_flow.CONF_USE_EPISODE_ART: True, config_flow.CONF_USE_EPISODE_ART: True,
config_flow.CONF_SHOW_ALL_CONTROLS: True,
config_flow.CONF_IGNORE_NEW_SHARED_USERS: True, config_flow.CONF_IGNORE_NEW_SHARED_USERS: True,
config_flow.CONF_MONITORED_USERS: list(mock_plex_server.accounts), config_flow.CONF_MONITORED_USERS: list(mock_plex_server.accounts),
}, },
@ -589,7 +583,6 @@ async def test_option_flow_new_users_available(hass):
assert result["data"] == { assert result["data"] == {
config_flow.MP_DOMAIN: { config_flow.MP_DOMAIN: {
config_flow.CONF_USE_EPISODE_ART: True, config_flow.CONF_USE_EPISODE_ART: True,
config_flow.CONF_SHOW_ALL_CONTROLS: True,
config_flow.CONF_IGNORE_NEW_SHARED_USERS: True, config_flow.CONF_IGNORE_NEW_SHARED_USERS: True,
config_flow.CONF_MONITORED_USERS: { config_flow.CONF_MONITORED_USERS: {
user: {"enabled": True} for user in mock_plex_server.accounts user: {"enabled": True} for user in mock_plex_server.accounts