From 8ed179291399fd9e2376f736bfaf779d4df2fd05 Mon Sep 17 00:00:00 2001 From: zefie Date: Mon, 22 May 2017 14:58:30 -0400 Subject: [PATCH] add support to search for specific game id using id:### --- es-app/src/scrapers/GamesDBScraper.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/es-app/src/scrapers/GamesDBScraper.cpp b/es-app/src/scrapers/GamesDBScraper.cpp index d39dc9f39..d330bf6c7 100644 --- a/es-app/src/scrapers/GamesDBScraper.cpp +++ b/es-app/src/scrapers/GamesDBScraper.cpp @@ -69,6 +69,7 @@ void thegamesdb_generate_scraper_requests(const ScraperSearchParams& params, std std::vector& results) { std::string path = "thegamesdb.net/api/GetGame.php?"; + bool usingGameID = false; std::string cleanName = params.nameOverride; if (cleanName.empty()) @@ -78,10 +79,17 @@ void thegamesdb_generate_scraper_requests(const ScraperSearchParams& params, std } else { - path += "exactname=" + HttpReq::urlEncode(cleanName); + if (cleanName.substr(0,3) == "id:") { + std::string gameID = cleanName.substr(3,-1); + path += "id=" + HttpReq::urlEncode(gameID); + usingGameID = true; + } + else { + path += "exactname=" + HttpReq::urlEncode(cleanName); + } } - if(params.system->getPlatformIds().empty()) + if(params.system->getPlatformIds().empty() || usingGameID) { // no platform specified, we're done requests.push(std::unique_ptr(new TheGamesDBRequest(results, path)));