1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-11-06 10:15:19 +01:00

Update to new ContentDB API

This commit is contained in:
rubenwardy
2018-06-18 20:47:38 +01:00
committed by GitHub
parent e8b687d7ca
commit ca502fc274
4 changed files with 35 additions and 42 deletions

View File

@@ -43,24 +43,19 @@ std::vector<Package> getPackagesFromURL(const std::string &url)
for (unsigned int i = 0; i < json.size(); ++i) {
Package package;
package.author = json[i]["author"].asString();
package.name = json[i]["name"].asString();
package.title = json[i]["title"].asString();
package.author = json[i]["author"].asString();
package.type = json[i]["type"].asString();
package.shortDesc = json[i]["shortDesc"].asString();
package.url = json[i]["url"].asString();
package.release = json[i]["release"].asInt();
if (json[i].isMember("thumbnail"))
package.thumbnail = json[i]["thumbnail"].asString();
Json::Value jScreenshots = json[i]["screenshots"];
for (unsigned int j = 0; j < jScreenshots.size(); ++j) {
package.screenshots.push_back(jScreenshots[j].asString());
}
if (package.valid()) {
if (package.valid())
packages.push_back(package);
} else {
else
errorstream << "Invalid package at " << i << std::endl;
}
}
return packages;