Merge branch 'dev' into itunes-play-media
This commit is contained in:
commit
6ab4b80486
4 files changed
+20
-3
No files matched your search
@@ -190,6 +190,16 @@ def media_previous_track(hass, entity_id=None):
|
||||
hass.services.call(DOMAIN, SERVICE_MEDIA_PREVIOUS_TRACK, data)
|
||||
|
||||
|
||||
def play_media(hass, media_type, media_id, entity_id=None):
|
||||
""" Send the media player the command for playing media. """
|
||||
data = {"media_type": media_type, "media_id": media_id}
|
||||
|
||||
if entity_id:
|
||||
data[ATTR_ENTITY_ID] = entity_id
|
||||
|
||||
hass.services.call(DOMAIN, SERVICE_PLAY_MEDIA, data)
|
||||
|
||||
|
||||
def setup(hass, config):
|
||||
""" Track states and offer events for media_players. """
|
||||
component = EntityComponent(
|
||||
@@ -287,8 +297,8 @@ def setup(hass, config):
|
||||
|
||||
def play_media_service(service):
|
||||
""" Plays specified media_id on the media player. """
|
||||
media_type = service.data['media_type']
|
||||
media_id = service.data['media_id']
|
||||
media_type = service.data.get('media_type')
|
||||
media_id = service.data.get('media_id')
|
||||
|
||||
if media_type is None:
|
||||
return
|
||||
|
||||
@@ -90,6 +90,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||
class CastDevice(MediaPlayerDevice):
|
||||
""" Represents a Cast device on the network. """
|
||||
|
||||
# pylint: disable=abstract-method
|
||||
# pylint: disable=too-many-public-methods
|
||||
|
||||
def __init__(self, host):
|
||||
|
||||
Reference in new issue
Block a user