From fc24b213114a74ba45abf85037fdebbe9c626377 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Fri, 4 Aug 2023 18:02:12 +0200 Subject: [PATCH] Fixed an issue where duplicate ScreenScraper game entries could show up in the interactive scraper if multiple platforms were defined for the system --- es-app/src/scrapers/ScreenScraper.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/es-app/src/scrapers/ScreenScraper.cpp b/es-app/src/scrapers/ScreenScraper.cpp index f0ca6e1d4..2dd2291f2 100644 --- a/es-app/src/scrapers/ScreenScraper.cpp +++ b/es-app/src/scrapers/ScreenScraper.cpp @@ -301,6 +301,21 @@ void ScreenScraperRequest::process(const std::unique_ptr& 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,