mirror of
https://github.com/Sude-/lgogdownloader.git
synced 2025-02-02 05:52:31 +01:00
Add option to set automatic XML creation in config file
This commit is contained in:
parent
14d9d3d89f
commit
fc88679b12
@ -46,6 +46,7 @@ class Config
|
||||
bool bSaveSerials;
|
||||
bool bPlatformDetection;
|
||||
bool bShowWishlist;
|
||||
bool bAutomaticXMLCreation;
|
||||
std::string sGameRegex;
|
||||
std::string sDirectory;
|
||||
std::string sCacheDirectory;
|
||||
|
4
main.cpp
4
main.cpp
@ -192,6 +192,7 @@ int main(int argc, char *argv[])
|
||||
("ignore-dlc-count", bpo::value<std::string>(&config.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("covers"), ("Select what not to download/list/repair\n" + include_options_text).c_str())
|
||||
("automatic-xml-creation", bpo::value<bool>(&config.bAutomaticXMLCreation)->zero_tokens()->default_value(false), "Automatically create XML data after download has completed")
|
||||
;
|
||||
// Options read from config file
|
||||
options_cfg_only.add_options()
|
||||
@ -338,6 +339,9 @@ int main(int argc, char *argv[])
|
||||
config.bLoginHTTP = true;
|
||||
}
|
||||
|
||||
if (config.sXMLFile == "automatic")
|
||||
config.bAutomaticXMLCreation = true;
|
||||
|
||||
parseOptionString(sInstallerLanguage, config.vLanguagePriority, config.iInstallerLanguage, GlobalConstants::LANGUAGES);
|
||||
parseOptionString(sInstallerPlatform, config.vPlatformPriority, config.iInstallerPlatform, GlobalConstants::PLATFORMS);
|
||||
|
||||
|
@ -922,7 +922,7 @@ void Downloader::download()
|
||||
std::cout << filepath << std::endl;
|
||||
CURLcode result = this->downloadFile(url, filepath);
|
||||
std::cout << std::endl;
|
||||
if (result==CURLE_OK && config.sXMLFile == "automatic")
|
||||
if (result==CURLE_OK && config.bAutomaticXMLCreation)
|
||||
{
|
||||
std::cout << "Starting automatic XML creation" << std::endl;
|
||||
std::string xml_dir = config.sXMLDirectory + "/" + games[i].gamename;
|
||||
@ -1144,7 +1144,7 @@ void Downloader::download()
|
||||
std::cout << "Dowloading: " << games[i].dlcs[j].extras[k].name << std::endl;
|
||||
CURLcode result = this->downloadFile(url, filepath);
|
||||
std::cout << std::endl;
|
||||
if (result==CURLE_OK && config.sXMLFile == "automatic")
|
||||
if (result==CURLE_OK && config.bAutomaticXMLCreation)
|
||||
{
|
||||
std::cout << "Starting automatic XML creation" << std::endl;
|
||||
std::string xml_dir = config.sXMLDirectory + "/" + games[i].dlcs[j].gamename;
|
||||
@ -1462,7 +1462,7 @@ int Downloader::repairFile(const std::string& url, const std::string& filepath,
|
||||
{
|
||||
bLocalXMLExists = boost::filesystem::exists(xml_file); // Check to see if downloadFile saved XML data
|
||||
|
||||
if (config.sXMLFile == "automatic" && !bLocalXMLExists)
|
||||
if (config.bAutomaticXMLCreation && !bLocalXMLExists)
|
||||
{
|
||||
std::cout << "Starting automatic XML creation" << std::endl;
|
||||
Util::createXML(filepath, config.iChunkSize, xml_directory);
|
||||
@ -1503,7 +1503,7 @@ int Downloader::repairFile(const std::string& url, const std::string& filepath,
|
||||
std::cout << std::endl;
|
||||
if (result == CURLE_OK)
|
||||
{
|
||||
if (config.sXMLFile == "automatic" && bParsingFailed)
|
||||
if (config.bAutomaticXMLCreation && bParsingFailed)
|
||||
{
|
||||
std::cout << "Starting automatic XML creation" << std::endl;
|
||||
Util::createXML(filepath, config.iChunkSize, xml_directory);
|
||||
|
Loading…
x
Reference in New Issue
Block a user