Remove the ugly hack to get details for Linux installers

GOG fixed API response for Linux installers
This commit is contained in:
Sude 2014-07-24 16:00:50 +03:00
parent 5b879190fe
commit 01d8479d18
2 changed files with 1 additions and 31 deletions

View File

@ -85,7 +85,7 @@ class API
std::string getResponseOAuth(const std::string& url);
int getUserDetails();
int getGames();
gameDetails getGameDetails(const std::string& game_name, const unsigned int& platform = GlobalConstants::PLATFORM_WINDOWS, const unsigned int& lang = GlobalConstants::LANGUAGE_EN, const bool& useDuplicateHandler = false);
gameDetails getGameDetails(const std::string& game_name, const unsigned int& platform = (GlobalConstants::PLATFORM_WINDOWS | GlobalConstants::PLATFORM_LINUX), const unsigned int& lang = GlobalConstants::LANGUAGE_EN, const bool& useDuplicateHandler = false);
std::string getInstallerLink(const std::string& game_name, const std::string& id);
std::string getExtraLink(const std::string& game_name, const std::string& id);
std::string getPatchLink(const std::string& game_name, const std::string& id);

View File

@ -286,24 +286,6 @@ gameDetails API::getGameDetails(const std::string& game_name, const unsigned int
game.title = root["game"]["title"].asString();
game.icon = root["game"]["icon"].asString();
// FIXME: Replace this ugly hack when GOG makes the API responses for Linux better
bool bIsLinux = false;
bool bIsMac = false;
if (type & (GlobalConstants::PLATFORM_LINUX | GlobalConstants::PLATFORM_MAC) )
{
if (type & GlobalConstants::PLATFORM_LINUX)
bIsLinux = true;
else
bIsLinux = false;
if (type & GlobalConstants::PLATFORM_MAC)
bIsMac = true;
else
bIsMac = false;
type |= GlobalConstants::PLATFORM_MAC; // For some reason Linux installers are under Mac installer node so add Mac to installer type
}
// Installer details
// Create a list of installers from JSON
std::vector<std::pair<Json::Value,unsigned int>> installers;
@ -348,18 +330,6 @@ gameDetails API::getGameDetails(const std::string& game_name, const unsigned int
continue;
}
// FIXME: Replace this ugly hack when GOG makes the API responses for Linux better
if (bIsLinux && !bIsMac)
{
if (installer["link"].asString().find("/mac/") != std::string::npos)
continue;
}
if (!bIsLinux && bIsMac)
{
if (installer["link"].asString().find("/linux/") != std::string::npos)
continue;
}
game.installers.push_back(
gameFile( installer["notificated"].isInt() ? installer["notificated"].asInt() : std::stoi(installer["notificated"].asString()),
installer["id"].isInt() ? std::to_string(installer["id"].asInt()) : installer["id"].asString(),