diff --git a/doc/manual-src/en/aria2c.rst b/doc/manual-src/en/aria2c.rst index 17caaa05..5a5bb3f3 100644 --- a/doc/manual-src/en/aria2c.rst +++ b/doc/manual-src/en/aria2c.rst @@ -713,6 +713,14 @@ BitTorrent Specific Options option to ``false``. This option has effect only on BitTorrent download. Default: ``true`` +.. option:: --bt-load-saved-metadata[=true|false] + + Before getting torrent metadata from DHT when downloading with + magnet link, first try to read file saved by + :option:`--bt-save-metadata` option. If it is successful, then skip + downloading metadata from DHT. + Default: ``false`` + .. option:: --bt-lpd-interface= Use given interface for Local Peer Discovery. If this option is not @@ -2111,6 +2119,7 @@ of URIs. These optional lines must start with white space(s). * :option:`bt-external-ip <--bt-external-ip>` * :option:`bt-force-encryption <--bt-force-encryption>` * :option:`bt-hash-check-seed <--bt-hash-check-seed>` + * :option:`bt-load-saved-metadata <--bt-load-saved-metadata>` * :option:`bt-max-peers <--bt-max-peers>` * :option:`bt-metadata-only <--bt-metadata-only>` * :option:`bt-min-crypto-level <--bt-min-crypto-level>` diff --git a/src/OptionHandlerFactory.cc b/src/OptionHandlerFactory.cc index b1721c80..6f352cd4 100644 --- a/src/OptionHandlerFactory.cc +++ b/src/OptionHandlerFactory.cc @@ -1527,6 +1527,16 @@ std::vector OptionHandlerFactory::createOptionHandlers() op->setChangeOptionForReserved(true); handlers.push_back(op); } + { + OptionHandler* op(new BooleanOptionHandler( + PREF_BT_LOAD_SAVED_METADATA, TEXT_BT_LOAD_SAVED_METADATA, A2_V_FALSE, + OptionHandler::OPT_ARG)); + op->addTag(TAG_BITTORRENT); + op->setInitialOption(true); + op->setChangeGlobalOption(true); + op->setChangeOptionForReserved(true); + handlers.push_back(op); + } { OptionHandler* op(new DefaultOptionHandler( PREF_BT_LPD_INTERFACE, TEXT_BT_LPD_INTERFACE, NO_DEFAULT_VALUE, diff --git a/src/download_helper.cc b/src/download_helper.cc index 9a19fe2f..7caf8c43 100644 --- a/src/download_helper.cc +++ b/src/download_helper.cc @@ -237,23 +237,54 @@ std::shared_ptr createBtMagnetRequestGroup(const std::string& magnetLink, const std::shared_ptr