Fixed an issue where duplicate ScreenScraper game entries could show up in the interactive scraper if multiple platforms were defined for the system

This commit is contained in:
Leon Styhre 2023-08-04 18:02:12 +02:00
parent 82338d9b90
commit fc24b21311

View file

@ -301,6 +301,21 @@ void ScreenScraperRequest::process(const std::unique_ptr<HttpReq>& req,
++it;
}
}
// If there are multiple platforms defined for the system, then it's possible that the scraper
// service will return the same results for each platform, so we need to remove such duplicates.
if (results.size() > 1) {
const std::string gameID {results.front().gameID};
for (auto it = results.cbegin() + 1; it != results.cend();) {
if ((*it).gameID == gameID) {
it = results.erase(it);
LOG(LogDebug) << "ScreenScraperRequest::process(): Removed duplicate entry";
}
else {
++it;
}
}
}
}
void ScreenScraperRequest::processGame(const pugi::xml_document& xmldoc,