mirror of
https://github.com/Sude-/lgogdownloader.git
synced 2025-02-08 16:33:22 +01:00
Improvements to --download-file option
Allows downloading DLC files by extending file selection. Files can be selected by using the name of dlc --download-file "gamename/dlc_gamename/fileid"
This commit is contained in:
parent
81fdfea8e7
commit
761c3f14c5
2
main.cpp
2
main.cpp
@ -226,7 +226,7 @@ int main(int argc, char *argv[])
|
|||||||
("report", bpo::value<std::string>(&Globals::globalConfig.sReportFilePath)->implicit_value("lgogdownloader-report.log"), "Save report of downloaded/repaired files to specified file\nDefault filename: lgogdownloader-report.log")
|
("report", bpo::value<std::string>(&Globals::globalConfig.sReportFilePath)->implicit_value("lgogdownloader-report.log"), "Save report of downloaded/repaired files to specified file\nDefault filename: lgogdownloader-report.log")
|
||||||
("update-cache", bpo::value<bool>(&Globals::globalConfig.bUpdateCache)->zero_tokens()->default_value(false), "Update game details cache")
|
("update-cache", bpo::value<bool>(&Globals::globalConfig.bUpdateCache)->zero_tokens()->default_value(false), "Update game details cache")
|
||||||
("no-platform-detection", bpo::value<bool>(&bNoPlatformDetection)->zero_tokens()->default_value(false), "Don't try to detect supported platforms from game shelf.\nSkips the initial fast platform detection and detects the supported platforms from game details which is slower but more accurate.\nUseful in case platform identifier is missing for some games in the game shelf.\nUsing --platform with --list doesn't work with this option.")
|
("no-platform-detection", bpo::value<bool>(&bNoPlatformDetection)->zero_tokens()->default_value(false), "Don't try to detect supported platforms from game shelf.\nSkips the initial fast platform detection and detects the supported platforms from game details which is slower but more accurate.\nUseful in case platform identifier is missing for some games in the game shelf.\nUsing --platform with --list doesn't work with this option.")
|
||||||
("download-file", bpo::value<std::string>(&Globals::globalConfig.sFileIdString)->default_value(""), "Download files using fileid\n\nFormat:\n\"gamename/fileid\"\nor: \"gogdownloader://gamename/fileid\"\n\nMultiple files:\n\"gamename1/fileid1,gamename2/fileid2\"\nor: \"gogdownloader://gamename1/fileid1,gamename2/fileid2\"\n\nThis option ignores all subdir options. The files are downloaded to directory specified with --directory option.")
|
("download-file", bpo::value<std::string>(&Globals::globalConfig.sFileIdString)->default_value(""), "Download files using fileid\n\nFormat:\n\"gamename/fileid\"\n\"gamename/dlc_gamename/fileid\"\n\"gogdownloader://gamename/fileid\"\n\"gogdownloader://gamename/dlc_name/fileid\"\n\nMultiple files:\n\"gamename1/fileid1,gamename2/fileid2,gamename2/dlcname/fileid1\"\n\nThis option ignores all subdir options. The files are downloaded to directory specified with --directory option.")
|
||||||
("output-file,o", bpo::value<std::string>(&Globals::globalConfig.sOutputFilename)->default_value(""), "Set filename of file downloaded with --download-file.")
|
("output-file,o", bpo::value<std::string>(&Globals::globalConfig.sOutputFilename)->default_value(""), "Set filename of file downloaded with --download-file.")
|
||||||
("wishlist", bpo::value<bool>(&Globals::globalConfig.bShowWishlist)->zero_tokens()->default_value(false), "Show wishlist")
|
("wishlist", bpo::value<bool>(&Globals::globalConfig.bShowWishlist)->zero_tokens()->default_value(false), "Show wishlist")
|
||||||
("cacert", bpo::value<std::string>(&Globals::globalConfig.curlConf.sCACertPath)->default_value(""), "Path to CA certificate bundle in PEM format")
|
("cacert", bpo::value<std::string>(&Globals::globalConfig.curlConf.sCACertPath)->default_value(""), "Path to CA certificate bundle in PEM format")
|
||||||
|
@ -2405,12 +2405,24 @@ int Downloader::downloadFileWithId(const std::string& fileid_string, const std::
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::string gamename, fileid, url;
|
bool bIsDLC = false;
|
||||||
gamename.assign(fileid_string.begin(), fileid_string.begin()+pos);
|
std::string gamename, dlc_gamename, fileid, url;
|
||||||
fileid.assign(fileid_string.begin()+pos+1, fileid_string.end());
|
std::vector<std::string> fileid_vector = Util::tokenize(fileid_string, "/");
|
||||||
|
if (fileid_vector.size() == 3)
|
||||||
|
bIsDLC = true;
|
||||||
|
|
||||||
|
gamename = fileid_vector[0];
|
||||||
|
if (bIsDLC)
|
||||||
|
{
|
||||||
|
dlc_gamename = fileid_vector[1];
|
||||||
|
fileid = fileid_vector[2];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
fileid = fileid_vector[1];
|
||||||
|
|
||||||
std::string product_id;
|
std::string product_id;
|
||||||
bool bSelectOK = this->galaxySelectProductIdHelper(gamename, product_id);
|
std::string gamename_select = "^" + gamename + "$";
|
||||||
|
bool bSelectOK = this->galaxySelectProductIdHelper(gamename_select, product_id);
|
||||||
|
|
||||||
if (!bSelectOK || product_id.empty())
|
if (!bSelectOK || product_id.empty())
|
||||||
{
|
{
|
||||||
@ -2432,6 +2444,12 @@ int Downloader::downloadFileWithId(const std::string& fileid_string, const std::
|
|||||||
bool bFoundMatchingFile = false;
|
bool bFoundMatchingFile = false;
|
||||||
for (auto f : vFiles)
|
for (auto f : vFiles)
|
||||||
{
|
{
|
||||||
|
if (bIsDLC)
|
||||||
|
{
|
||||||
|
if (f.gamename != dlc_gamename)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (f.id == fileid)
|
if (f.id == fileid)
|
||||||
{
|
{
|
||||||
gf = f;
|
gf = f;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user