Implemented handling of invalid ScreenScraper responses.

This commit is contained in:
Leon Styhre 2020-09-26 13:07:52 +02:00
parent e6b43288a7
commit 6ec1898e97

View file

@ -223,6 +223,24 @@ void ScreenScraperRequest::process(const std::unique_ptr<HttpReq>& req,
}
processGame(doc, results);
// For some files, screenscraper.fr consistently responds with the game name 'ZZZ(notgame)',
// or sometimes in the longer format 'ZZZ(notgame):Fichier Annexes - Non Jeux'. For instance
// this can happen for configuration files for DOS games such as 'setup.exe' and similar.
// We definitely don't want to save these to our gamelists, so we simply skip these
// responses. There also seems to be some cases where this type of response is randomly
// returned instead of a valid game name, and retrying a second time returns the proper
// name. But it's basically impossible to know which is the case, and we really can't
// compensate for errors in the scraper service.
for (auto it = results.cbegin(); it != results.cend(); it++) {
std::string gameName = Utils::String::toUpper((*it).mdl.get("name"));
if (gameName.substr(0, 12) == "ZZZ(NOTGAME)") {
LOG(LogWarning) << "ScreenScraperRequest - Received \"ZZZ(notgame)\" as game name, "
"ignoring response.";
results.pop_back();
return;
}
}
}
void ScreenScraperRequest::processGame(const pugi::xml_document& xmldoc,