snapcast icon indicating copy to clipboard operation
snapcast copied to clipboard

jsonrpc Group.SetClients only takes the new client to replace the only existing client in the group of "clients"

Open efung1232 opened this issue 2 years ago • 0 comments

Describe the bug This is the beginning of the result after polling the snapserver status: {'server': {'groups': [{'clients': [{'config': {'instance': 1, ... You can see that the third word "clients" is pural . I guess the "clients" could have more than one client in the "clients" list. But, I have always seen one and only one client in the "clients" list. Since there is no command name like "Group.AddClient", I don't know whether this is a feature or bug. Thanks in advance.

Steps to Reproduce I have implmented a python function after reading https://github.com/badaix/snapcast/blob/master/doc/json_rpc_api/control.md#groupsetclients Here is my working function: import json import requests broker_ipaddr = "172.168.0.116" # snapserver IP addr def setGroupClient(group_id, client_id, client_mac): params = {} client_info = [] client_info.append(client_id) client_info.append(client_mac) params['clients'] = client_info params['id'] = group_id broker_url = "http://" + broker_ipaddr + ":1780/jsonrpc" pload = '{"id":3,"jsonrpc":"2.0","method":"Group.SetClients","params":' + json.dumps(params) + '}' r = requests.post(broker_url, data = pload) r_dictionary = r.json() print(r_dictionary['result'])

Environment details

  • OS: both Raspbian and Fedora with different LAN IP
  • Snapcast version 0.25
  • Installed from self compiled

efung1232 avatar Dec 22 '21 22:12 efung1232