Improved some scraper logging.

This commit is contained in:
Leon Styhre 2021-02-08 20:56:11 +01:00
parent 3922fdd40a
commit 190bb839ec
4 changed files with 37 additions and 12 deletions

View file

@ -550,12 +550,22 @@ void GuiScraperMenu::pressedStart()
std::vector<SystemData*> sys = mSystems->getSelectedObjects(); std::vector<SystemData*> sys = mSystems->getSelectedObjects();
for (auto it = sys.cbegin(); it != sys.cend(); it++) { for (auto it = sys.cbegin(); it != sys.cend(); it++) {
if ((*it)->getPlatformIds().empty()) { if ((*it)->getPlatformIds().empty()) {
std::string warningString;
if (sys.size() == 1) {
warningString = "The selected system does not have a\n"
"platform set, results may be inaccurate\n"
"Continue anyway?";
}
else {
warningString = "At least one of your selected\n"
"systems does not have a platform\n"
"set, results may be inaccurate\n"
"Continue anyway?";
}
mWindow->pushGui(new GuiMsgBox(mWindow, getHelpStyle(), mWindow->pushGui(new GuiMsgBox(mWindow, getHelpStyle(),
Utils::String::toUpper("Warning: some of your selected systems do not " Utils::String::toUpper(warningString),
"have a platform set. Results may be even more inaccurate than " "YES", std::bind(&GuiScraperMenu::start, this),
"usual!\nContinue anyway?"), "NO", nullptr));
"YES", std::bind(&GuiScraperMenu::start, this),
"NO", nullptr));
return; return;
} }
} }

View file

@ -176,12 +176,15 @@ void thegamesdb_generate_json_scraper_requests(const ScraperSearchParams& params
first = false; first = false;
} }
else { else {
LOG(LogWarning) << "TheGamesDB scraper - no support for platform " << LOG(LogWarning) << "TheGamesDB scraper: No support for platform \"" <<
getPlatformName(*platformIt); getPlatformName(*platformIt) << "\", search will be inaccurate";
} }
} }
path += platformQueryParam; path += platformQueryParam;
} }
else {
LOG(LogWarning) << "TheGamesDB scraper: No platform defined, search will be inaccurate";
}
requests.push(std::unique_ptr<ScraperRequest> requests.push(std::unique_ptr<ScraperRequest>
(new TheGamesDBJSONRequest(requests, results, path))); (new TheGamesDBJSONRequest(requests, results, path)));

View file

@ -36,10 +36,15 @@ std::unique_ptr<ScraperSearchHandle> startScraperSearch(const ScraperSearchParam
std::unique_ptr<ScraperSearchHandle> handle(new ScraperSearchHandle()); std::unique_ptr<ScraperSearchHandle> handle(new ScraperSearchHandle());
// Check if the scraper in the settings still exists as a registered scraping source. // Check if the scraper in the settings still exists as a registered scraping source.
if (scraper_request_funcs.find(name) == scraper_request_funcs.end()) if (scraper_request_funcs.find(name) == scraper_request_funcs.end()) {
LOG(LogWarning) << "Configured scraper (" << name << ") unavailable, scraping aborted"; LOG(LogError) << "Configured scraper (" << name << ") unavailable, scraping aborted";
else }
else {
LOG(LogDebug) << "Scraper::startScraperSearch(): Scraping system \"" <<
params.system->getName() << "\", game file \"" <<
params.game->getFileName() << "\"";
scraper_request_funcs.at(name)(params, handle->mRequestQueue, handle->mResults); scraper_request_funcs.at(name)(params, handle->mRequestQueue, handle->mResults);
}
return handle; return handle;
} }

View file

@ -193,14 +193,21 @@ void screenscraper_generate_scraper_requests(const ScraperSearchParams& params,
p_ids.push_back(mapIt->second); p_ids.push_back(mapIt->second);
} }
else { else {
LOG(LogWarning) << "ScreenScraper: no support for platform " << LOG(LogWarning) << "ScreenScraper: No support for platform \"" <<
getPlatformName(*platformIt); getPlatformName(*platformIt) << "\", search will be inaccurate";
// Add the scrape request without a platform/system ID. // Add the scrape request without a platform/system ID.
requests.push(std::unique_ptr<ScraperRequest> requests.push(std::unique_ptr<ScraperRequest>
(new ScreenScraperRequest(requests, results, path))); (new ScreenScraperRequest(requests, results, path)));
} }
} }
if (p_ids.size() == 0) {
LOG(LogWarning) << "ScreenScraper: No platform defined, search will be inaccurate";
// Add the scrape request without a platform/system ID.
requests.push(std::unique_ptr<ScraperRequest>
(new ScreenScraperRequest(requests, results, path)));
}
// Sort the platform IDs and remove duplicates. // Sort the platform IDs and remove duplicates.
std::sort(p_ids.begin(), p_ids.end()); std::sort(p_ids.begin(), p_ids.end());
auto last = std::unique(p_ids.begin(), p_ids.end()); auto last = std::unique(p_ids.begin(), p_ids.end());