Disabled ScreenScraper controller scraping as they have ruined that functionality.

This commit is contained in:
Leon Styhre 2022-12-15 18:27:45 +01:00
parent ae6c062984
commit 6d4086639a
4 changed files with 124 additions and 116 deletions

View file

@ -252,27 +252,28 @@ void GuiScraperMenu::openContentOptions()
->setOpacity(DISABLED_OPACITY); ->setOpacity(DISABLED_OPACITY);
} }
// Scrape controllers (arcade systems only). // ScreenScraper controller scraping is currently broken, it's unclear if they will fix it.
auto scrapeControllers = std::make_shared<SwitchComponent>(); // // Scrape controllers (arcade systems only).
scrapeControllers->setState(Settings::getInstance()->getBool("ScrapeControllers")); // auto scrapeControllers = std::make_shared<SwitchComponent>();
s->addWithLabel("CONTROLLERS (ARCADE SYSTEMS ONLY)", scrapeControllers); // scrapeControllers->setState(Settings::getInstance()->getBool("ScrapeControllers"));
s->addSaveFunc([scrapeControllers, s] { // s->addWithLabel("CONTROLLERS (ARCADE SYSTEMS ONLY)", scrapeControllers);
if (scrapeControllers->getState() != // s->addSaveFunc([scrapeControllers, s] {
Settings::getInstance()->getBool("ScrapeControllers")) { // if (scrapeControllers->getState() !=
Settings::getInstance()->setBool("ScrapeControllers", scrapeControllers->getState()); // Settings::getInstance()->getBool("ScrapeControllers")) {
s->setNeedsSaving(); // Settings::getInstance()->setBool("ScrapeControllers", scrapeControllers->getState());
} // s->setNeedsSaving();
}); // }
// });
// Controllers are not supported by TheGamesDB, so gray out the option if this scraper is // // Controllers are not supported by TheGamesDB, so gray out the option if this scraper is
// selected. // // selected.
if (Settings::getInstance()->getString("Scraper") == "thegamesdb") { // if (Settings::getInstance()->getString("Scraper") == "thegamesdb") {
scrapeControllers->setEnabled(false); // scrapeControllers->setEnabled(false);
scrapeControllers->setOpacity(DISABLED_OPACITY); // scrapeControllers->setOpacity(DISABLED_OPACITY);
scrapeControllers->getParent() // scrapeControllers->getParent()
->getChild(scrapeControllers->getChildIndex() - 1) // ->getChild(scrapeControllers->getChildIndex() - 1)
->setOpacity(DISABLED_OPACITY); // ->setOpacity(DISABLED_OPACITY);
} // }
// Scrape other metadata. // Scrape other metadata.
auto scrapeMetadata = std::make_shared<SwitchComponent>(); auto scrapeMetadata = std::make_shared<SwitchComponent>();
@ -1059,11 +1060,12 @@ void GuiScraperMenu::start()
contentToScrape = true; contentToScrape = true;
break; break;
} }
if (scraperService == "screenscraper" && // ScreenScraper controller scraping is currently broken, it's unclear if they will fix it.
Settings::getInstance()->getBool("ScrapeControllers")) { // if (scraperService == "screenscraper" &&
contentToScrape = true; // Settings::getInstance()->getBool("ScrapeControllers")) {
break; // contentToScrape = true;
} // break;
// }
if (Settings::getInstance()->getBool("ScrapeMetadata")) { if (Settings::getInstance()->getBool("ScrapeMetadata")) {
contentToScrape = true; contentToScrape = true;
break; break;

View file

@ -966,9 +966,10 @@ bool GuiScraperSearch::saveMetadata(const ScraperSearchResult& result,
if (key == "rating" && !Settings::getInstance()->getBool("ScrapeRatings")) if (key == "rating" && !Settings::getInstance()->getBool("ScrapeRatings"))
continue; continue;
// Skip saving of controller metadata if the corresponding option has been set to false. // ScreenScraper controller scraping is currently broken, it's unclear if they will fix it.
if (key == "controller" && !Settings::getInstance()->getBool("ScrapeControllers")) // // Skip saving of controller metadata if the corresponding option has been set to false.
continue; // if (key == "controller" && !Settings::getInstance()->getBool("ScrapeControllers"))
// continue;
// Skip saving of game name if the corresponding option has been set to false. // Skip saving of game name if the corresponding option has been set to false.
if (key == "name" && !Settings::getInstance()->getBool("ScrapeGameNames")) if (key == "name" && !Settings::getInstance()->getBool("ScrapeGameNames"))

View file

@ -471,93 +471,97 @@ void ScreenScraperRequest::processGame(const pugi::xml_document& xmldoc,
if (result.platformIDs.empty()) if (result.platformIDs.empty())
result.platformIDs.push_back(PlatformId::PLATFORM_UNKNOWN); result.platformIDs.push_back(PlatformId::PLATFORM_UNKNOWN);
// Controller (only for the Arcade and SNK Neo Geo systems). // ScreenScraper controller scraping is currently broken, it's unclear if they will fix it.
if (parentPlatformID == 75 || parentPlatformID == 142) { // // Controller (only for the Arcade and SNK Neo Geo systems).
std::string controller = Utils::String::toLower(game.child("controles").text().get()); // if (parentPlatformID == 75 || parentPlatformID == 142) {
if (!controller.empty()) { // std::string controller {Utils::String::toLower(game.child("controles").text().get())};
std::string controllerDescription = "Other"; //
// Place the steering wheel entry first as some games support both joysticks and // LOG(LogError) << controller;
// and steering wheels and it's likely more interesting to capture the steering //
// wheel option in this case. // if (!controller.empty()) {
if (controller.find("steering wheel") != std::string::npos || // std::string controllerDescription = "Other";
controller.find("paddle") != std::string::npos || // // Place the steering wheel entry first as some games support both joysticks and
controller.find("pedal") != std::string::npos) { // // and steering wheels and it's likely more interesting to capture the steering
result.mdl.set("controller", "steering_wheel_generic"); // // wheel option in this case.
controllerDescription = "Steering wheel"; // if (controller.find("steering wheel") != std::string::npos ||
} // controller.find("paddle") != std::string::npos ||
else if (controller.find("control type=\"joy") != std::string::npos || // controller.find("pedal") != std::string::npos) {
controller.find("joystick") != std::string::npos) { // result.mdl.set("controller", "steering_wheel_generic");
std::string buttonEntry; // controllerDescription = "Steering wheel";
std::string buttonCount; // }
if (controller.find("p1numbuttons=") != std::string::npos) // else if (controller.find("control type=\"joy") != std::string::npos ||
buttonEntry = controller.substr(controller.find("p1numbuttons=") + 13, 4); // controller.find("joystick") != std::string::npos) {
else if (controller.find("buttons=") != std::string::npos) // std::string buttonEntry;
buttonEntry = controller.substr(controller.find("buttons=") + 8, 5); // std::string buttonCount;
// if (controller.find("p1numbuttons=") != std::string::npos)
bool foundDigit = false; // buttonEntry = controller.substr(controller.find("p1numbuttons=") + 13, 4);
for (unsigned char character : buttonEntry) { // else if (controller.find("buttons=") != std::string::npos)
if (std::isdigit(character)) { // buttonEntry = controller.substr(controller.find("buttons=") + 8, 5);
buttonCount.push_back(character); //
foundDigit = true; // bool foundDigit = false;
} // for (unsigned char character : buttonEntry) {
else if (foundDigit == true) { // if (std::isdigit(character)) {
break; // buttonCount.push_back(character);
} // foundDigit = true;
} // }
// else if (foundDigit == true) {
if (buttonCount == "0") { // break;
result.mdl.set("controller", "joystick_arcade_no_buttons"); // }
controllerDescription = "Joystick (no buttons)"; // }
} //
else if (buttonCount == "1") { // if (buttonCount == "0") {
result.mdl.set("controller", "joystick_arcade_1_button"); // result.mdl.set("controller", "joystick_arcade_no_buttons");
controllerDescription = "Joystick (1 button)"; // controllerDescription = "Joystick (no buttons)";
} // }
else if (buttonCount == "2") { // else if (buttonCount == "1") {
result.mdl.set("controller", "joystick_arcade_2_buttons"); // result.mdl.set("controller", "joystick_arcade_1_button");
controllerDescription = "Joystick (2 buttons)"; // controllerDescription = "Joystick (1 button)";
} // }
else if (buttonCount == "3") { // else if (buttonCount == "2") {
result.mdl.set("controller", "joystick_arcade_3_buttons"); // result.mdl.set("controller", "joystick_arcade_2_buttons");
controllerDescription = "Joystick (3 buttons)"; // controllerDescription = "Joystick (2 buttons)";
} // }
else if (buttonCount == "4") { // else if (buttonCount == "3") {
result.mdl.set("controller", "joystick_arcade_4_buttons"); // result.mdl.set("controller", "joystick_arcade_3_buttons");
controllerDescription = "Joystick (4 buttons)"; // controllerDescription = "Joystick (3 buttons)";
} // }
else if (buttonCount == "5") { // else if (buttonCount == "4") {
result.mdl.set("controller", "joystick_arcade_5_buttons"); // result.mdl.set("controller", "joystick_arcade_4_buttons");
controllerDescription = "Joystick (5 buttons)"; // controllerDescription = "Joystick (4 buttons)";
} // }
else if (buttonCount == "6") { // else if (buttonCount == "5") {
result.mdl.set("controller", "joystick_arcade_6_buttons"); // result.mdl.set("controller", "joystick_arcade_5_buttons");
controllerDescription = "Joystick (6 buttons)"; // controllerDescription = "Joystick (5 buttons)";
} // }
else { // else if (buttonCount == "6") {
controllerDescription = "Joystick (other)"; // result.mdl.set("controller", "joystick_arcade_6_buttons");
} // controllerDescription = "Joystick (6 buttons)";
} // }
else if (controller.find("spinner") != std::string::npos) { // else {
result.mdl.set("controller", "spinner_generic"); // controllerDescription = "Joystick (other)";
controllerDescription = "Spinner"; // }
} // }
else if (controller.find("trackball") != std::string::npos) { // else if (controller.find("spinner") != std::string::npos) {
result.mdl.set("controller", "trackball_generic"); // result.mdl.set("controller", "spinner_generic");
controllerDescription = "Trackball"; // controllerDescription = "Spinner";
} // }
else if (controller.find("gun") != std::string::npos) { // else if (controller.find("trackball") != std::string::npos) {
result.mdl.set("controller", "lightgun_generic"); // result.mdl.set("controller", "trackball_generic");
controllerDescription = "Lightgun"; // controllerDescription = "Trackball";
} // }
else if (controller.find("stick") != std::string::npos) { // else if (controller.find("gun") != std::string::npos) {
result.mdl.set("controller", "flight_stick_generic"); // result.mdl.set("controller", "lightgun_generic");
controllerDescription = "Flight stick"; // controllerDescription = "Lightgun";
} // }
// else if (controller.find("stick") != std::string::npos) {
LOG(LogDebug) << "ScreenScraperRequest::processGame(): Controller: " // result.mdl.set("controller", "flight_stick_generic");
<< controllerDescription; // controllerDescription = "Flight stick";
} // }
} //
// LOG(LogDebug) << "ScreenScraperRequest::processGame(): Controller: "
// << controllerDescription;
// }
// }
// Media super-node. // Media super-node.
pugi::xml_node media_list = game.child("medias"); pugi::xml_node media_list = game.child("medias");

View file

@ -88,7 +88,8 @@ void Settings::setDefaults()
mBoolMap["ScrapeGameNames"] = {true, true}; mBoolMap["ScrapeGameNames"] = {true, true};
mBoolMap["ScrapeRatings"] = {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["ScrapeMetadata"] = {true, true};
mBoolMap["ScrapeVideos"] = {true, true}; mBoolMap["ScrapeVideos"] = {true, true};
mBoolMap["ScrapeScreenshots"] = {true, true}; mBoolMap["ScrapeScreenshots"] = {true, true};