platypush/plugins/music/snapcast/__init__.py
def mute(self, client=None, group=None, mute=None, host=None, port=None):
        """
        Set the mute status of a connected client or group

        :param client: Client name or ID to mute
        :type client: str

        :param group: Group ID to mute
        :type group: str

        :param mute: Mute status. If not set, the mute status of the selected
            client/group will be toggled.
        :type mute: bool

        :param host: Snapcast server to query (default: default configured host)
        :type host: str

        :param port: Snapcast server port (default: default configured port)
        :type port: int
        """

        if not client and not group:
            raise RuntimeError('Please specify either a client or a group')

        sock = None

        try:
            sock = self._connect(host or self.host, port or self.port)
            request = {
                'id': self._get_req_id(),
                'jsonrpc': '2.0',
                'method': 'Group.SetMute' if group else 'Client.SetVolume',
                'params': {}
            }

            if group:
                group = self._get_group(sock, group)
                cur_muted = group['muted']
                request['params']['id'] = group['id']
                request['params']['mute'] = not cur_muted if mute is None else mute
            else:
                client = self._get_client(sock, client)
                cur_muted = client['config']['volume']['muted']
                request['params']['id'] = client['id']
                request['params']['volume'] = {}
                request['params']['volume']['percent'] = client['config']['volume']['percent']
                request['params']['volume']['muted'] = not cur_muted if mute is None else mute

            # noinspection PyTypeChecker
            self._send(sock, request)
            return self._recv(sock)
        finally:
            try:
                sock.close()
            except Exception as e:
                self.logger.warning('Error on socket close', e)

        Set the mute status of a connected client or group

        :param client: Client name or ID to mute
        :type client: str

        :param group: Group ID to mute
        :type group: str

        :param mute: Mute status. If not set, the mute status of the selected
            client/group will be toggled.
        :type mute: bool

        :param host: Snapcast server to query (default: default configured host)
        :type host: str

        :param port: Snapcast server port (default: default configured port)
        :type port: int
        
Set the mute status of a connected client or group
Set the mute status of a connected client or group
def mute(self, client=None, group=None, mute=None, host=None, port=None):
        if not client and not group:
            raise RuntimeError('Please specify either a client or a group')
        sock = None
        try:
            sock = self._connect(host or self.host, port or self.port)
            request = {
                'id': self._get_req_id(),
                'jsonrpc': '2.0',
                'method': 'Group.SetMute' if group else 'Client.SetVolume',
                'params': {}
            }
            if group:
                group = self._get_group(sock, group)
                cur_muted = group['muted']
                request['params']['id'] = group['id']
                request['params']['mute'] = not cur_muted if mute is None else mute
            else:
                client = self._get_client(sock, client)
                cur_muted = client['config']['volume']['muted']
                request['params']['id'] = client['id']
                request['params']['volume'] = {}
                request['params']['volume']['percent'] = client['config']['volume']['percent']
                request['params']['volume']['muted'] = not cur_muted if mute is None else mute
            self._send(sock, request)
            return self._recv(sock)
        finally:
            try:
                sock.close()
            except Exception as e:
                self.logger.warning('Error on socket close', e)
def mute ( self , client = None , group = None , mute = None , host = None , port = None ) : if not client and not group : raise RuntimeError ( 'Please specify either a client or a group' ) sock = None try : sock = self . _connect ( host or self . host , port or self . port ) request = { 'id' : self . _get_req_id ( ) , 'jsonrpc' : '2.0' , 'method' : 'Group.SetMute' if group else 'Client.SetVolume' , 'params' : { } } if group : group = self . _get_group ( sock , group ) cur_muted = group [ 'muted' ] request [ 'params' ] [ 'id' ] = group [ 'id' ] request [ 'params' ] [ 'mute' ] = not cur_muted if mute is None else mute else : client = self . _get_client ( sock , client ) cur_muted = client [ 'config' ] [ 'volume' ] [ 'muted' ] request [ 'params' ] [ 'id' ] = client [ 'id' ] request [ 'params' ] [ 'volume' ] = { } request [ 'params' ] [ 'volume' ] [ 'percent' ] = client [ 'config' ] [ 'volume' ] [ 'percent' ] request [ 'params' ] [ 'volume' ] [ 'muted' ] = not cur_muted if mute is None else mute self . _send ( sock , request ) return self . _recv ( sock ) finally : try : sock . close ( ) except Exception as e : self . logger . warning ( 'Error on socket close' , e )
Set the mute status of a connected client or group
Set the mute status of a connected client or group
"""
        Set the mute status of a connected client or group

        :param client: Client name or ID to mute
        :type client: str

        :param group: Group ID to mute
        :type group: str

        :param mute: Mute status. If not set, the mute status of the selected
            client/group will be toggled.
        :type mute: bool

        :param host: Snapcast server to query (default: default configured host)
        :type host: str

        :param port: Snapcast server port (default: default configured port)
        :type port: int
        """ # noinspection PyTypeChecker
self
client
Client name or ID to mute
Client name or ID to mute
group
Group ID to mute
Group ID to mute
mute
Mute status. If not set, the mute status of the selected
client/group will be toggled.
Mute status . If not set the mute status of the selected client / group will be toggled .
host
Snapcast server to query (default: default configured host)
Snapcast server to query ( default : default configured host )
port
Snapcast server port (default: default configured port)
Snapcast server port ( default : default configured port )