diff --git a/es-app/src/scrapers/GamesDBJSONScraper.cpp b/es-app/src/scrapers/GamesDBJSONScraper.cpp index 00ecf3bde..3a2c6d943 100644 --- a/es-app/src/scrapers/GamesDBJSONScraper.cpp +++ b/es-app/src/scrapers/GamesDBJSONScraper.cpp @@ -356,11 +356,13 @@ namespace void processGame(const Value& game, std::vector& results) { ScraperSearchResult result; + std::string platformID; // Platform IDs. if (game.HasMember("platform") && game["platform"].IsInt()) { + platformID = std::to_string(game["platform"].GetInt()); for (auto& platform : gamesdb_new_platformid_map) { - if (platform.second == std::to_string(game["platform"].GetInt())) + if (platform.second == platformID) result.platformIDs.push_back(platform.first); } } @@ -374,6 +376,9 @@ namespace result.mdl.set("name", getStringOrThrow(game, "game_title")); LOG(LogDebug) << "GamesDBJSONScraper::processGame(): Name: " << result.mdl.get("name"); + LOG(LogDebug) << "GamesDBJSONScraper::processGame(): Game ID: " << result.gameID; + LOG(LogDebug) << "GamesDBJSONScraper::processGame(): Platform ID: " << platformID; + if (game.HasMember("overview") && game["overview"].IsString()) result.mdl.set("desc", Utils::String::replace(game["overview"].GetString(), "\r", "")); diff --git a/es-app/src/scrapers/ScreenScraper.cpp b/es-app/src/scrapers/ScreenScraper.cpp index ab935e0e9..f0ca6e1d4 100644 --- a/es-app/src/scrapers/ScreenScraper.cpp +++ b/es-app/src/scrapers/ScreenScraper.cpp @@ -293,7 +293,7 @@ void ScreenScraperRequest::process(const std::unique_ptr& req, for (auto it = results.cbegin(); it != results.cend();) { const std::string gameName {Utils::String::toUpper((*it).mdl.get("name"))}; if (gameName.substr(0, 12) == "ZZZ(NOTGAME)") { - LOG(LogWarning) << "ScreenScraperRequest - Received \"ZZZ(notgame)\" as game name, " + LOG(LogWarning) << "ScreenScraperRequest: Received \"ZZZ(notgame)\" as game name, " "ignoring response"; it = results.erase(it); } @@ -375,6 +375,23 @@ void ScreenScraperRequest::processGame(const pugi::xml_document& xmldoc, LOG(LogDebug) << "ScreenScraperRequest::processGame(): Game ID: " << result.gameID; + pugi::xml_node system {game.child("systeme")}; + int platformID {system.attribute("id").as_int()}; + int parentPlatformID {system.attribute("parentid").as_int()}; + + // Platform IDs. + for (auto& platform : screenscraper_platformid_map) { + if (platform.second == platformID || platform.second == parentPlatformID) + result.platformIDs.emplace_back(platform.first); + } + + if (result.platformIDs.empty()) + result.platformIDs.emplace_back(PlatformId::PLATFORM_UNKNOWN); + + LOG(LogDebug) << "ScreenScraperRequest::processGame(): Platform ID: " << platformID; + LOG(LogDebug) << "ScreenScraperRequest::processGame(): Parent platform ID: " + << parentPlatformID; + // Validate rating. // Process the rating even if the setting to scrape ratings has been disabled. // This is required so that the rating can still be shown in the scraper GUI. @@ -464,19 +481,6 @@ void ScreenScraperRequest::processGame(const pugi::xml_document& xmldoc, << result.mdl.get("players"); } - pugi::xml_node system {game.child("systeme")}; - int platformID {system.attribute("id").as_int()}; - int parentPlatformID {system.attribute("parentid").as_int()}; - - // Platform IDs. - for (auto& platform : screenscraper_platformid_map) { - if (platform.second == platformID || platform.second == parentPlatformID) - result.platformIDs.emplace_back(platform.first); - } - - if (result.platformIDs.empty()) - result.platformIDs.emplace_back(PlatformId::PLATFORM_UNKNOWN); - // 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) { @@ -709,9 +713,18 @@ std::string ScreenScraperRequest::ScreenScraperConfig::getGameSearchUrl(const st { if (md5Hash != "") { LOG(LogDebug) - << "ScreenScraper::getGameSearchUrl(): Performing MD5 file hash search using digest \"" + << "ScreenScraperRequest::getGameSearchUrl(): Performing MD5 file hash search " + "using digest \"" << md5Hash << "\""; } + else if (md5Hash == "" && Settings::getInstance()->getBool("ScraperSearchFileHash") && + fileSize > + Settings::getInstance()->getInt("ScraperSearchFileHashMaxSize") * 1024 * 1024) { + LOG(LogDebug) + << "ScreenScraperRequest::getGameSearchUrl(): Skipping MD5 file hash search as game " + "file is larger than size limit of " + << Settings::getInstance()->getInt("ScraperSearchFileHashMaxSize") << " MiB"; + } std::string searchName {gameName}; bool singleSearch {false};