mirror of
https://github.com/Sude-/lgogdownloader.git
synced 2025-02-02 05:52:31 +01:00
add --save-icon option
This commit is contained in:
parent
8e07ba18e8
commit
d68a30bfb9
@ -47,6 +47,7 @@ struct DownloadConfig
|
||||
bool bSaveChangelogs;
|
||||
bool bSaveSerials;
|
||||
bool bSaveLogo;
|
||||
bool bSaveIcon;
|
||||
bool bAutomaticXMLCreation;
|
||||
bool bFreeSpaceCheck;
|
||||
|
||||
|
@ -37,6 +37,7 @@ class gameDetails
|
||||
void makeFilepaths(const DirectoryConfig& config);
|
||||
std::string getSerialsFilepath();
|
||||
std::string getLogoFilepath();
|
||||
std::string getIconFilepath();
|
||||
std::string getChangelogFilepath();
|
||||
Json::Value getDetailsAsJson();
|
||||
std::vector<gameFile> getGameFileVector();
|
||||
@ -49,6 +50,7 @@ class gameDetails
|
||||
private:
|
||||
std::string serialsFilepath;
|
||||
std::string logoFilepath;
|
||||
std::string iconFilepath;
|
||||
std::string changelogFilepath;
|
||||
};
|
||||
|
||||
|
1
main.cpp
1
main.cpp
@ -262,6 +262,7 @@ int main(int argc, char *argv[])
|
||||
("cache-valid", bpo::value<int>(&Globals::globalConfig.iCacheValid)->default_value(2880), ("Set how long cached game details are valid (in minutes)\nDefault: 2880 minutes (48 hours)"))
|
||||
("save-serials", bpo::value<bool>(&Globals::globalConfig.dlConf.bSaveSerials)->zero_tokens()->default_value(false), "Save serial numbers when downloading")
|
||||
("save-logo", bpo::value<bool>(&Globals::globalConfig.dlConf.bSaveLogo)->zero_tokens()->default_value(false), "Save logo when downloading")
|
||||
("save-icon", bpo::value<bool>(&Globals::globalConfig.dlConf.bSaveIcon)->zero_tokens()->default_value(false), "Save icon when downloading")
|
||||
("ignore-dlc-count", bpo::value<std::string>(&Globals::globalConfig.sIgnoreDLCCountRegex)->implicit_value(".*"), "Set regular expression filter for games to ignore DLC count information\nIgnoring DLC count information helps in situations where the account page doesn't provide accurate information about DLCs")
|
||||
("include", bpo::value<std::string>(&sIncludeOptions)->default_value("all"), ("Select what to download/list/repair\n" + include_options_text).c_str())
|
||||
("exclude", bpo::value<std::string>(&sExcludeOptions)->default_value(""), ("Select what not to download/list/repair\n" + include_options_text).c_str())
|
||||
|
@ -695,6 +695,12 @@ void Downloader::download()
|
||||
this->downloadFile(games[i].logo, filepath, "", games[i].gamename);
|
||||
}
|
||||
|
||||
if (conf.dlConf.bSaveIcon && !games[i].icon.empty())
|
||||
{
|
||||
std::string filepath = games[i].getIconFilepath();
|
||||
this->downloadFile(games[i].icon, filepath, "", games[i].gamename);
|
||||
}
|
||||
|
||||
if (conf.dlConf.bSaveChangelogs && !games[i].changelog.empty())
|
||||
{
|
||||
std::string filepath = games[i].getChangelogFilepath();
|
||||
@ -715,6 +721,11 @@ void Downloader::download()
|
||||
std::string filepath = games[i].dlcs[j].getLogoFilepath();
|
||||
this->downloadFile(games[i].dlcs[j].logo, filepath, "", games[i].dlcs[j].gamename);
|
||||
}
|
||||
if (conf.dlConf.bSaveIcon && !games[i].dlcs[j].icon.empty())
|
||||
{
|
||||
std::string filepath = games[i].dlcs[j].getIconFilepath();
|
||||
this->downloadFile(games[i].dlcs[j].icon, filepath, "", games[i].dlcs[j].gamename);
|
||||
}
|
||||
if (conf.dlConf.bSaveChangelogs && !games[i].dlcs[j].changelog.empty())
|
||||
{
|
||||
std::string filepath = games[i].dlcs[j].getChangelogFilepath();
|
||||
|
@ -83,12 +83,17 @@ void gameDetails::makeFilepaths(const DirectoryConfig& config)
|
||||
std::string directory = config.sDirectory + "/" + config.sGameSubdir + "/";
|
||||
std::string subdir;
|
||||
std::string logo_ext = ".jpg"; // Assume jpg
|
||||
std::string icon_ext = ".png"; // Assume png
|
||||
|
||||
if (this->logo.rfind(".") != std::string::npos)
|
||||
logo_ext = this->logo.substr(this->logo.rfind("."));
|
||||
|
||||
if (this->icon.rfind(".") != std::string::npos)
|
||||
icon_ext = this->icon.substr(this->icon.rfind("."));
|
||||
|
||||
this->serialsFilepath = Util::makeFilepath(directory, "serials.txt", this->gamename, subdir, 0);
|
||||
this->logoFilepath = Util::makeFilepath(directory, "logo" + logo_ext, this->gamename, subdir, 0);
|
||||
this->iconFilepath = Util::makeFilepath(directory, "icon" + icon_ext, this->gamename, subdir, 0);
|
||||
this->changelogFilepath = Util::makeFilepath(directory, "changelog_" + gamename + ".html", this->gamename, subdir, 0);
|
||||
|
||||
for (unsigned int i = 0; i < this->installers.size(); ++i)
|
||||
@ -124,6 +129,7 @@ void gameDetails::makeFilepaths(const DirectoryConfig& config)
|
||||
subdir = config.bSubDirectories ? config.sDLCSubdir + "/" + config.sInstallersSubdir : "";
|
||||
this->dlcs[i].serialsFilepath = Util::makeFilepath(directory, "serials.txt", this->gamename, subdir, 0);
|
||||
this->dlcs[i].logoFilepath = Util::makeFilepath(directory, "logo" + logo_ext, this->gamename, subdir, 0);
|
||||
this->dlcs[i].iconFilepath = Util::makeFilepath(directory, "icon" + icon_ext, this->gamename, subdir, 0);
|
||||
this->dlcs[i].changelogFilepath = Util::makeFilepath(directory, "changelog_" + this->dlcs[i].gamename + ".html", this->gamename, subdir, 0);
|
||||
for (unsigned int j = 0; j < this->dlcs[i].installers.size(); ++j)
|
||||
{
|
||||
@ -196,6 +202,11 @@ std::string gameDetails::getLogoFilepath()
|
||||
return this->logoFilepath;
|
||||
}
|
||||
|
||||
std::string gameDetails::getIconFilepath()
|
||||
{
|
||||
return this->iconFilepath;
|
||||
}
|
||||
|
||||
std::string gameDetails::getChangelogFilepath()
|
||||
{
|
||||
return this->changelogFilepath;
|
||||
|
Loading…
x
Reference in New Issue
Block a user