mirror of
https://github.com/badaix/snapcast.git
synced 2025-06-02 10:51:45 +02:00
fixed loading of client config
This commit is contained in:
parent
a9a9443563
commit
1f177e5119
2 changed files with 13 additions and 2 deletions
|
@ -55,9 +55,16 @@ Config::Config()
|
|||
{
|
||||
ClientInfoPtr client = make_shared<ClientInfo>();
|
||||
client->fromJson(*it);
|
||||
if (client->host.mac.empty())
|
||||
continue;
|
||||
for (const auto& c: clients)
|
||||
{
|
||||
if (c->host.mac == client->host.mac)
|
||||
continue;
|
||||
}
|
||||
|
||||
client->connected = false;
|
||||
clients.push_back(client);
|
||||
// logO << "Client:\n" << std::setw(4) << client->toJson() << '\n';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -209,7 +209,9 @@ struct ClientInfo
|
|||
void fromJson(const json& j)
|
||||
{
|
||||
if (j.count("host") && !j["host"].is_string())
|
||||
{
|
||||
host.fromJson(j["host"]);
|
||||
}
|
||||
else
|
||||
{
|
||||
host.ip = jGet<std::string>(j, "IP", "");
|
||||
|
@ -223,7 +225,9 @@ struct ClientInfo
|
|||
snapclient.version = jGet<std::string>(j, "version", "");
|
||||
|
||||
if (j.count("config"))
|
||||
host.fromJson(j["config"]);
|
||||
{
|
||||
config.fromJson(j["config"]);
|
||||
}
|
||||
else
|
||||
{
|
||||
config.name = trim_copy(jGet<std::string>(j, "name", ""));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue