mirror of
https://github.com/Sude-/lgogdownloader.git
synced 2024-11-20 11:49:17 +01:00
Remove the ugly hack to get details for Linux installers
GOG fixed API response for Linux installers
This commit is contained in:
parent
5b879190fe
commit
01d8479d18
@ -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);
|
||||
|
30
src/api.cpp
30
src/api.cpp
@ -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(),
|
||||
|
Loading…
Reference in New Issue
Block a user