mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-12 16:46:42 +02:00
renamed "System" to "Server"
This commit is contained in:
parent
eb99b52c5e
commit
b4701fb0fe
5 changed files with 12 additions and 11 deletions
|
@ -137,7 +137,7 @@ public class RemoteControl implements TcpClient.TcpClientListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getServerStatus() {
|
public void getServerStatus() {
|
||||||
JSONObject request = jsonRequest("System.GetStatus", null);
|
JSONObject request = jsonRequest("Server.GetStatus", null);
|
||||||
tcpClient.sendMessage(request.toString());
|
tcpClient.sendMessage(request.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ public class RemoteControl implements TcpClient.TcpClientListener {
|
||||||
|
|
||||||
public void delete(ClientInfo clientInfo) {
|
public void delete(ClientInfo clientInfo) {
|
||||||
try {
|
try {
|
||||||
JSONObject request = jsonRequest("System.DeleteClient", new JSONObject("{\"client\": \"" + clientInfo.getMac() + "\"}"));
|
JSONObject request = jsonRequest("Server.DeleteClient", new JSONObject("{\"client\": \"" + clientInfo.getMac() + "\"}"));
|
||||||
tcpClient.sendMessage(request.toString());
|
tcpClient.sendMessage(request.toString());
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
|
@ -39,7 +39,7 @@ if sys.argv[2] == "setVolume":
|
||||||
print("usage: control.py <SERVER HOST> setVolume <VOLUME>")
|
print("usage: control.py <SERVER HOST> setVolume <VOLUME>")
|
||||||
exit(0)
|
exit(0)
|
||||||
volume = int(sys.argv[3])
|
volume = int(sys.argv[3])
|
||||||
j = doRequest(json.dumps({'jsonrpc': '2.0', 'method': 'System.GetStatus', 'id': 1}), 1)
|
j = doRequest(json.dumps({'jsonrpc': '2.0', 'method': 'Server.GetStatus', 'id': 1}), 1)
|
||||||
for client in j["result"]["clients"]:
|
for client in j["result"]["clients"]:
|
||||||
setVolume(client['MAC'], volume)
|
setVolume(client['MAC'], volume)
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ elif sys.argv[2] == "setName":
|
||||||
else:
|
else:
|
||||||
print("unknown command \"" + sys.argv[2] + "\"")
|
print("unknown command \"" + sys.argv[2] + "\"")
|
||||||
|
|
||||||
j = doRequest(json.dumps({'jsonrpc': '2.0', 'method': 'System.GetStatus', 'id': 1}), 1)
|
j = doRequest(json.dumps({'jsonrpc': '2.0', 'method': 'Server.GetStatus', 'id': 1}), 1)
|
||||||
for client in j["result"]["clients"]:
|
for client in j["result"]["clients"]:
|
||||||
print("MAC: " + client['MAC'] + ", conntect: " + str(client['connected']) + ", volume: " + str(client['volume']['percent']) + ", name: " + client['name'] + ", host: " + client['host'])
|
print("MAC: " + client['MAC'] + ", conntect: " + str(client['connected']) + ", volume: " + str(client['volume']['percent']) + ", name: " + client['name'] + ", host: " + client['host'])
|
||||||
|
|
||||||
|
|
|
@ -26,11 +26,11 @@ def setVolume(client, volume):
|
||||||
requestId = requestId + 1
|
requestId = requestId + 1
|
||||||
|
|
||||||
volume = int(sys.argv[2])
|
volume = int(sys.argv[2])
|
||||||
j = doRequest(json.dumps({'jsonrpc': '2.0', 'method': 'System.GetStatus', 'id': 1}), 1)
|
j = doRequest(json.dumps({'jsonrpc': '2.0', 'method': 'Server.GetStatus', 'id': 1}), 1)
|
||||||
for client in j["result"]["clients"]:
|
for client in j["result"]["clients"]:
|
||||||
setVolume(client['MAC'], volume)
|
setVolume(client['MAC'], volume)
|
||||||
|
|
||||||
j = doRequest(json.dumps({'jsonrpc': '2.0', 'method': 'System.GetStatus', 'id': 1}), 1)
|
j = doRequest(json.dumps({'jsonrpc': '2.0', 'method': 'Server.GetStatus', 'id': 1}), 1)
|
||||||
for client in j["result"]["clients"]:
|
for client in j["result"]["clients"]:
|
||||||
print("MAC: " + client['MAC'] + ", name: " + client['name'] + ", conntect: " + str(client['connected']) + ", volume: " + str(client['volume']['percent']))
|
print("MAC: " + client['MAC'] + ", name: " + client['name'] + ", conntect: " + str(client['connected']) + ", volume: " + str(client['volume']['percent']))
|
||||||
|
|
||||||
|
|
|
@ -39,8 +39,8 @@ t_stop= threading.Event()
|
||||||
t = ReaderThread(telnet, t_stop)
|
t = ReaderThread(telnet, t_stop)
|
||||||
t.start()
|
t.start()
|
||||||
|
|
||||||
doRequest("{\"jsonrpc\": \"2.0\", \"method\": \"System.GetStatus\", \"id\": 1}\r\n")
|
doRequest("{\"jsonrpc\": \"2.0\", \"method\": \"Server.GetStatus\", \"id\": 1}\r\n")
|
||||||
doRequest("{\"jsonrpc\": \"2.0\", \"method\": \"System.GetStatus\", \"params\": {\"client\": \"80:1f:02:ed:fd:e0\"}, \"id\": 2}\r\n")
|
doRequest("{\"jsonrpc\": \"2.0\", \"method\": \"Server.GetStatus\", \"params\": {\"client\": \"80:1f:02:ed:fd:e0\"}, \"id\": 2}\r\n")
|
||||||
doRequest("{\"jsonrpc\": \"2.0\", \"method\": \"Client.SetVolume\", \"params\": {\"client\": \"80:1f:02:ed:fd:e0\", \"volume\": 10}, \"id\": 3}\r\n")
|
doRequest("{\"jsonrpc\": \"2.0\", \"method\": \"Client.SetVolume\", \"params\": {\"client\": \"80:1f:02:ed:fd:e0\", \"volume\": 10}, \"id\": 3}\r\n")
|
||||||
doRequest("{\"jsonrpc\": \"2.0\", \"method\": \"Client.SetVolume\", \"params\": {\"client\": \"80:1f:02:ed:fd:e0\", \"volume\": 30}, \"id\": 4}\r\n")
|
doRequest("{\"jsonrpc\": \"2.0\", \"method\": \"Client.SetVolume\", \"params\": {\"client\": \"80:1f:02:ed:fd:e0\", \"volume\": 30}, \"id\": 4}\r\n")
|
||||||
doRequest("{\"jsonrpc\": \"2.0\", \"method\": \"Client.SetVolume\", \"params\": {\"client\": \"80:1f:02:ed:fd:e0\", \"volume\": 50}, \"id\": 5}\r\n")
|
doRequest("{\"jsonrpc\": \"2.0\", \"method\": \"Client.SetVolume\", \"params\": {\"client\": \"80:1f:02:ed:fd:e0\", \"volume\": 50}, \"id\": 5}\r\n")
|
||||||
|
|
|
@ -141,7 +141,7 @@ void StreamServer::onMessageReceived(ControlSession* controlSession, const std::
|
||||||
throw JsonInternalErrorException("Client not found", request.id);
|
throw JsonInternalErrorException("Client not found", request.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (request.method == "System.GetStatus")
|
if (request.method == "Server.GetStatus")
|
||||||
{
|
{
|
||||||
json jClient = json::array();
|
json jClient = json::array();
|
||||||
if (request.hasParam("client"))
|
if (request.hasParam("client"))
|
||||||
|
@ -158,10 +158,11 @@ void StreamServer::onMessageReceived(ControlSession* controlSession, const std::
|
||||||
{"host", getHostName()},
|
{"host", getHostName()},
|
||||||
{"version", VERSION}
|
{"version", VERSION}
|
||||||
}},
|
}},
|
||||||
{"clients", jClient}
|
{"clients", jClient},
|
||||||
|
{"streams", "TODO"}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
else if (request.method == "System.DeleteClient")
|
else if (request.method == "Server.DeleteClient")
|
||||||
{
|
{
|
||||||
clientInfo = Config::instance().getClientInfo(request.getParam("client").get<string>(), false);
|
clientInfo = Config::instance().getClientInfo(request.getParam("client").get<string>(), false);
|
||||||
if (clientInfo == nullptr)
|
if (clientInfo == nullptr)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue