mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 22:27:07 +00:00
Fix Cast media player support
This commit is contained in:
parent
452b082c82
commit
90919a66d9
@ -34,16 +34,17 @@ YOUTUBE_PLAYER_SUPPORT = \
|
|||||||
|
|
||||||
MUSIC_PLAYER_SUPPORT = \
|
MUSIC_PLAYER_SUPPORT = \
|
||||||
SUPPORT_PAUSE | SUPPORT_VOLUME_SET | SUPPORT_VOLUME_MUTE | \
|
SUPPORT_PAUSE | SUPPORT_VOLUME_SET | SUPPORT_VOLUME_MUTE | \
|
||||||
SUPPORT_TURN_ON | SUPPORT_TURN_OFF | SUPPORT_PREVIOUS_TRACK | \
|
SUPPORT_TURN_ON | SUPPORT_TURN_OFF
|
||||||
SUPPORT_NEXT_TRACK
|
|
||||||
|
|
||||||
NETFLIX_PLAYER_SUPPORT = \
|
NETFLIX_PLAYER_SUPPORT = \
|
||||||
SUPPORT_PAUSE | SUPPORT_TURN_ON | SUPPORT_TURN_OFF | \
|
SUPPORT_PAUSE | SUPPORT_TURN_ON | SUPPORT_TURN_OFF
|
||||||
SUPPORT_PREVIOUS_TRACK | SUPPORT_NEXT_TRACK
|
|
||||||
|
|
||||||
|
|
||||||
class AbstractDemoPlayer(MediaPlayerDevice):
|
class AbstractDemoPlayer(MediaPlayerDevice):
|
||||||
""" Base class for demo media players. """
|
""" Base class for demo media players. """
|
||||||
|
# We only implement the methods that we support
|
||||||
|
# pylint: disable=abstract-method
|
||||||
|
|
||||||
def __init__(self, name):
|
def __init__(self, name):
|
||||||
self._name = name
|
self._name = name
|
||||||
self._player_state = STATE_PLAYING
|
self._player_state = STATE_PLAYING
|
||||||
@ -181,7 +182,8 @@ class DemoMusicPlayer(AbstractDemoPlayer):
|
|||||||
('Diss Reaction', 'Jiiieehaaaa '),
|
('Diss Reaction', 'Jiiieehaaaa '),
|
||||||
('Flamman And Abraxas', 'Good To Go (Radio Mix)'),
|
('Flamman And Abraxas', 'Good To Go (Radio Mix)'),
|
||||||
('Critical Mass', 'Dancing Together'),
|
('Critical Mass', 'Dancing Together'),
|
||||||
('Charly Lownoise & Mental Theo', 'Ultimate Sex Track (Bass-D & King Matthew Remix)'),
|
('Charly Lownoise & Mental Theo',
|
||||||
|
'Ultimate Sex Track (Bass-D & King Matthew Remix)'),
|
||||||
]
|
]
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@ -221,6 +223,7 @@ class DemoMusicPlayer(AbstractDemoPlayer):
|
|||||||
@property
|
@property
|
||||||
def media_album(self):
|
def media_album(self):
|
||||||
""" Album of current playing media. (Music track only) """
|
""" Album of current playing media. (Music track only) """
|
||||||
|
# pylint: disable=no-self-use
|
||||||
return "Bounzz"
|
return "Bounzz"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -231,7 +234,15 @@ class DemoMusicPlayer(AbstractDemoPlayer):
|
|||||||
@property
|
@property
|
||||||
def supported_media_commands(self):
|
def supported_media_commands(self):
|
||||||
""" Flags of media commands that are supported. """
|
""" Flags of media commands that are supported. """
|
||||||
return MUSIC_PLAYER_SUPPORT
|
support = MUSIC_PLAYER_SUPPORT
|
||||||
|
|
||||||
|
if self._cur_track > 1:
|
||||||
|
support |= SUPPORT_PREVIOUS_TRACK
|
||||||
|
|
||||||
|
if self._cur_track < len(self.tracks)-1:
|
||||||
|
support |= SUPPORT_NEXT_TRACK
|
||||||
|
|
||||||
|
return support
|
||||||
|
|
||||||
def media_previous_track(self):
|
def media_previous_track(self):
|
||||||
""" Send previous track command. """
|
""" Send previous track command. """
|
||||||
@ -304,7 +315,15 @@ class DemoTVShowPlayer(AbstractDemoPlayer):
|
|||||||
@property
|
@property
|
||||||
def supported_media_commands(self):
|
def supported_media_commands(self):
|
||||||
""" Flags of media commands that are supported. """
|
""" Flags of media commands that are supported. """
|
||||||
return NETFLIX_PLAYER_SUPPORT
|
support = NETFLIX_PLAYER_SUPPORT
|
||||||
|
|
||||||
|
if self._cur_episode > 1:
|
||||||
|
support |= SUPPORT_PREVIOUS_TRACK
|
||||||
|
|
||||||
|
if self._cur_episode < self._episode_count:
|
||||||
|
support |= SUPPORT_NEXT_TRACK
|
||||||
|
|
||||||
|
return support
|
||||||
|
|
||||||
def media_previous_track(self):
|
def media_previous_track(self):
|
||||||
""" Send previous track command. """
|
""" Send previous track command. """
|
||||||
|
@ -18,7 +18,7 @@ phue>=0.8
|
|||||||
ledcontroller>=1.0.7
|
ledcontroller>=1.0.7
|
||||||
|
|
||||||
# Chromecast bindings (media_player.cast)
|
# Chromecast bindings (media_player.cast)
|
||||||
pychromecast>=0.6.4
|
pychromecast>=0.6.5
|
||||||
|
|
||||||
# Keyboard (keyboard)
|
# Keyboard (keyboard)
|
||||||
pyuserinput>=0.1.9
|
pyuserinput>=0.1.9
|
||||||
|
Loading…
x
Reference in New Issue
Block a user