diff --git a/es-app/src/guis/GuiScraperMenu.cpp b/es-app/src/guis/GuiScraperMenu.cpp index 2a76e9edf..90da182d7 100644 --- a/es-app/src/guis/GuiScraperMenu.cpp +++ b/es-app/src/guis/GuiScraperMenu.cpp @@ -896,6 +896,29 @@ void GuiScraperMenu::openOtherOptions() } }); + // Whether to remove dots from game names when searching using the automatic scraper. + auto scraperAutomaticRemoveDots = std::make_shared(); + scraperAutomaticRemoveDots->setState( + Settings::getInstance()->getBool("ScraperAutomaticRemoveDots")); + s->addWithLabel("REMOVE DOTS FROM SEARCHES WHEN AUTO-SCRAPING", scraperAutomaticRemoveDots); + s->addSaveFunc([scraperAutomaticRemoveDots, s] { + if (scraperAutomaticRemoveDots->getState() != + Settings::getInstance()->getBool("ScraperAutomaticRemoveDots")) { + Settings::getInstance()->setBool("ScraperAutomaticRemoveDots", + scraperAutomaticRemoveDots->getState()); + s->setNeedsSaving(); + } + }); + + // This is not needed for TheGamesDB, so gray out the option if this scraper is selected. + if (Settings::getInstance()->getString("Scraper") == "thegamesdb") { + scraperAutomaticRemoveDots->setEnabled(false); + scraperAutomaticRemoveDots->setOpacity(DISABLED_OPACITY); + scraperAutomaticRemoveDots->getParent() + ->getChild(scraperAutomaticRemoveDots->getChildIndex() - 1) + ->setOpacity(DISABLED_OPACITY); + } + // Whether to fallback to additional regions. auto scraperRegionFallback = std::make_shared(mWindow); scraperRegionFallback->setState(Settings::getInstance()->getBool("ScraperRegionFallback")); diff --git a/es-app/src/scrapers/ScreenScraper.cpp b/es-app/src/scrapers/ScreenScraper.cpp index c9783fc3d..2d9db925e 100644 --- a/es-app/src/scrapers/ScreenScraper.cpp +++ b/es-app/src/scrapers/ScreenScraper.cpp @@ -726,8 +726,8 @@ std::string ScreenScraperRequest::ScreenScraperConfig::getGameSearchUrl( const std::string gameName) const { std::string screenScraperURL; - std::string searchName = gameName; - bool singleSearch = false; + std::string searchName {gameName}; + bool singleSearch {false}; // Trim leading and trailing whitespaces. searchName = Utils::String::trim(searchName); @@ -771,8 +771,8 @@ std::string ScreenScraperRequest::ScreenScraperConfig::getGameSearchUrl( // Another issue is that ScreenScraper removes the word "the" from the search string, which // could also lead to an error for short game names. if (!singleSearch) { - std::string removeThe = - Utils::String::replace(Utils::String::toUpper(searchName), "THE ", ""); + std::string removeThe { + Utils::String::replace(Utils::String::toUpper(searchName), "THE ", "")}; // Any additional spaces must also be removed. removeThe.erase(removeThe.begin(), std::find_if(removeThe.begin(), removeThe.end(), [](char c) { @@ -788,6 +788,8 @@ std::string ScreenScraperRequest::ScreenScraperConfig::getGameSearchUrl( } if (automaticMode || singleSearch) { + if (Settings::getInstance()->getBool("ScraperAutomaticRemoveDots")) + searchName = Utils::String::replace(searchName, ".", ""); screenScraperURL = API_URL_BASE + "/jeuInfos.php?devid=" + Utils::String::scramble(API_DEV_U, API_DEV_KEY) + "&devpassword=" + Utils::String::scramble(API_DEV_P, API_DEV_KEY) + diff --git a/es-core/src/Settings.cpp b/es-core/src/Settings.cpp index fea763b68..e3c7c7705 100644 --- a/es-core/src/Settings.cpp +++ b/es-core/src/Settings.cpp @@ -125,6 +125,7 @@ void Settings::setDefaults() mBoolMap["ScraperRespectExclusions"] = {true, true}; mBoolMap["ScraperExcludeRecursively"] = {true, true}; mBoolMap["ScraperConvertUnderscores"] = {true, true}; + mBoolMap["ScraperAutomaticRemoveDots"] = {true, true}; mBoolMap["ScraperRegionFallback"] = {true, true}; mBoolMap["ScraperRetryPeerVerification"] = {false, false};