Added option to scrape based on the metadata name.

This commit is contained in:
Leon Styhre 2020-10-10 13:05:12 +02:00
parent aee2f6bd59
commit 96da134f7d
6 changed files with 60 additions and 24 deletions

View file

@ -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.

View file

@ -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<SwitchComponent>(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<SwitchComponent>(mWindow);
scrape_overwrite->setState(Settings::getInstance()->getBool("ScraperOverwriteData"));

View file

@ -632,23 +632,33 @@ 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 {
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?"));
// 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 {
searchString = params.nameOverride;
}
mWindow->pushGui(new GuiTextEditPopup(mWindow, getHelpStyle(), "REFINE SEARCH",
searchString, searchForFunc, false, "SEARCH", "APPLY CHANGES?"));
}
bool GuiScraperSearch::saveMetadata(
const ScraperSearchResult& result, MetaDataList& metadata)

View file

@ -137,13 +137,19 @@ 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 {
// 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();
}
}

View file

@ -159,10 +159,15 @@ void screenscraper_generate_scraper_requests(const ScraperSearchParams& params,
ScreenScraperRequest::ScreenScraperConfig ssConfig;
if (params.nameOverride == "")
path = ssConfig.getGameSearchUrl(params.game->getCleanName());
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<unsigned short> p_ids;

View file

@ -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;