mirror of
https://github.com/Sude-/lgogdownloader.git
synced 2025-02-02 05:52:31 +01:00
Use separate thread count option for info threads
Adds --info-threads option to set number of threads the downloader uses for getting product info
This commit is contained in:
parent
56a06133d2
commit
0a7648d80b
@ -283,6 +283,7 @@ class Config
|
|||||||
// Integers
|
// Integers
|
||||||
int iRetries;
|
int iRetries;
|
||||||
unsigned int iThreads;
|
unsigned int iThreads;
|
||||||
|
unsigned int iInfoThreads;
|
||||||
int iWait;
|
int iWait;
|
||||||
size_t iChunkSize;
|
size_t iChunkSize;
|
||||||
int iProgressInterval;
|
int iProgressInterval;
|
||||||
|
1
main.cpp
1
main.cpp
@ -242,6 +242,7 @@ int main(int argc, char *argv[])
|
|||||||
("automatic-xml-creation", bpo::value<bool>(&Globals::globalConfig.dlConf.bAutomaticXMLCreation)->zero_tokens()->default_value(false), "Automatically create XML data after download has completed")
|
("automatic-xml-creation", bpo::value<bool>(&Globals::globalConfig.dlConf.bAutomaticXMLCreation)->zero_tokens()->default_value(false), "Automatically create XML data after download has completed")
|
||||||
("save-changelogs", bpo::value<bool>(&Globals::globalConfig.dlConf.bSaveChangelogs)->zero_tokens()->default_value(false), "Save changelogs when downloading")
|
("save-changelogs", bpo::value<bool>(&Globals::globalConfig.dlConf.bSaveChangelogs)->zero_tokens()->default_value(false), "Save changelogs when downloading")
|
||||||
("threads", bpo::value<unsigned int>(&Globals::globalConfig.iThreads)->default_value(4), "Number of download threads")
|
("threads", bpo::value<unsigned int>(&Globals::globalConfig.iThreads)->default_value(4), "Number of download threads")
|
||||||
|
("info-threads", bpo::value<unsigned int>(&Globals::globalConfig.iInfoThreads)->default_value(4), "Number of threads for getting product info")
|
||||||
("dlc-list", bpo::value<std::string>(&Globals::globalConfig.sGameHasDLCList)->default_value("https://raw.githubusercontent.com/Sude-/lgogdownloader-lists/master/game_has_dlc.txt"), "Set URL for list of games that have DLC")
|
("dlc-list", bpo::value<std::string>(&Globals::globalConfig.sGameHasDLCList)->default_value("https://raw.githubusercontent.com/Sude-/lgogdownloader-lists/master/game_has_dlc.txt"), "Set URL for list of games that have DLC")
|
||||||
("progress-interval", bpo::value<int>(&Globals::globalConfig.iProgressInterval)->default_value(100), "Set interval for progress bar update (milliseconds)\nValue must be between 1 and 10000")
|
("progress-interval", bpo::value<int>(&Globals::globalConfig.iProgressInterval)->default_value(100), "Set interval for progress bar update (milliseconds)\nValue must be between 1 and 10000")
|
||||||
("lowspeed-timeout", bpo::value<long int>(&Globals::globalConfig.curlConf.iLowSpeedTimeout)->default_value(30), "Set time in number seconds that the transfer speed should be below the rate set with --lowspeed-rate for it to considered too slow and aborted")
|
("lowspeed-timeout", bpo::value<long int>(&Globals::globalConfig.curlConf.iLowSpeedTimeout)->default_value(30), "Set time in number seconds that the transfer speed should be below the rate set with --lowspeed-rate for it to considered too slow and aborted")
|
||||||
|
@ -430,7 +430,7 @@ int Downloader::getGameDetails()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create threads
|
// Create threads
|
||||||
unsigned int threads = std::min(Globals::globalConfig.iThreads, static_cast<unsigned int>(gameItemQueue.size()));
|
unsigned int threads = std::min(Globals::globalConfig.iInfoThreads, static_cast<unsigned int>(gameItemQueue.size()));
|
||||||
std::vector<std::thread> vThreads;
|
std::vector<std::thread> vThreads;
|
||||||
for (unsigned int i = 0; i < threads; ++i)
|
for (unsigned int i = 0; i < threads; ++i)
|
||||||
{
|
{
|
||||||
@ -446,7 +446,7 @@ int Downloader::getGameDetails()
|
|||||||
dl_status = DLSTATUS_NOTSTARTED;
|
dl_status = DLSTATUS_NOTSTARTED;
|
||||||
|
|
||||||
// Print progress information once per 100ms
|
// Print progress information once per 100ms
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
std::this_thread::sleep_for(std::chrono::milliseconds(Globals::globalConfig.iProgressInterval));
|
||||||
std::cerr << "\033[J\r" << std::flush; // Clear screen from the current line down to the bottom of the screen
|
std::cerr << "\033[J\r" << std::flush; // Clear screen from the current line down to the bottom of the screen
|
||||||
|
|
||||||
// Print messages from message queue first
|
// Print messages from message queue first
|
||||||
|
Loading…
x
Reference in New Issue
Block a user