Made ScreenScraper searches in automatic mode faster and more accurate.

This commit is contained in:
Leon Styhre 2022-04-05 17:48:47 +02:00
parent 90f3f6cb07
commit aed9c4abe5
5 changed files with 16 additions and 4 deletions

View file

@ -314,7 +314,7 @@ void GuiScraperSearch::updateViewStyle()
} }
} }
void GuiScraperSearch::search(const ScraperSearchParams& params) void GuiScraperSearch::search(ScraperSearchParams& params)
{ {
mBlockAccept = true; mBlockAccept = true;
mAcceptedResult = false; mAcceptedResult = false;
@ -330,6 +330,15 @@ void GuiScraperSearch::search(const ScraperSearchParams& params)
mMDResolveHandle.reset(); mMDResolveHandle.reset();
updateInfoPane(); updateInfoPane();
// For ScreenScraper we always want to use the jeuInfos (single-game) API call when in
// automatic mode as this scraper service is not sorting the multi-search results based
// on most relevant result (as TheGamesDB does). Using jeuInfos is also much faster than
// using the jeuRecherche API call (multi-game search).
if (mSearchType == ALWAYS_ACCEPT_FIRST_RESULT)
params.automaticMode = true;
else
params.automaticMode = false;
mLastSearch = params; mLastSearch = params;
mSearchHandle = startScraperSearch(params); mSearchHandle = startScraperSearch(params);
} }

View file

@ -45,7 +45,7 @@ public:
GuiScraperSearch(SearchType searchType, unsigned int scrapeCount = 1); GuiScraperSearch(SearchType searchType, unsigned int scrapeCount = 1);
~GuiScraperSearch(); ~GuiScraperSearch();
void search(const ScraperSearchParams& params); void search(ScraperSearchParams& params);
void openInputScreen(ScraperSearchParams& from); void openInputScreen(ScraperSearchParams& from);
void stop(); void stop();
int getScraperResultsSize() { return static_cast<int>(mScraperResults.size()); } int getScraperResultsSize() { return static_cast<int>(mScraperResults.size()); }

View file

@ -38,6 +38,7 @@ struct ScraperSearchParams {
FileData* game; FileData* game;
std::string nameOverride; std::string nameOverride;
bool automaticMode;
}; };
struct ScraperSearchResult { struct ScraperSearchResult {

View file

@ -172,9 +172,10 @@ void screenscraper_generate_scraper_requests(const ScraperSearchParams& params,
std::vector<ScraperSearchResult>& results) std::vector<ScraperSearchResult>& results)
{ {
std::string path; std::string path;
ScreenScraperRequest::ScreenScraperConfig ssConfig; ScreenScraperRequest::ScreenScraperConfig ssConfig;
ssConfig.automaticMode = params.automaticMode;
if (params.game->isArcadeGame()) if (params.game->isArcadeGame())
ssConfig.isArcadeSystem = true; ssConfig.isArcadeSystem = true;
else else
@ -743,7 +744,7 @@ std::string ScreenScraperRequest::ScreenScraperConfig::getGameSearchUrl(
singleSearch = true; singleSearch = true;
} }
if (singleSearch) { if (automaticMode || singleSearch) {
screenScraperURL = API_URL_BASE + "/jeuInfos.php?devid=" + screenScraperURL = API_URL_BASE + "/jeuInfos.php?devid=" +
Utils::String::scramble(API_DEV_U, API_DEV_KEY) + Utils::String::scramble(API_DEV_U, API_DEV_KEY) +
"&devpassword=" + Utils::String::scramble(API_DEV_P, API_DEV_KEY) + "&devpassword=" + Utils::String::scramble(API_DEV_P, API_DEV_KEY) +

View file

@ -82,6 +82,7 @@ public:
std::string media_video = "video"; std::string media_video = "video";
bool isArcadeSystem; bool isArcadeSystem;
bool automaticMode;
// Which Region to use when selecting the artwork. // Which Region to use when selecting the artwork.
// Applies to: artwork, name of the game, date of release. // Applies to: artwork, name of the game, date of release.