Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
718: 'No such destination resource',
719: 'Destination resource access denied',
720: 'Cannot process the request',
})
class MS_ConnectionManager(Service): # pylint: disable=invalid-name
""" UPnP standard connection manager service for the media server."""
def __init__(self, soco):
super(MS_ConnectionManager, self).__init__(soco)
self.service_type = "ConnectionManager"
self.control_url = "/MediaServer/ConnectionManager/Control"
self.event_subscription_url = "/MediaServer/ConnectionManager/Event"
class RenderingControl(Service):
""" UPnP standard redering control service, for functions relating to
playback rendering, eg bass, treble, volume and EQ. """
def __init__(self, soco):
super(RenderingControl, self).__init__(soco)
self.control_url = "/MediaRenderer/RenderingControl/Control"
self.event_subscription_url = "/MediaRenderer/RenderingControl/Event"
class MR_ConnectionManager(Service): # pylint: disable=invalid-name
""" UPnP standard connection manager service for the media renderer."""
def __init__(self, soco):
super(MR_ConnectionManager, self).__init__(soco)
self.service_type = "ConnectionManager"
self.control_url = "/MediaRenderer/ConnectionManager/Control"
self.event_subscription_url = "/MediaRenderer/ConnectionManager/Event"
737: 'No DNS Server',
738: 'Bad Domain Name',
739: 'Server Error',
})
class Queue(Service):
""" Sonos queue service, for functions relating to queue management, saving
queues etc. """
def __init__(self, soco):
super(Queue, self).__init__(soco)
self.control_url = "/MediaRenderer/Queue/Control"
self.event_subscription_url = "/MediaRenderer/Queue/Event"
class GroupRenderingControl(Service):
""" Sonos group rendering control service, for functions relating to
group volume etc. """
def __init__(self, soco):
super(GroupRenderingControl, self).__init__(soco)
self.control_url = "/MediaRenderer/GroupRenderingControl/Control"
self.event_subscription_url = \
"/MediaRenderer/GroupRenderingControl/Event"
for state in statevars:
# We are only interested if 'sendEvents' is 'yes', i.e this
# is an eventable variable
if state.attrib['sendEvents'] == "yes":
name = state.findtext('{}name'.format(ns))
vartype = state.findtext('{}dataType'.format(ns))
yield (name, vartype)
class AlarmClock(Service):
""" Sonos alarm service, for setting and getting time and alarms. """
def __init__(self, soco):
super(AlarmClock, self).__init__(soco)
class MusicServices(Service):
""" Sonos music services service, for functions related to 3rd party
music services. """
def __init__(self, soco):
super(MusicServices, self).__init__(soco)
class DeviceProperties(Service):
""" Sonos device properties service, for functions relating to zones,
LED state, stereo pairs etc. """
def __init__(self, soco):
super(DeviceProperties, self).__init__(soco)
class SystemProperties(Service):
""" Sonos system properties service, for functions relating to
authentication etc """
return self.send_command('GetZoneGroupState', *args, **kwargs)
class GroupManagement(Service):
""" Sonos group management service, for services relating to groups. """
def __init__(self, soco):
super(GroupManagement, self).__init__(soco)
class QPlay(Service):
""" Sonos Tencent QPlay service (a Chinese music service) """
def __init__(self, soco):
super(QPlay, self).__init__(soco)
class ContentDirectory(Service):
""" UPnP standard Content Directory service, for functions relating to
browsing, searching and listing available music. """
def __init__(self, soco):
super(ContentDirectory, self).__init__(soco)
self.control_url = "/MediaServer/ContentDirectory/Control"
self.event_subscription_url = "/MediaServer/ContentDirectory/Event"
# For error codes, see table 2.7.16 in
# http://upnp.org/specs/av/UPnP-av-ContentDirectory-v1-Service.pdf
self.UPNP_ERRORS.update({
701: 'No such object',
702: 'Invalid CurrentTagValue',
703: 'Invalid NewTagValue',
704: 'Required tag',
705: 'Read only tag',
706: 'Parameter Mismatch',
708: 'Unsupported or invalid search criteria',
709: 'Unsupported or invalid sort criteria',
710: 'No such container',
711: 'Restricted object',
712: 'Bad metadata',
713: 'Restricted parent object',
714: 'No such source resource',
715: 'Resource access denied',
716: 'Transfer busy',
717: 'No such file transfer',
718: 'No such destination resource',
719: 'Destination resource access denied',
720: 'Cannot process the request',
})
class MS_ConnectionManager(Service): # pylint: disable=invalid-name
""" UPnP standard connection manager service for the media server."""
def __init__(self, soco):
super(MS_ConnectionManager, self).__init__(soco)
self.service_type = "ConnectionManager"
self.control_url = "/MediaServer/ConnectionManager/Control"
self.event_subscription_url = "/MediaServer/ConnectionManager/Event"
class RenderingControl(Service):
""" UPnP standard redering control service, for functions relating to
playback rendering, eg bass, treble, volume and EQ. """
def __init__(self, soco):
super(RenderingControl, self).__init__(soco)
self.control_url = "/MediaRenderer/RenderingControl/Control"
self.event_subscription_url = "/MediaRenderer/RenderingControl/Event"
710: 'Seek mode not supported',
711: 'Illegal seek target',
712: 'Play mode not supported',
713: 'Record quality not supported',
714: 'Illegal MIME-Type',
715: 'Content "BUSY"',
716: 'Resource Not found',
717: 'Play speed not supported',
718: 'Invalid InstanceID',
737: 'No DNS Server',
738: 'Bad Domain Name',
739: 'Server Error',
})
class Queue(Service):
""" Sonos queue service, for functions relating to queue management, saving
queues etc. """
def __init__(self, soco):
super(Queue, self).__init__(soco)
self.control_url = "/MediaRenderer/Queue/Control"
self.event_subscription_url = "/MediaRenderer/Queue/Event"
class GroupRenderingControl(Service):
""" Sonos group rendering control service, for functions relating to
group volume etc. """
def __init__(self, soco):
super(GroupRenderingControl, self).__init__(soco)
self.control_url = "/MediaRenderer/GroupRenderingControl/Control"
self.event_subscription_url = \
"/MediaRenderer/GroupRenderingControl/Event"
def __init__(self, soco):
super(RenderingControl, self).__init__(soco)
self.control_url = "/MediaRenderer/RenderingControl/Control"
self.event_subscription_url = "/MediaRenderer/RenderingControl/Event"
class MR_ConnectionManager(Service): # pylint: disable=invalid-name
""" UPnP standard connection manager service for the media renderer."""
def __init__(self, soco):
super(MR_ConnectionManager, self).__init__(soco)
self.service_type = "ConnectionManager"
self.control_url = "/MediaRenderer/ConnectionManager/Control"
self.event_subscription_url = "/MediaRenderer/ConnectionManager/Event"
class AVTransport(Service):
""" UPnP standard AV Transport service, for functions relating to
transport management, eg play, stop, seek, playlists etc. """
def __init__(self, soco):
super(AVTransport, self).__init__(soco)
self.control_url = "/MediaRenderer/AVTransport/Control"
self.event_subscription_url = "/MediaRenderer/AVTransport/Event"
# For error codes, see
# http://upnp.org/specs/av/UPnP-av-AVTransport-v1-Service.pdf
self.UPNP_ERRORS.update({
701: 'Transition not available',
702: 'No contents',
703: 'Read error',
704: 'Format not supported for playback',
705: 'Transport is locked',
706: 'Write error',
707: 'Media is protected or not writeable',
super(MS_ConnectionManager, self).__init__(soco)
self.service_type = "ConnectionManager"
self.control_url = "/MediaServer/ConnectionManager/Control"
self.event_subscription_url = "/MediaServer/ConnectionManager/Event"
class RenderingControl(Service):
""" UPnP standard redering control service, for functions relating to
playback rendering, eg bass, treble, volume and EQ. """
def __init__(self, soco):
super(RenderingControl, self).__init__(soco)
self.control_url = "/MediaRenderer/RenderingControl/Control"
self.event_subscription_url = "/MediaRenderer/RenderingControl/Event"
class MR_ConnectionManager(Service): # pylint: disable=invalid-name
""" UPnP standard connection manager service for the media renderer."""
def __init__(self, soco):
super(MR_ConnectionManager, self).__init__(soco)
self.service_type = "ConnectionManager"
self.control_url = "/MediaRenderer/ConnectionManager/Control"
self.event_subscription_url = "/MediaRenderer/ConnectionManager/Event"
class AVTransport(Service):
""" UPnP standard AV Transport service, for functions relating to
transport management, eg play, stop, seek, playlists etc. """
def __init__(self, soco):
super(AVTransport, self).__init__(soco)
self.control_url = "/MediaRenderer/AVTransport/Control"
self.event_subscription_url = "/MediaRenderer/AVTransport/Event"
# For error codes, see
class MusicServices(Service):
""" Sonos music services service, for functions related to 3rd party
music services. """
def __init__(self, soco):
super(MusicServices, self).__init__(soco)
class DeviceProperties(Service):
""" Sonos device properties service, for functions relating to zones,
LED state, stereo pairs etc. """
def __init__(self, soco):
super(DeviceProperties, self).__init__(soco)
class SystemProperties(Service):
""" Sonos system properties service, for functions relating to
authentication etc """
def __init__(self, soco):
super(SystemProperties, self).__init__(soco)
class ZoneGroupTopology(Service):
""" Sonos zone group topology service, for functions relating to network
topology, diagnostics and updates. """
def __init__(self, soco):
super(ZoneGroupTopology, self).__init__(soco)
def GetZoneGroupState(self, *args, **kwargs):
""" Overrides default handling to use the global shared zone group
state cache, unless another cache is speciified """
kwargs['cache'] = kwargs.get('cache', zone_group_state_shared_cache)
class ZoneGroupTopology(Service):
""" Sonos zone group topology service, for functions relating to network
topology, diagnostics and updates. """
def __init__(self, soco):
super(ZoneGroupTopology, self).__init__(soco)
def GetZoneGroupState(self, *args, **kwargs):
""" Overrides default handling to use the global shared zone group
state cache, unless another cache is speciified """
kwargs['cache'] = kwargs.get('cache', zone_group_state_shared_cache)
return self.send_command('GetZoneGroupState', *args, **kwargs)
class GroupManagement(Service):
""" Sonos group management service, for services relating to groups. """
def __init__(self, soco):
super(GroupManagement, self).__init__(soco)
class QPlay(Service):
""" Sonos Tencent QPlay service (a Chinese music service) """
def __init__(self, soco):
super(QPlay, self).__init__(soco)
class ContentDirectory(Service):
""" UPnP standard Content Directory service, for functions relating to
browsing, searching and listing available music. """
def __init__(self, soco):
super(ContentDirectory, self).__init__(soco)