summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2010-01-12 14:30:47 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2010-01-12 14:30:47 +0000
commita77d96e2cfd9d7d04087b342487ce77303384844 (patch)
tree75cef1653a08e54b9f052157e70f8aa5722eb315 /src
parentf3b1defc97a1ce72a08631809feb869a9a3448c1 (diff)
2010-01-12 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added --bt-metadata-only option. If true is given to this option, aria2 downloads metadata only. The file(s) described in metadata will not be downloaded. This option has effect only when BitTorrent Magnet URI is used. See also --bt-save-metadata option. * doc/aria2c.1.txt * src/OptionHandlerFactory.cc * src/UTMetadataPostDownloadHandler.cc * src/download_helper.cc * src/prefs.cc * src/prefs.h * src/usage_text.h
Diffstat (limited to 'src')
-rw-r--r--src/OptionHandlerFactory.cc9
-rw-r--r--src/UTMetadataPostDownloadHandler.cc12
-rw-r--r--src/download_helper.cc1
-rw-r--r--src/prefs.cc2
-rw-r--r--src/prefs.h2
-rw-r--r--src/usage_text.h12
6 files changed, 30 insertions, 8 deletions
diff --git a/src/OptionHandlerFactory.cc b/src/OptionHandlerFactory.cc
index 71fb8e0c..1ef10d0f 100644
--- a/src/OptionHandlerFactory.cc
+++ b/src/OptionHandlerFactory.cc
@@ -980,6 +980,15 @@ OptionHandlers OptionHandlerFactory::createOptionHandlers()
}
{
+ SharedHandle<OptionHandler> op(new BooleanOptionHandler
+ (PREF_BT_METADATA_ONLY,
+ TEXT_BT_METADATA_ONLY,
+ V_FALSE,
+ OptionHandler::OPT_ARG));
+ op->addTag(TAG_BITTORRENT);
+ handlers.push_back(op);
+ }
+ {
SharedHandle<OptionHandler> op(new ParameterOptionHandler
(PREF_BT_MIN_CRYPTO_LEVEL,
TEXT_BT_MIN_CRYPTO_LEVEL,
diff --git a/src/UTMetadataPostDownloadHandler.cc b/src/UTMetadataPostDownloadHandler.cc
index d3230ad2..ea07b602 100644
--- a/src/UTMetadataPostDownloadHandler.cc
+++ b/src/UTMetadataPostDownloadHandler.cc
@@ -92,12 +92,14 @@ void UTMetadataPostDownloadHandler::getNextRequestGroups
_logger->notice(MSG_METADATA_NOT_SAVED, filename.c_str());
}
}
- std::deque<SharedHandle<RequestGroup> > newRgs;
- createRequestGroupForBitTorrent(newRgs, requestGroup->getOption(),
- std::deque<std::string>(), torrent);
+ if(!requestGroup->getOption()->getAsBool(PREF_BT_METADATA_ONLY)) {
+ std::deque<SharedHandle<RequestGroup> > newRgs;
+ createRequestGroupForBitTorrent(newRgs, requestGroup->getOption(),
+ std::deque<std::string>(), torrent);
- requestGroup->followedBy(newRgs.begin(), newRgs.end());
- groups.insert(groups.end(), newRgs.begin(), newRgs.end());
+ requestGroup->followedBy(newRgs.begin(), newRgs.end());
+ groups.insert(groups.end(), newRgs.begin(), newRgs.end());
+ }
}
} // namespace aria2
diff --git a/src/download_helper.cc b/src/download_helper.cc
index bbec38fd..86e2e7ae 100644
--- a/src/download_helper.cc
+++ b/src/download_helper.cc
@@ -112,6 +112,7 @@ const std::set<std::string>& listRequestOptions()
PREF_BT_HASH_CHECK_SEED,
PREF_BT_MAX_OPEN_FILES,
PREF_BT_MAX_PEERS,
+ PREF_BT_METADATA_ONLY,
PREF_BT_MIN_CRYPTO_LEVEL,
PREF_BT_PRIORITIZE_PIECE,
PREF_BT_REQUIRE_CRYPTO,
diff --git a/src/prefs.cc b/src/prefs.cc
index 321ac8f0..554783df 100644
--- a/src/prefs.cc
+++ b/src/prefs.cc
@@ -312,6 +312,8 @@ const std::string PREF_BT_STOP_TIMEOUT("bt-stop-timeout");
const std::string PREF_BT_PRIORITIZE_PIECE("bt-prioritize-piece");
// values: true | false
const std::string PREF_BT_SAVE_METADATA("bt-save-metadata");
+// values: true | false
+const std::string PREF_BT_METADATA_ONLY("bt-metadata-only");
/**
* Metalink related preferences
diff --git a/src/prefs.h b/src/prefs.h
index 68d1d9c5..f0a97119 100644
--- a/src/prefs.h
+++ b/src/prefs.h
@@ -316,6 +316,8 @@ extern const std::string PREF_BT_STOP_TIMEOUT;
extern const std::string PREF_BT_PRIORITIZE_PIECE;
// values: true | false
extern const std::string PREF_BT_SAVE_METADATA;
+// values: true | false
+extern const std::string PREF_BT_METADATA_ONLY;
/**
* Metalink related preferences
diff --git a/src/usage_text.h b/src/usage_text.h
index 0f94509e..eebcb625 100644
--- a/src/usage_text.h
+++ b/src/usage_text.h
@@ -589,10 +589,16 @@
" The filename is hex encoded info hash with suffix\n" \
" .torrent. The directory to be saved is the same\n" \
" directory where download file is saved. If the\n" \
- " same file already exists, metadata is not saved.")
+ " same file already exists, metadata is not saved.\n" \
+ " See also --bt-metadata-only option.")
#define TEXT_HTTP_NO_CACHE \
_(" --http-no-cache[=true|false] Send Cache-Control: no-cache and Pragma: no-cache\n" \
- " header to avoid cached content. If false is given\n" \
- " , these headers are not sent and you can add\n" \
+ " header to avoid cached content. If false is\n" \
+ " given, these headers are not sent and you can add\n" \
" Cache-Control header with a directive you like\n" \
" using --header option.")
+#define TEXT_BT_METADATA_ONLY \
+ _(" --bt-metadata-only[=true|false] Download metadata only. The file(s) described\n" \
+ " in metadata will not be downloaded. This option\n" \
+ " has effect only when BitTorrent Magnet URI is\n" \
+ " used. See also --bt-save-metadata option.")