feat: sequential download (#4795)

This commit is contained in:
Pierre Dubouilh
2023-04-14 18:47:54 +02:00
committed by GitHub
parent afa9f64feb
commit ebfba686b0
13 changed files with 72 additions and 11 deletions

View File

@@ -68,7 +68,7 @@ static sig_atomic_t manualUpdate = false;
static char const* torrentPath = nullptr;
static auto constexpr Options = std::array<tr_option, 19>{
static auto constexpr Options = std::array<tr_option, 20>{
{ { 'b', "blocklist", "Enable peer blocklists", "b", false, nullptr },
{ 'B', "no-blocklist", "Disable peer blocklists", "B", false, nullptr },
{ 'd', "downlimit", "Set max download speed in " SPEED_K_STR, "d", true, "<speed>" },
@@ -93,6 +93,8 @@ static auto constexpr Options = std::array<tr_option, 19>{
{ 'v', "verify", "Verify the specified torrent", "v", false, nullptr },
{ 'V', "version", "Show version number and exit", "V", false, nullptr },
{ 'w', "download-dir", "Where to save downloaded data", "w", true, "<path>" },
{ 500, "sequential-download", "Download pieces sequentially", "seq", false, nullptr },
{ 0, nullptr, nullptr, nullptr, false, nullptr } }
};
@@ -445,6 +447,10 @@ static int parseCommandLine(tr_variant* d, int argc, char const** argv)
tr_variantDictAddInt(d, TR_KEY_encryption, TR_CLEAR_PREFERRED);
break;
case 500:
tr_variantDictAddBool(d, TR_KEY_sequentialDownload, true);
break;
case TR_OPT_UNK:
if (torrentPath == nullptr)
{