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();
for (auto it = sys.cbegin(); it != sys.cend(); it++) {
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(),
Utils::String::toUpper("Warning: some of your selected systems do not "
"have a platform set. Results may be even more inaccurate than "
"usual!\nContinue anyway?"),
"YES", std::bind(&GuiScraperMenu::start, this),
"NO", nullptr));
Utils::String::toUpper(warningString),
"YES", std::bind(&GuiScraperMenu::start, this),
"NO", nullptr));
return;
}
}

View file

@ -176,12 +176,15 @@ void thegamesdb_generate_json_scraper_requests(const ScraperSearchParams& params
first = false;
}
else {
LOG(LogWarning) << "TheGamesDB scraper - no support for platform " <<
getPlatformName(*platformIt);
LOG(LogWarning) << "TheGamesDB scraper: No support for platform \"" <<
getPlatformName(*platformIt) << "\", search will be inaccurate";
}
}
path += platformQueryParam;
}
else {
LOG(LogWarning) << "TheGamesDB scraper: No platform defined, search will be inaccurate";
}
requests.push(std::unique_ptr<ScraperRequest>
(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());
// Check if the scraper in the settings still exists as a registered scraping source.
if (scraper_request_funcs.find(name) == scraper_request_funcs.end())
LOG(LogWarning) << "Configured scraper (" << name << ") unavailable, scraping aborted";
else
if (scraper_request_funcs.find(name) == scraper_request_funcs.end()) {
LOG(LogError) << "Configured scraper (" << name << ") unavailable, scraping aborted";
}
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);
}
return handle;
}

View file

@ -193,14 +193,21 @@ void screenscraper_generate_scraper_requests(const ScraperSearchParams& params,
p_ids.push_back(mapIt->second);
}
else {
LOG(LogWarning) << "ScreenScraper: no support for platform " <<
getPlatformName(*platformIt);
LOG(LogWarning) << "ScreenScraper: No support for platform \"" <<
getPlatformName(*platformIt) << "\", search will be inaccurate";
// Add the scrape request without a platform/system ID.
requests.push(std::unique_ptr<ScraperRequest>
(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.
std::sort(p_ids.begin(), p_ids.end());
auto last = std::unique(p_ids.begin(), p_ids.end());