This commit is contained in:
Sude 2023-10-12 18:01:39 +03:00
commit 7689a719b3
4 changed files with 14 additions and 1 deletions

View File

@ -235,6 +235,7 @@ class Config
bool bDownload; bool bDownload;
bool bRepair; bool bRepair;
bool bUpdated; bool bUpdated;
bool bNew;
bool bCheckStatus; bool bCheckStatus;
bool bShowWishlist; bool bShowWishlist;
bool bNotifications; bool bNotifications;

View File

@ -208,6 +208,7 @@ int main(int argc, char *argv[])
("create-xml", bpo::value<std::string>(&Globals::globalConfig.sXMLFile)->implicit_value("automatic"), "Create GOG XML for file\n\"automatic\" to enable automatic XML creation") ("create-xml", bpo::value<std::string>(&Globals::globalConfig.sXMLFile)->implicit_value("automatic"), "Create GOG XML for file\n\"automatic\" to enable automatic XML creation")
("notifications", bpo::value<bool>(&Globals::globalConfig.bNotifications)->zero_tokens()->default_value(false), "Check notifications") ("notifications", bpo::value<bool>(&Globals::globalConfig.bNotifications)->zero_tokens()->default_value(false), "Check notifications")
("updated", bpo::value<bool>(&Globals::globalConfig.bUpdated)->zero_tokens()->default_value(false), "List/download only games with update flag set") ("updated", bpo::value<bool>(&Globals::globalConfig.bUpdated)->zero_tokens()->default_value(false), "List/download only games with update flag set")
("new", bpo::value<bool>(&Globals::globalConfig.bNew)->zero_tokens()->default_value(false), "List/download only games with new flag set")
("clear-update-flags", bpo::value<bool>(&bClearUpdateNotifications)->zero_tokens()->default_value(false), "Clear update notification flags") ("clear-update-flags", bpo::value<bool>(&bClearUpdateNotifications)->zero_tokens()->default_value(false), "Clear update notification flags")
("check-orphans", bpo::value<std::string>(&Globals::globalConfig.sOrphanRegex)->implicit_value(""), check_orphans_text.c_str()) ("check-orphans", bpo::value<std::string>(&Globals::globalConfig.sOrphanRegex)->implicit_value(""), check_orphans_text.c_str())
("status", bpo::value<bool>(&Globals::globalConfig.bCheckStatus)->zero_tokens()->default_value(false), "Show status of files\n\nOutput format:\nstatuscode gamename filename filesize filehash\n\nStatus codes:\nOK - File is OK\nND - File is not downloaded\nMD5 - MD5 mismatch, different version\nFS - File size mismatch, incomplete download\n\nSee also --no-fast-status-check option") ("status", bpo::value<bool>(&Globals::globalConfig.bCheckStatus)->zero_tokens()->default_value(false), "Show status of files\n\nOutput format:\nstatuscode gamename filename filesize filehash\n\nStatus codes:\nOK - File is OK\nND - File is not downloaded\nMD5 - MD5 mismatch, different version\nFS - File size mismatch, incomplete download\n\nSee also --no-fast-status-check option")

View File

@ -533,8 +533,14 @@ int Downloader::listGames()
if (gameItems[i].updates > 0) if (gameItems[i].updates > 0)
{ {
gamename += " [" + std::to_string(gameItems[i].updates) + "]"; gamename += " [" + std::to_string(gameItems[i].updates) + "]";
std::string color = gameItems[i].isnew ? "01;34" : "32";
if (Globals::globalConfig.bColor) if (Globals::globalConfig.bColor)
gamename = "\033[32m" + gamename + "\033[0m"; gamename = "\033[" + color + "m" + gamename + "\033[0m";
}
else
{
if (Globals::globalConfig.bColor && gameItems[i].isnew)
gamename = "\033[01;34m" + gamename + "\033[0m";
} }
std::cout << gamename << std::endl; std::cout << gamename << std::endl;
for (unsigned int j = 0; j < gameItems[i].dlcnames.size(); ++j) for (unsigned int j = 0; j < gameItems[i].dlcnames.size(); ++j)

View File

@ -141,6 +141,7 @@ std::vector<gameItem> Website::getGames()
gameItem game; gameItem game;
game.name = product["slug"].asString(); game.name = product["slug"].asString();
game.id = product["id"].isInt() ? std::to_string(product["id"].asInt()) : product["id"].asString(); game.id = product["id"].isInt() ? std::to_string(product["id"].asInt()) : product["id"].asString();
game.isnew = product["isNew"].asBool();
if (product.isMember("updates")) if (product.isMember("updates"))
{ {
@ -175,6 +176,10 @@ std::vector<gameItem> Website::getGames()
if (product["worksOn"]["Linux"].asBool()) if (product["worksOn"]["Linux"].asBool())
platform |= GlobalConstants::PLATFORM_LINUX; platform |= GlobalConstants::PLATFORM_LINUX;
// Skip if not new and flag is set
if (Globals::globalConfig.bNew && !game.isnew)
continue;
// Skip if platform doesn't match // Skip if platform doesn't match
if (Globals::globalConfig.bPlatformDetection && !(platform & Globals::globalConfig.dlConf.iInstallerPlatform)) if (Globals::globalConfig.bPlatformDetection && !(platform & Globals::globalConfig.dlConf.iInstallerPlatform))
continue; continue;