mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-22 06:05:38 +00:00
Fixed an issue where duplicate ScreenScraper game IDs were sometimes not removed from the search results
This commit is contained in:
parent
e363b0a605
commit
2de3897c8a
|
@ -313,13 +313,16 @@ void ScreenScraperRequest::process(const std::unique_ptr<HttpReq>& req,
|
|||
// 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) {
|
||||
std::vector<std::string> gameIDs;
|
||||
for (auto it = results.cbegin(); it != results.cend();) {
|
||||
if (std::find(gameIDs.begin(), gameIDs.end(), (*it).gameID) != gameIDs.end()) {
|
||||
LOG(LogDebug)
|
||||
<< "ScreenScraperRequest::process(): Removed duplicate entry for game ID "
|
||||
<< (*it).gameID;
|
||||
it = results.erase(it);
|
||||
LOG(LogDebug) << "ScreenScraperRequest::process(): Removed duplicate entry";
|
||||
}
|
||||
else {
|
||||
gameIDs.emplace_back((*it).gameID);
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue