From 8c71bce8f834154e2dc7cb08692a13d412e1b63c Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Tue, 26 Jan 2021 21:04:16 +0100 Subject: [PATCH] Expanded the strings for region and language in GuiScraperMenu. --- es-app/src/guis/GuiScraperMenu.cpp | 46 +++++++++++---------------- es-app/src/scrapers/ScreenScraper.cpp | 3 +- 2 files changed, 19 insertions(+), 30 deletions(-) diff --git a/es-app/src/guis/GuiScraperMenu.cpp b/es-app/src/guis/GuiScraperMenu.cpp index 7e8dc4c44..608781fc2 100644 --- a/es-app/src/guis/GuiScraperMenu.cpp +++ b/es-app/src/guis/GuiScraperMenu.cpp @@ -308,20 +308,15 @@ void GuiScraperMenu::openOtherSettings() // Scraper region. auto scraper_region = std::make_shared> (mWindow, getHelpStyle(), "REGION", false); - std::vector transitions_rg; - transitions_rg.push_back("eu"); - transitions_rg.push_back("jp"); - transitions_rg.push_back("us"); - transitions_rg.push_back("ss"); - transitions_rg.push_back("wor"); - if (Settings::getInstance()->getString("ScraperRegion") != "") { - if (std::find(transitions_rg.begin(), transitions_rg.end(), - Settings::getInstance()->getString("ScraperRegion")) == transitions_rg.end()) { - transitions_rg.push_back(Settings::getInstance()->getString("ScraperRegion")); - } - } - for (auto it = transitions_rg.cbegin(); it != transitions_rg.cend(); it++) - scraper_region->add(*it, *it, Settings::getInstance()->getString("ScraperRegion") == *it); + std::string selectedScraperRegion = Settings::getInstance()->getString("ScraperRegion"); + scraper_region->add("Europe", "eu", selectedScraperRegion == "eu"); + scraper_region->add("Japan", "jp", selectedScraperRegion == "jp"); + scraper_region->add("USA", "us", selectedScraperRegion == "us"); + scraper_region->add("World", "wor", selectedScraperRegion == "wor"); + // If there are no objects returned, then there must be a manually modified entry in the + // configuration file. Simply set the region to Europe in this case. + if (scraper_region->getSelectedObjects().size() == 0) + scraper_region->selectEntry(0); s->addWithLabel("REGION", scraper_region); s->addSaveFunc([scraper_region, s] { if (scraper_region->getSelected() != Settings::getInstance()->getString("ScraperRegion")) { @@ -340,20 +335,15 @@ void GuiScraperMenu::openOtherSettings() // Scraper language. auto scraper_language = std::make_shared> - (mWindow, getHelpStyle(), "LANGUAGE", false); - std::vector transitions_lg; - transitions_lg.push_back("en"); - transitions_lg.push_back("wor"); - if (Settings::getInstance()->getString("ScraperLanguage") != "") { - if (std::find(transitions_lg.begin(), transitions_lg.end(), - Settings::getInstance()->getString("ScraperLanguage")) == transitions_lg.end()) { - transitions_lg.push_back(Settings::getInstance()->getString("ScraperLanguage")); - } - } - for (auto it = transitions_lg.cbegin(); it != transitions_lg.cend(); it++) - scraper_language->add(*it, *it, - Settings::getInstance()->getString("ScraperLanguage") == *it); - s->addWithLabel("LANGUAGE", scraper_language); + (mWindow, getHelpStyle(), "PREFERRED LANGUAGE", false); + std::string selectedScraperLanguage = Settings::getInstance()->getString("ScraperLanguage"); + scraper_language->add("English", "en", selectedScraperLanguage == "en"); + scraper_language->add("World", "wor", selectedScraperLanguage == "wor"); + // If there are no objects returned, then there must be a manually modified entry in the + // configuration file. Simply set the language to English in this case. + if (scraper_language->getSelectedObjects().size() == 0) + scraper_language->selectEntry(0); + s->addWithLabel("PREFERRED LANGUAGE", scraper_language); s->addSaveFunc([scraper_language, s] { if (scraper_language->getSelected() != Settings::getInstance()->getString("ScraperLanguage")) { diff --git a/es-app/src/scrapers/ScreenScraper.cpp b/es-app/src/scrapers/ScreenScraper.cpp index 72d2db30f..f19c00c2e 100644 --- a/es-app/src/scrapers/ScreenScraper.cpp +++ b/es-app/src/scrapers/ScreenScraper.cpp @@ -316,8 +316,7 @@ void ScreenScraperRequest::processGame(const pugi::xml_document& xmldoc, // Name fallback: US, WOR(LD). (Xpath: Data/jeu[0]/noms/nom[*]). result.mdl.set("name", find_child_by_attribute_list(game.child("noms"), "nom", "region", { region, "wor", "us" , "ss", "eu", "jp" }).text().get()); - LOG(LogDebug) << "ScreenScraperRequest::processGame(): Name: " << - result.mdl.get("name"); + LOG(LogDebug) << "ScreenScraperRequest::processGame(): Name: " << result.mdl.get("name"); // Validate rating. // Process the rating even if the setting to scrape ratings has been disabled.