mirror of
https://github.com/Sude-/lgogdownloader.git
synced 2025-02-02 05:52:31 +01:00
Make --list able to list tags
Removed --list-tags option Also changed the default option name "no_details" to "games"
This commit is contained in:
parent
9d188e73bd
commit
20cce5abbb
@ -253,7 +253,6 @@ class Config
|
|||||||
#ifdef USE_QT_GUI_LOGIN
|
#ifdef USE_QT_GUI_LOGIN
|
||||||
bool bEnableLoginGUI;
|
bool bEnableLoginGUI;
|
||||||
#endif
|
#endif
|
||||||
bool bListTags;
|
|
||||||
|
|
||||||
// Cache
|
// Cache
|
||||||
bool bUseCache;
|
bool bUseCache;
|
||||||
|
@ -96,7 +96,6 @@ class Downloader
|
|||||||
int init();
|
int init();
|
||||||
int login();
|
int login();
|
||||||
int listGames();
|
int listGames();
|
||||||
int listTags();
|
|
||||||
void checkNotifications();
|
void checkNotifications();
|
||||||
void clearUpdateNotifications();
|
void clearUpdateNotifications();
|
||||||
void repair();
|
void repair();
|
||||||
|
@ -118,15 +118,17 @@ namespace GlobalConstants
|
|||||||
{ CDN_AKAMAI, "akamai_edgecast_proxy", "Akamai", "akamai|akamai_cdn|akamai_ec|akamai_edgecast_proxy" }
|
{ CDN_AKAMAI, "akamai_edgecast_proxy", "Akamai", "akamai|akamai_cdn|akamai_ec|akamai_edgecast_proxy" }
|
||||||
};
|
};
|
||||||
|
|
||||||
const unsigned int LIST_FORMAT_NO_DETAILS = 1 << 0;
|
const unsigned int LIST_FORMAT_GAMES = 1 << 0;
|
||||||
const unsigned int LIST_FORMAT_DETAILS_TEXT = 1 << 1;
|
const unsigned int LIST_FORMAT_DETAILS_TEXT = 1 << 1;
|
||||||
const unsigned int LIST_FORMAT_DETAILS_JSON = 1 << 2;
|
const unsigned int LIST_FORMAT_DETAILS_JSON = 1 << 2;
|
||||||
|
const unsigned int LIST_FORMAT_TAGS = 1 << 3;
|
||||||
|
|
||||||
const std::vector<optionsStruct> LIST_FORMAT =
|
const std::vector<optionsStruct> LIST_FORMAT =
|
||||||
{
|
{
|
||||||
{ LIST_FORMAT_NO_DETAILS, "no_details", "No details", "n|nd|no_details" },
|
{ LIST_FORMAT_GAMES, "games", "Games", "g|games" },
|
||||||
{ LIST_FORMAT_DETAILS_TEXT, "details", "Details", "d|details" },
|
{ LIST_FORMAT_DETAILS_TEXT, "details", "Details", "d|details" },
|
||||||
{ LIST_FORMAT_DETAILS_JSON, "json", "JSON", "j|json" }
|
{ LIST_FORMAT_DETAILS_JSON, "json", "JSON", "j|json" },
|
||||||
|
{ LIST_FORMAT_TAGS, "tags", "Tags", "t|tags" }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
9
main.cpp
9
main.cpp
@ -162,7 +162,7 @@ int main(int argc, char *argv[])
|
|||||||
include_options_text += "Separate with \",\" to use multiple values";
|
include_options_text += "Separate with \",\" to use multiple values";
|
||||||
|
|
||||||
// Create help text for --list-format option
|
// Create help text for --list-format option
|
||||||
std::string list_format_text = "List games\nPossible output formats:\n";
|
std::string list_format_text = "List games/tags\n";
|
||||||
for (unsigned int i = 0; i < GlobalConstants::LIST_FORMAT.size(); ++i)
|
for (unsigned int i = 0; i < GlobalConstants::LIST_FORMAT.size(); ++i)
|
||||||
{
|
{
|
||||||
list_format_text += GlobalConstants::LIST_FORMAT[i].str + " = " + GlobalConstants::LIST_FORMAT[i].regexp + "\n";
|
list_format_text += GlobalConstants::LIST_FORMAT[i].str + " = " + GlobalConstants::LIST_FORMAT[i].regexp + "\n";
|
||||||
@ -217,7 +217,7 @@ int main(int argc, char *argv[])
|
|||||||
("help,h", "Print help message")
|
("help,h", "Print help message")
|
||||||
("version", "Print version information")
|
("version", "Print version information")
|
||||||
("login", bpo::value<bool>(&Globals::globalConfig.bLogin)->zero_tokens()->default_value(false), "Login")
|
("login", bpo::value<bool>(&Globals::globalConfig.bLogin)->zero_tokens()->default_value(false), "Login")
|
||||||
("list", bpo::value<std::string>(&sListFormat)->implicit_value("no_details"), list_format_text.c_str())
|
("list", bpo::value<std::string>(&sListFormat)->implicit_value("games"), list_format_text.c_str())
|
||||||
("download", bpo::value<bool>(&Globals::globalConfig.bDownload)->zero_tokens()->default_value(false), "Download")
|
("download", bpo::value<bool>(&Globals::globalConfig.bDownload)->zero_tokens()->default_value(false), "Download")
|
||||||
("repair", bpo::value<bool>(&Globals::globalConfig.bRepair)->zero_tokens()->default_value(false), "Repair downloaded files\nUse --repair --download to redownload files when filesizes don't match (possibly different version). Redownload will rename the old file (appends .old to filename)")
|
("repair", bpo::value<bool>(&Globals::globalConfig.bRepair)->zero_tokens()->default_value(false), "Repair downloaded files\nUse --repair --download to redownload files when filesizes don't match (possibly different version). Redownload will rename the old file (appends .old to filename)")
|
||||||
("game", bpo::value<std::string>(&Globals::globalConfig.sGameRegex)->default_value(""), "Set regular expression filter\nfor download/list/repair (Perl syntax)")
|
("game", bpo::value<std::string>(&Globals::globalConfig.sGameRegex)->default_value(""), "Set regular expression filter\nfor download/list/repair (Perl syntax)")
|
||||||
@ -246,7 +246,6 @@ int main(int argc, char *argv[])
|
|||||||
#ifdef USE_QT_GUI_LOGIN
|
#ifdef USE_QT_GUI_LOGIN
|
||||||
("enable-login-gui", bpo::value<bool>(&Globals::globalConfig.bEnableLoginGUI)->zero_tokens()->default_value(false), "Enable login GUI when encountering reCAPTCHA on login form")
|
("enable-login-gui", bpo::value<bool>(&Globals::globalConfig.bEnableLoginGUI)->zero_tokens()->default_value(false), "Enable login GUI when encountering reCAPTCHA on login form")
|
||||||
#endif
|
#endif
|
||||||
("list-tags", bpo::value<bool>(&Globals::globalConfig.bListTags)->zero_tokens()->default_value(false), "List tags")
|
|
||||||
("tag", bpo::value<std::string>(&tags)->default_value(""), "Filter using tags. Separate with \",\" to use multiple values")
|
("tag", bpo::value<std::string>(&tags)->default_value(""), "Filter using tags. Separate with \",\" to use multiple values")
|
||||||
;
|
;
|
||||||
// Commandline options (config file)
|
// Commandline options (config file)
|
||||||
@ -795,10 +794,8 @@ int main(int argc, char *argv[])
|
|||||||
downloader.repair();
|
downloader.repair();
|
||||||
else if (Globals::globalConfig.bDownload) // Download games
|
else if (Globals::globalConfig.bDownload) // Download games
|
||||||
downloader.download();
|
downloader.download();
|
||||||
else if (bList) // List games/extras
|
else if (bList) // List games/extras/tags
|
||||||
res = downloader.listGames();
|
res = downloader.listGames();
|
||||||
else if (Globals::globalConfig.bListTags) // List tags
|
|
||||||
res = downloader.listTags();
|
|
||||||
else if (!Globals::globalConfig.sOrphanRegex.empty()) // Check for orphaned files if regex for orphans is set
|
else if (!Globals::globalConfig.sOrphanRegex.empty()) // Check for orphaned files if regex for orphans is set
|
||||||
downloader.checkOrphans();
|
downloader.checkOrphans();
|
||||||
else if (Globals::globalConfig.bCheckStatus)
|
else if (Globals::globalConfig.bCheckStatus)
|
||||||
|
@ -525,7 +525,7 @@ int Downloader::getGameDetails()
|
|||||||
|
|
||||||
int Downloader::listGames()
|
int Downloader::listGames()
|
||||||
{
|
{
|
||||||
if (Globals::globalConfig.iListFormat == GlobalConstants::LIST_FORMAT_NO_DETAILS)
|
if (Globals::globalConfig.iListFormat == GlobalConstants::LIST_FORMAT_GAMES)
|
||||||
{
|
{
|
||||||
if (gameItems.empty())
|
if (gameItems.empty())
|
||||||
this->getGameList();
|
this->getGameList();
|
||||||
@ -544,6 +544,19 @@ int Downloader::listGames()
|
|||||||
std::cout << "+> " << gameItems[i].dlcnames[j] << std::endl;
|
std::cout << "+> " << gameItems[i].dlcnames[j] << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (Globals::globalConfig.iListFormat == GlobalConstants::LIST_FORMAT_TAGS)
|
||||||
|
{
|
||||||
|
std::map<std::string, std::string> tags;
|
||||||
|
tags = gogWebsite->getTags();
|
||||||
|
|
||||||
|
if (!tags.empty())
|
||||||
|
{
|
||||||
|
for (auto tag : tags)
|
||||||
|
{
|
||||||
|
std::cout << tag.first << " = " << tag.second << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (this->games.empty()) {
|
if (this->games.empty()) {
|
||||||
@ -570,22 +583,6 @@ int Downloader::listGames()
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Downloader::listTags()
|
|
||||||
{
|
|
||||||
std::map<std::string, std::string> tags;
|
|
||||||
tags = gogWebsite->getTags();
|
|
||||||
|
|
||||||
if (!tags.empty())
|
|
||||||
{
|
|
||||||
for (auto tag : tags)
|
|
||||||
{
|
|
||||||
std::cout << tag.first << " = " << tag.second << std::endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Downloader::repair()
|
void Downloader::repair()
|
||||||
{
|
{
|
||||||
if (this->games.empty())
|
if (this->games.empty())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user