platypush/plugins/music/snapcast/__init__.py
def status(self, host=None, port=None, client=None, group=None):
        """
        Get the status either of a Snapcast server, client or group

        :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

        :param client: Client ID or name (default: None)
        :type client: str

        :param group: Group ID or name (default: None)
        :type group: str

        :returns: dict.

        Example::

            "output": {
                "groups": [
                    {
                    "clients": [
                        {
                        "config": {
                            "instance": 1,
                            "latency": 0,
                            "name": "",
                            "volume": {
                            "muted": false,
                            "percent": 96
                            }
                        },
                        "connected": true,
                        "host": {
                            "arch": "x86_64",
                            "ip": "YOUR_IP",
                            "mac": "YOUR_MAC",
                            "name": "YOUR_NAME",
                            "os": "YOUR_OS"
                        },
                        "id": "YOUR_ID",
                        "lastSeen": {
                            "sec": 1546648311,
                            "usec": 86011
                        },
                        "snapclient": {
                            "name": "Snapclient",
                            "protocolVersion": 2,
                            "version": "0.15.0"
                        }
                        }
                    ],
                    "id": "YOUR_ID",
                    "muted": false,
                    "name": "",
                    "stream_id": "mopidy"
                    }
                ],
                "server": {
                    "host": {
                    "arch": "armv7l",
                    "ip": "",
                    "mac": "",
                    "name": "YOUR_NAME",
                    "os": "YOUR_OS"
                    },
                    "snapserver": {
                    "controlProtocolVersion": 1,
                    "name": "Snapserver",
                    "protocolVersion": 1,
                    "version": "0.15.0"
                    }
                },
                "streams": [
                    {
                        "id": "mopidy",
                        "meta": {
                            "STREAM": "mopidy"
                        },
                        "status": "playing",
                        "uri": {
                            "fragment": "",
                            "host": "",
                            "path": "/tmp/snapfifo",
                            "query": {
                            "buffer_ms": "20",
                            "codec": "pcm",
                            "name": "mopidy",
                            "sampleformat": "48000:16:2"
                            },
                            "raw": "pipe:////tmp/snapfifo?buffer_ms=20&codec=pcm&name=mopidy&sampleformat=48000:16:2",
                            "scheme": "pipe"
                        }
                    }
                ]
            }

        """

        sock = None

        try:
            sock = self._connect(host or self.host, port or self.port)
            if client:
                return self._get_client(sock, client)
            if group:
                return self._get_group(sock, group)

            return self._status(sock)
        finally:
            try:
                sock.close()
            except Exception as e:
                self.logger.warning(f'Error on socket close: {e}')

        Get the status either of a Snapcast server, client or group

        :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

        :param client: Client ID or name (default: None)
        :type client: str

        :param group: Group ID or name (default: None)
        :type group: str

        :returns: dict.

        Example::

            "output": {
                "groups": [
                    {
                    "clients": [
                        {
                        "config": {
                            "instance": 1,
                            "latency": 0,
                            "name": "",
                            "volume": {
                            "muted": false,
                            "percent": 96
                            }
                        },
                        "connected": true,
                        "host": {
                            "arch": "x86_64",
                            "ip": "YOUR_IP",
                            "mac": "YOUR_MAC",
                            "name": "YOUR_NAME",
                            "os": "YOUR_OS"
                        },
                        "id": "YOUR_ID",
                        "lastSeen": {
                            "sec": 1546648311,
                            "usec": 86011
                        },
                        "snapclient": {
                            "name": "Snapclient",
                            "protocolVersion": 2,
                            "version": "0.15.0"
                        }
                        }
                    ],
                    "id": "YOUR_ID",
                    "muted": false,
                    "name": "",
                    "stream_id": "mopidy"
                    }
                ],
                "server": {
                    "host": {
                    "arch": "armv7l",
                    "ip": "",
                    "mac": "",
                    "name": "YOUR_NAME",
                    "os": "YOUR_OS"
                    },
                    "snapserver": {
                    "controlProtocolVersion": 1,
                    "name": "Snapserver",
                    "protocolVersion": 1,
                    "version": "0.15.0"
                    }
                },
                "streams": [
                    {
                        "id": "mopidy",
                        "meta": {
                            "STREAM": "mopidy"
                        },
                        "status": "playing",
                        "uri": {
                            "fragment": "",
                            "host": "",
                            "path": "/tmp/snapfifo",
                            "query": {
                            "buffer_ms": "20",
                            "codec": "pcm",
                            "name": "mopidy",
                            "sampleformat": "48000:16:2"
                            },
                            "raw": "pipe:////tmp/snapfifo?buffer_ms=20&codec=pcm&name=mopidy&sampleformat=48000:16:2",
                            "scheme": "pipe"
                        }
                    }
                ]
            }

        
