From ca502fc274c640f1e301a77ecb336ab5a23d348d Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Mon, 18 Jun 2018 20:47:38 +0100 Subject: Update to new ContentDB API --- src/content/packages.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'src/content/packages.cpp') diff --git a/src/content/packages.cpp b/src/content/packages.cpp index d50e63a6b..dd7574d48 100644 --- a/src/content/packages.cpp +++ b/src/content/packages.cpp @@ -43,24 +43,19 @@ std::vector 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; -- cgit v1.2.3