Merge pull request #139 from zefie/master

Add FDS to scraper, as well allow search by ID
This commit is contained in:
Jools Wills 2017-05-22 20:04:01 +01:00 committed by GitHub
commit d5b6201972
3 changed files with 13 additions and 2 deletions

View file

@ -35,6 +35,7 @@ namespace PlatformIds
"n3ds", // nintendo 3DS
"n64", // nintendo 64
"nds", // nintendo DS
"fds", // Famicom Disk System
"nes", // nintendo entertainment system
"gb", // game boy
"gba", // game boy advance

View file

@ -35,6 +35,7 @@ namespace PlatformIds
NINTENDO_3DS,
NINTENDO_64,
NINTENDO_DS,
FAMICOM_DISK_SYSTEM,
NINTENDO_ENTERTAINMENT_SYSTEM,
GAME_BOY,
GAME_BOY_ADVANCE,

View file

@ -35,6 +35,7 @@ const std::map<PlatformId, const char*> gamesdb_platformid_map = boost::assign::
(NINTENDO_3DS, "Nintendo 3DS")
(NINTENDO_64, "Nintendo 64")
(NINTENDO_DS, "Nintendo DS")
(FAMICOM_DISK_SYSTEM, "Famicom Disk System")
(NINTENDO_ENTERTAINMENT_SYSTEM, "Nintendo Entertainment System (NES)")
(GAME_BOY, "Nintendo Game Boy")
(GAME_BOY_ADVANCE, "Nintendo Game Boy Advance")
@ -68,6 +69,7 @@ void thegamesdb_generate_scraper_requests(const ScraperSearchParams& params, std
std::vector<ScraperSearchResult>& results)
{
std::string path = "thegamesdb.net/api/GetGame.php?";
bool usingGameID = false;
std::string cleanName = params.nameOverride;
if (cleanName.empty())
@ -77,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<ScraperRequest>(new TheGamesDBRequest(results, path)));