From 6d4086639aaf380f1e3452de20a3a4a0dbccb7d7 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Thu, 15 Dec 2022 18:27:45 +0100 Subject: [PATCH] Disabled ScreenScraper controller scraping as they have ruined that functionality. --- es-app/src/guis/GuiScraperMenu.cpp | 52 ++++---- es-app/src/guis/GuiScraperSearch.cpp | 7 +- es-app/src/scrapers/ScreenScraper.cpp | 178 +++++++++++++------------- es-core/src/Settings.cpp | 3 +- 4 files changed, 124 insertions(+), 116 deletions(-) diff --git a/es-app/src/guis/GuiScraperMenu.cpp b/es-app/src/guis/GuiScraperMenu.cpp index 54df9b680..acd790e20 100644 --- a/es-app/src/guis/GuiScraperMenu.cpp +++ b/es-app/src/guis/GuiScraperMenu.cpp @@ -252,27 +252,28 @@ void GuiScraperMenu::openContentOptions() ->setOpacity(DISABLED_OPACITY); } - // Scrape controllers (arcade systems only). - auto scrapeControllers = std::make_shared(); - scrapeControllers->setState(Settings::getInstance()->getBool("ScrapeControllers")); - s->addWithLabel("CONTROLLERS (ARCADE SYSTEMS ONLY)", scrapeControllers); - s->addSaveFunc([scrapeControllers, s] { - if (scrapeControllers->getState() != - Settings::getInstance()->getBool("ScrapeControllers")) { - Settings::getInstance()->setBool("ScrapeControllers", scrapeControllers->getState()); - s->setNeedsSaving(); - } - }); + // ScreenScraper controller scraping is currently broken, it's unclear if they will fix it. + // // Scrape controllers (arcade systems only). + // auto scrapeControllers = std::make_shared(); + // scrapeControllers->setState(Settings::getInstance()->getBool("ScrapeControllers")); + // s->addWithLabel("CONTROLLERS (ARCADE SYSTEMS ONLY)", scrapeControllers); + // s->addSaveFunc([scrapeControllers, s] { + // if (scrapeControllers->getState() != + // Settings::getInstance()->getBool("ScrapeControllers")) { + // Settings::getInstance()->setBool("ScrapeControllers", scrapeControllers->getState()); + // s->setNeedsSaving(); + // } + // }); - // Controllers are not supported by TheGamesDB, so gray out the option if this scraper is - // selected. - if (Settings::getInstance()->getString("Scraper") == "thegamesdb") { - scrapeControllers->setEnabled(false); - scrapeControllers->setOpacity(DISABLED_OPACITY); - scrapeControllers->getParent() - ->getChild(scrapeControllers->getChildIndex() - 1) - ->setOpacity(DISABLED_OPACITY); - } + // // Controllers are not supported by TheGamesDB, so gray out the option if this scraper is + // // selected. + // if (Settings::getInstance()->getString("Scraper") == "thegamesdb") { + // scrapeControllers->setEnabled(false); + // scrapeControllers->setOpacity(DISABLED_OPACITY); + // scrapeControllers->getParent() + // ->getChild(scrapeControllers->getChildIndex() - 1) + // ->setOpacity(DISABLED_OPACITY); + // } // Scrape other metadata. auto scrapeMetadata = std::make_shared(); @@ -1059,11 +1060,12 @@ void GuiScraperMenu::start() contentToScrape = true; break; } - if (scraperService == "screenscraper" && - Settings::getInstance()->getBool("ScrapeControllers")) { - contentToScrape = true; - break; - } + // ScreenScraper controller scraping is currently broken, it's unclear if they will fix it. + // if (scraperService == "screenscraper" && + // Settings::getInstance()->getBool("ScrapeControllers")) { + // contentToScrape = true; + // break; + // } if (Settings::getInstance()->getBool("ScrapeMetadata")) { contentToScrape = true; break; diff --git a/es-app/src/guis/GuiScraperSearch.cpp b/es-app/src/guis/GuiScraperSearch.cpp index 202b16af1..00da5868d 100644 --- a/es-app/src/guis/GuiScraperSearch.cpp +++ b/es-app/src/guis/GuiScraperSearch.cpp @@ -966,9 +966,10 @@ bool GuiScraperSearch::saveMetadata(const ScraperSearchResult& result, if (key == "rating" && !Settings::getInstance()->getBool("ScrapeRatings")) continue; - // Skip saving of controller metadata if the corresponding option has been set to false. - if (key == "controller" && !Settings::getInstance()->getBool("ScrapeControllers")) - continue; + // ScreenScraper controller scraping is currently broken, it's unclear if they will fix it. + // // Skip saving of controller metadata if the corresponding option has been set to false. + // if (key == "controller" && !Settings::getInstance()->getBool("ScrapeControllers")) + // continue; // Skip saving of game name if the corresponding option has been set to false. if (key == "name" && !Settings::getInstance()->getBool("ScrapeGameNames")) diff --git a/es-app/src/scrapers/ScreenScraper.cpp b/es-app/src/scrapers/ScreenScraper.cpp index 2d9db925e..0c47b6c2f 100644 --- a/es-app/src/scrapers/ScreenScraper.cpp +++ b/es-app/src/scrapers/ScreenScraper.cpp @@ -471,93 +471,97 @@ void ScreenScraperRequest::processGame(const pugi::xml_document& xmldoc, if (result.platformIDs.empty()) result.platformIDs.push_back(PlatformId::PLATFORM_UNKNOWN); - // Controller (only for the Arcade and SNK Neo Geo systems). - if (parentPlatformID == 75 || parentPlatformID == 142) { - std::string controller = Utils::String::toLower(game.child("controles").text().get()); - if (!controller.empty()) { - std::string controllerDescription = "Other"; - // Place the steering wheel entry first as some games support both joysticks and - // and steering wheels and it's likely more interesting to capture the steering - // wheel option in this case. - if (controller.find("steering wheel") != std::string::npos || - controller.find("paddle") != std::string::npos || - controller.find("pedal") != std::string::npos) { - result.mdl.set("controller", "steering_wheel_generic"); - controllerDescription = "Steering wheel"; - } - else if (controller.find("control type=\"joy") != std::string::npos || - controller.find("joystick") != std::string::npos) { - std::string buttonEntry; - std::string buttonCount; - if (controller.find("p1numbuttons=") != std::string::npos) - buttonEntry = controller.substr(controller.find("p1numbuttons=") + 13, 4); - else if (controller.find("buttons=") != std::string::npos) - buttonEntry = controller.substr(controller.find("buttons=") + 8, 5); - - bool foundDigit = false; - for (unsigned char character : buttonEntry) { - if (std::isdigit(character)) { - buttonCount.push_back(character); - foundDigit = true; - } - else if (foundDigit == true) { - break; - } - } - - if (buttonCount == "0") { - result.mdl.set("controller", "joystick_arcade_no_buttons"); - controllerDescription = "Joystick (no buttons)"; - } - else if (buttonCount == "1") { - result.mdl.set("controller", "joystick_arcade_1_button"); - controllerDescription = "Joystick (1 button)"; - } - else if (buttonCount == "2") { - result.mdl.set("controller", "joystick_arcade_2_buttons"); - controllerDescription = "Joystick (2 buttons)"; - } - else if (buttonCount == "3") { - result.mdl.set("controller", "joystick_arcade_3_buttons"); - controllerDescription = "Joystick (3 buttons)"; - } - else if (buttonCount == "4") { - result.mdl.set("controller", "joystick_arcade_4_buttons"); - controllerDescription = "Joystick (4 buttons)"; - } - else if (buttonCount == "5") { - result.mdl.set("controller", "joystick_arcade_5_buttons"); - controllerDescription = "Joystick (5 buttons)"; - } - else if (buttonCount == "6") { - result.mdl.set("controller", "joystick_arcade_6_buttons"); - controllerDescription = "Joystick (6 buttons)"; - } - else { - controllerDescription = "Joystick (other)"; - } - } - else if (controller.find("spinner") != std::string::npos) { - result.mdl.set("controller", "spinner_generic"); - controllerDescription = "Spinner"; - } - else if (controller.find("trackball") != std::string::npos) { - result.mdl.set("controller", "trackball_generic"); - controllerDescription = "Trackball"; - } - else if (controller.find("gun") != std::string::npos) { - result.mdl.set("controller", "lightgun_generic"); - controllerDescription = "Lightgun"; - } - else if (controller.find("stick") != std::string::npos) { - result.mdl.set("controller", "flight_stick_generic"); - controllerDescription = "Flight stick"; - } - - LOG(LogDebug) << "ScreenScraperRequest::processGame(): Controller: " - << controllerDescription; - } - } + // ScreenScraper controller scraping is currently broken, it's unclear if they will fix it. + // // Controller (only for the Arcade and SNK Neo Geo systems). + // if (parentPlatformID == 75 || parentPlatformID == 142) { + // std::string controller {Utils::String::toLower(game.child("controles").text().get())}; + // + // LOG(LogError) << controller; + // + // if (!controller.empty()) { + // std::string controllerDescription = "Other"; + // // Place the steering wheel entry first as some games support both joysticks and + // // and steering wheels and it's likely more interesting to capture the steering + // // wheel option in this case. + // if (controller.find("steering wheel") != std::string::npos || + // controller.find("paddle") != std::string::npos || + // controller.find("pedal") != std::string::npos) { + // result.mdl.set("controller", "steering_wheel_generic"); + // controllerDescription = "Steering wheel"; + // } + // else if (controller.find("control type=\"joy") != std::string::npos || + // controller.find("joystick") != std::string::npos) { + // std::string buttonEntry; + // std::string buttonCount; + // if (controller.find("p1numbuttons=") != std::string::npos) + // buttonEntry = controller.substr(controller.find("p1numbuttons=") + 13, 4); + // else if (controller.find("buttons=") != std::string::npos) + // buttonEntry = controller.substr(controller.find("buttons=") + 8, 5); + // + // bool foundDigit = false; + // for (unsigned char character : buttonEntry) { + // if (std::isdigit(character)) { + // buttonCount.push_back(character); + // foundDigit = true; + // } + // else if (foundDigit == true) { + // break; + // } + // } + // + // if (buttonCount == "0") { + // result.mdl.set("controller", "joystick_arcade_no_buttons"); + // controllerDescription = "Joystick (no buttons)"; + // } + // else if (buttonCount == "1") { + // result.mdl.set("controller", "joystick_arcade_1_button"); + // controllerDescription = "Joystick (1 button)"; + // } + // else if (buttonCount == "2") { + // result.mdl.set("controller", "joystick_arcade_2_buttons"); + // controllerDescription = "Joystick (2 buttons)"; + // } + // else if (buttonCount == "3") { + // result.mdl.set("controller", "joystick_arcade_3_buttons"); + // controllerDescription = "Joystick (3 buttons)"; + // } + // else if (buttonCount == "4") { + // result.mdl.set("controller", "joystick_arcade_4_buttons"); + // controllerDescription = "Joystick (4 buttons)"; + // } + // else if (buttonCount == "5") { + // result.mdl.set("controller", "joystick_arcade_5_buttons"); + // controllerDescription = "Joystick (5 buttons)"; + // } + // else if (buttonCount == "6") { + // result.mdl.set("controller", "joystick_arcade_6_buttons"); + // controllerDescription = "Joystick (6 buttons)"; + // } + // else { + // controllerDescription = "Joystick (other)"; + // } + // } + // else if (controller.find("spinner") != std::string::npos) { + // result.mdl.set("controller", "spinner_generic"); + // controllerDescription = "Spinner"; + // } + // else if (controller.find("trackball") != std::string::npos) { + // result.mdl.set("controller", "trackball_generic"); + // controllerDescription = "Trackball"; + // } + // else if (controller.find("gun") != std::string::npos) { + // result.mdl.set("controller", "lightgun_generic"); + // controllerDescription = "Lightgun"; + // } + // else if (controller.find("stick") != std::string::npos) { + // result.mdl.set("controller", "flight_stick_generic"); + // controllerDescription = "Flight stick"; + // } + // + // LOG(LogDebug) << "ScreenScraperRequest::processGame(): Controller: " + // << controllerDescription; + // } + // } // Media super-node. pugi::xml_node media_list = game.child("medias"); diff --git a/es-core/src/Settings.cpp b/es-core/src/Settings.cpp index e05797cde..9c0cd2e68 100644 --- a/es-core/src/Settings.cpp +++ b/es-core/src/Settings.cpp @@ -88,7 +88,8 @@ void Settings::setDefaults() mBoolMap["ScrapeGameNames"] = {true, true}; mBoolMap["ScrapeRatings"] = {true, true}; - mBoolMap["ScrapeControllers"] = {true, true}; + // ScreenScraper controller scraping is currently broken, it's unclear if they will fix it. + // mBoolMap["ScrapeControllers"] = {true, true}; mBoolMap["ScrapeMetadata"] = {true, true}; mBoolMap["ScrapeVideos"] = {true, true}; mBoolMap["ScrapeScreenshots"] = {true, true};