Get the status either of a Snapcast server, client or group
Get the status either of a Snapcast server client or group
def status(self, host=None, port=None, client=None, group=None):
        sock = None
        try:
            sock = self._connect(host or self.host, port or self.port)
            if client:
                return self._get_client(sock, client)
            if group:
                return self._get_group(sock, group)
            return self._status(sock)
        finally:
            try:
                sock.close()
            except Exception as e:
                self.logger.warning(f'Error on socket close: {e}')
def status ( self , host = None , port = None , client = None , group = None ) : sock = None try : sock = self . _connect ( host or self . host , port or self . port ) if client : return self . _get_client ( sock , client ) if group : return self . _get_group ( sock , group ) return self . _status ( sock ) finally : try : sock . close ( ) except Exception as e : self . logger . warning ( f'Error on socket close: {e}' )
Get the status either of a Snapcast server, client or group
Get the status either of a Snapcast server client or group
"""
        Get the status either of a Snapcast server, client or group

        :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

        :param client: Client ID or name (default: None)
        :type client: str

        :param group: Group ID or name (default: None)
        :type group: str

        :returns: dict.

        Example::

            "output": {
                "groups": [
                    {
                    "clients": [
                        {
                        "config": {
                            "instance": 1,
                            "latency": 0,
                            "name": "",
                            "volume": {
                            "muted": false,
                            "percent": 96
                            }
                        },
                        "connected": true,
                        "host": {
                            "arch": "x86_64",
                            "ip": "YOUR_IP",
                            "mac": "YOUR_MAC",
                            "name": "YOUR_NAME",
                            "os": "YOUR_OS"
                        },
                        "id": "YOUR_ID",
                        "lastSeen": {
                            "sec": 1546648311,
                            "usec": 86011
                        },
                        "snapclient": {
                            "name": "Snapclient",
                            "protocolVersion": 2,
                            "version": "0.15.0"
                        }
                        }
                    ],
                    "id": "YOUR_ID",
                    "muted": false,
                    "name": "",
                    "stream_id": "mopidy"
                    }
                ],
                "server": {
                    "host": {
                    "arch": "armv7l",
                    "ip": "",
                    "mac": "",
                    "name": "YOUR_NAME",
                    "os": "YOUR_OS"
                    },
                    "snapserver": {
                    "controlProtocolVersion": 1,
                    "name": "Snapserver",
                    "protocolVersion": 1,
                    "version": "0.15.0"
                    }
                },
                "streams": [
                    {
                        "id": "mopidy",
                        "meta": {
                            "STREAM": "mopidy"
                        },
                        "status": "playing",
                        "uri": {
                            "fragment": "",
                            "host": "",
                            "path": "/tmp/snapfifo",
                            "query": {
                            "buffer_ms": "20",
                            "codec": "pcm",
                            "name": "mopidy",
                            "sampleformat": "48000:16:2"
                            },
                            "raw": "pipe:////tmp/snapfifo?buffer_ms=20&codec=pcm&name=mopidy&sampleformat=48000:16:2",
                            "scheme": "pipe"
                        }
                    }
                ]
            }

        """
None
self
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 )
client
Client ID or name (default: None)
Client ID or name ( default : None )
group
Group ID or name (default: None)
Group ID or name ( default : None )