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);
}
// Scrape controllers (arcade systems only).
auto scrapeControllers = std::make_shared<SwitchComponent>();
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<SwitchComponent>();
// 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<SwitchComponent>();
@ -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;

View file

@ -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"))

View file

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

View file

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