diff --git a/USERGUIDE.md b/USERGUIDE.md index 2ce3da96b..678ba0070 100644 --- a/USERGUIDE.md +++ b/USERGUIDE.md @@ -1,4 +1,4 @@ -# EmulationStation Desktop Edition - User Guide +# EmulationStation Desktop Edition v1.0.0 - User Guide **Note:** This document is intended as a quick start guide, for more in-depth information and details on how to compile EmulationStation and perform more advanced configuration, please refer to the [INSTALL.md](INSTALL.md) document. @@ -542,6 +542,12 @@ The region to scrape for, affects game names. Currently only English or World are supported, not really significant at the moment. +**Search using metadata name** + +By default ES will perform scraper searches based on the game name that has been manually set in the metadata editor, or that has been previously scraped. If you prefer to search using the physical name of the game file or directory, then turn off this option. The default game name will correspond to the name of the physical file or directory, so for the first scraping of any given game, this option makes no difference. + +Note that when using TheGamesDB as scraper service for arcade games (MAME/Neo Geo), the short MAME name will always be expanded to the full game name as this scraper does not properly support searches using MAME names. Also note that you need to save the game name in the metadata editor before you can use it for scraping. + **Overwrite files and data** Affects both overwriting of metadata as well as actual game media files on the filesystem. diff --git a/es-app/src/guis/GuiScraperMenu.cpp b/es-app/src/guis/GuiScraperMenu.cpp index c4fef6158..afe1bbab7 100644 --- a/es-app/src/guis/GuiScraperMenu.cpp +++ b/es-app/src/guis/GuiScraperMenu.cpp @@ -266,6 +266,14 @@ void GuiScraperMenu::openOtherSettings() scraper_language->getParent()->getChildCount()-2)->setOpacity(DISABLED_OPACITY); } + // Search using metadata name. + auto scrape_metadata_name = std::make_shared(mWindow); + scrape_metadata_name->setState(Settings::getInstance()->getBool("ScraperSearchMetadataName")); + s->addWithLabel("SEARCH USING METADATA NAME", scrape_metadata_name); + s->addSaveFunc([scrape_metadata_name] { + Settings::getInstance()->setBool("ScraperSearchMetadataName", + scrape_metadata_name->getState()); }); + // Overwrite files and data. auto scrape_overwrite = std::make_shared(mWindow); scrape_overwrite->setState(Settings::getInstance()->getBool("ScraperOverwriteData")); diff --git a/es-app/src/guis/GuiScraperSearch.cpp b/es-app/src/guis/GuiScraperSearch.cpp index 56f338627..48433e0be 100644 --- a/es-app/src/guis/GuiScraperSearch.cpp +++ b/es-app/src/guis/GuiScraperSearch.cpp @@ -632,22 +632,32 @@ void GuiScraperSearch::openInputScreen(ScraperSearchParams& params) stop(); - if (params.system->hasPlatformId(PlatformIds::ARCADE) || - params.system->hasPlatformId(PlatformIds::NEOGEO)) { - mWindow->pushGui(new GuiTextEditPopup(mWindow, getHelpStyle(), "REFINE SEARCH", - // Initial value is last search if there was one, otherwise the clean path name. - // If it's a MAME or Neo Geo game, expand the game name accordingly. - params.nameOverride.empty() ? - MameNames::getInstance()->getCleanName(params.game->getCleanName()) : - params.nameOverride, - searchForFunc, false, "SEARCH", "APPLY CHANGES?")); + std::string searchString; + + if (params.nameOverride.empty()) { + // If the setting to search based on metadata name has been set, then show this string + // regardless of whether the entry is an arcade game and TheGamesDB is used. + if (Settings::getInstance()->getBool("ScraperSearchMetadataName")) { + searchString = params.game->metadata.get("name"); + } + else { + // If searching based on the actual file name, then expand to the full game name + // in case the scraper is set to TheGamesDB and it's an arcade game. This is required + // as TheGamesDB has issues with searches using the short MAME names. + if (Settings::getInstance()->getString("Scraper") == "thegamesdb" && + (params.system->hasPlatformId(PlatformIds::ARCADE) || + params.system->hasPlatformId(PlatformIds::NEOGEO))) + searchString = MameNames::getInstance()->getCleanName(params.game->getCleanName()); + else + searchString = params.game->getCleanName(); + } } - else { - mWindow->pushGui(new GuiTextEditPopup(mWindow, getHelpStyle(), "REFINE SEARCH", - // Initial value is last search if there was one, otherwise the clean path name. - params.nameOverride.empty() ? params.game->getCleanName() : params.nameOverride, - searchForFunc, false, "SEARCH", "APPLY CHANGES?")); + else { + searchString = params.nameOverride; } + + mWindow->pushGui(new GuiTextEditPopup(mWindow, getHelpStyle(), "REFINE SEARCH", + searchString, searchForFunc, false, "SEARCH", "APPLY CHANGES?")); } bool GuiScraperSearch::saveMetadata( diff --git a/es-app/src/scrapers/GamesDBJSONScraper.cpp b/es-app/src/scrapers/GamesDBJSONScraper.cpp index 8a3ac7018..db5046535 100644 --- a/es-app/src/scrapers/GamesDBJSONScraper.cpp +++ b/es-app/src/scrapers/GamesDBJSONScraper.cpp @@ -137,14 +137,20 @@ void thegamesdb_generate_json_scraper_requests( } else { if (cleanName.empty()) { - // If it's an arcade game (MAME or Neo Geo) then use the regular name. - if (params.system->hasPlatformId(PlatformIds::ARCADE) || - params.system->hasPlatformId(PlatformIds::NEOGEO)) { - cleanName = params.game->getName(); - cleanName = MameNames::getInstance()->getCleanName(params.game->getCleanName()); + // If the setting to search based on the metadata name has been set, then search + // using this regardless of whether the entry is an arcade game. + if (Settings::getInstance()->getBool("ScraperSearchMetadataName")) { + cleanName = params.game->metadata.get("name"); } else { - cleanName = params.game->getCleanName(); + // If not searching based on the metadata name, then check whether it's an + // arcade game and if so expand to the full game name. This is required as + // TheGamesDB has issues with searching using the short MAME names. + if (params.system->hasPlatformId(PlatformIds::ARCADE) || + params.system->hasPlatformId(PlatformIds::NEOGEO)) + cleanName = MameNames::getInstance()->getCleanName(params.game->getCleanName()); + else + cleanName = params.game->getCleanName(); } } path += "/Games/ByGameName?" + apiKey + diff --git a/es-app/src/scrapers/ScreenScraper.cpp b/es-app/src/scrapers/ScreenScraper.cpp index 1922a6c85..fb3784515 100644 --- a/es-app/src/scrapers/ScreenScraper.cpp +++ b/es-app/src/scrapers/ScreenScraper.cpp @@ -159,10 +159,15 @@ void screenscraper_generate_scraper_requests(const ScraperSearchParams& params, ScreenScraperRequest::ScreenScraperConfig ssConfig; - if (params.nameOverride == "") - path = ssConfig.getGameSearchUrl(params.game->getCleanName()); - else + if (params.nameOverride == "") { + if (Settings::getInstance()->getBool("ScraperSearchMetadataName")) + path = ssConfig.getGameSearchUrl(params.game->metadata.get("name")); + else + path = ssConfig.getGameSearchUrl(params.game->getCleanName()); + } + else { path = ssConfig.getGameSearchUrl(params.nameOverride); + } auto& platforms = params.system->getPlatformIds(); std::vector p_ids; diff --git a/es-core/src/Settings.cpp b/es-core/src/Settings.cpp index 57a8a34f1..ec8f08382 100644 --- a/es-core/src/Settings.cpp +++ b/es-core/src/Settings.cpp @@ -161,6 +161,7 @@ void Settings::setDefaults() // mBoolMap["ScraperGenerateThumbnails"] = false; mBoolMap["ScraperInteractive"] = true; mBoolMap["ScraperSemiautomatic"] = true; + mBoolMap["ScraperSearchMetadataName"] = true; mBoolMap["ScraperOverwriteData"] = true; mBoolMap["ScraperRespectExclusions"] = true; mBoolMap["ScraperExcludeRecursively"] = true;