Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions homeassistant/components/plex/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,15 @@
)
from .server import PlexServer

MEDIA_PLAYER_SCHEMA = vol.Schema(
{
vol.Optional(CONF_USE_EPISODE_ART, default=False): cv.boolean,
vol.Optional(CONF_SHOW_ALL_CONTROLS, default=False): cv.boolean,
vol.Optional(CONF_IGNORE_NEW_SHARED_USERS, default=False): cv.boolean,
}
MEDIA_PLAYER_SCHEMA = vol.All(
cv.deprecated(CONF_SHOW_ALL_CONTROLS, invalidation_version="0.110"),
vol.Schema(
{
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(
Expand Down
8 changes: 0 additions & 8 deletions homeassistant/components/plex/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
CONF_MONITORED_USERS,
CONF_SERVER,
CONF_SERVER_IDENTIFIER,
CONF_SHOW_ALL_CONTROLS,
CONF_USE_EPISODE_ART,
DEFAULT_VERIFY_SSL,
DOMAIN,
Expand Down Expand Up @@ -272,9 +271,6 @@ async def async_step_plex_mp_settings(self, user_input=None):
self.options[MP_DOMAIN][CONF_USE_EPISODE_ART] = user_input[
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[
CONF_IGNORE_NEW_SHARED_USERS
]
Expand Down Expand Up @@ -315,10 +311,6 @@ async def async_step_plex_mp_settings(self, user_input=None):
CONF_USE_EPISODE_ART,
default=plex_server.option_use_episode_art,
): bool,
vol.Required(
CONF_SHOW_ALL_CONTROLS,
default=plex_server.option_show_all_controls,
): bool,
vol.Optional(
CONF_MONITORED_USERS, default=default_accounts
): cv.multi_select(available_accounts),
Expand Down
47 changes: 0 additions & 47 deletions homeassistant/components/plex/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
SUPPORT_PLAY_MEDIA,
SUPPORT_PREVIOUS_TRACK,
SUPPORT_STOP,
SUPPORT_TURN_OFF,
SUPPORT_VOLUME_MUTE,
SUPPORT_VOLUME_SET,
)
Expand Down Expand Up @@ -481,46 +480,6 @@ def make(self):
@property
def supported_features(self):
"""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:
return (
SUPPORT_PAUSE
Expand All @@ -530,7 +489,6 @@ def supported_features(self):
| SUPPORT_VOLUME_SET
| SUPPORT_PLAY
| SUPPORT_PLAY_MEDIA
| SUPPORT_TURN_OFF
| SUPPORT_VOLUME_MUTE
)

Expand Down Expand Up @@ -594,11 +552,6 @@ def media_stop(self):
self.device.stop(self._active_media_plexapi_type)
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):
"""Send next track command."""
if self.device and "playback" in self._device_protocol_capabilities:
Expand Down
6 changes: 0 additions & 6 deletions homeassistant/components/plex/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
CONF_IGNORE_NEW_SHARED_USERS,
CONF_MONITORED_USERS,
CONF_SERVER,
CONF_SHOW_ALL_CONTROLS,
CONF_USE_EPISODE_ART,
DEFAULT_VERIFY_SSL,
PLEX_NEW_MP_SIGNAL,
Expand Down Expand Up @@ -264,11 +263,6 @@ def option_use_episode_art(self):
"""Return use_episode_art option."""
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
def option_monitored_users(self):
"""Return dict of monitored users option."""
Expand Down
1 change: 0 additions & 1 deletion homeassistant/components/plex/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
"description": "Options for Plex Media Players",
"data": {
"use_episode_art": "Use episode art",
"show_all_controls": "Show all controls",
"ignore_new_shared_users": "Ignore new managed/shared users",
"monitored_users": "Monitored users"
}
Expand Down
7 changes: 0 additions & 7 deletions tests/components/plex/test_config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
DEFAULT_OPTIONS = {
config_flow.MP_DOMAIN: {
config_flow.CONF_USE_EPISODE_ART: False,
config_flow.CONF_SHOW_ALL_CONTROLS: False,
config_flow.CONF_IGNORE_NEW_SHARED_USERS: False,
}
}
Expand Down Expand Up @@ -485,7 +484,6 @@ async def test_option_flow(hass):
result["flow_id"],
user_input={
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_MONITORED_USERS: list(mock_plex_server.accounts),
},
Expand All @@ -494,7 +492,6 @@ async def test_option_flow(hass):
assert result["data"] == {
config_flow.MP_DOMAIN: {
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_MONITORED_USERS: {
user: {"enabled": True} for user in mock_plex_server.accounts
Expand Down Expand Up @@ -530,7 +527,6 @@ async def test_option_flow_loading_saved_users(hass):
result["flow_id"],
user_input={
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_MONITORED_USERS: list(mock_plex_server.accounts),
},
Expand All @@ -539,7 +535,6 @@ async def test_option_flow_loading_saved_users(hass):
assert result["data"] == {
config_flow.MP_DOMAIN: {
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_MONITORED_USERS: {
user: {"enabled": True} for user in mock_plex_server.accounts
Expand Down Expand Up @@ -580,7 +575,6 @@ async def test_option_flow_new_users_available(hass):
result["flow_id"],
user_input={
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_MONITORED_USERS: list(mock_plex_server.accounts),
},
Expand All @@ -589,7 +583,6 @@ async def test_option_flow_new_users_available(hass):
assert result["data"] == {
config_flow.MP_DOMAIN: {
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_MONITORED_USERS: {
user: {"enabled": True} for user in mock_plex_server.accounts
Expand Down