summaryrefslogtreecommitdiff
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
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
-rw-r--r--ChangeLog14
-rw-r--r--doc/aria2c.129
-rw-r--r--doc/aria2c.1.html22
-rw-r--r--doc/aria2c.1.txt12
-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
10 files changed, 98 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index c0393031..f378f341 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
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
+
+2010-01-12 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
+
Fixed memory leak. Commands stored in std::deque<Command*> are not
deleted when exception is thrown. Make sure that when passing
std::deque<Command*> to function to store Commands, handle
diff --git a/doc/aria2c.1 b/doc/aria2c.1
index 099760f4..1ec4cf5e 100644
--- a/doc/aria2c.1
+++ b/doc/aria2c.1
@@ -2,12 +2,12 @@
.\" Title: aria2c
.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
-.\" Date: 01/10/2010
+.\" Date: 01/12/2010
.\" Manual: Aria2 Manual
.\" Source: Aria2
.\" Language: English
.\"
-.TH "ARIA2C" "1" "01/10/2010" "Aria2" "Aria2 Manual"
+.TH "ARIA2C" "1" "01/12/2010" "Aria2" "Aria2 Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
@@ -310,7 +310,7 @@ is set, then authorization header is always sent to the server\&. There is an ex
.RS 4
Send Cache\-Control: no\-cache and Pragma: no\-cache header to avoid cached content\&. If
\fIfalse\fR
-is given , these headers are not sent and you can add Cache\-Control header with a directive you like using
+is given, these headers are not sent and you can add Cache\-Control header with a directive you like using
\fB\-\-header\fR
option\&. Default:
\fItrue\fR
@@ -519,6 +519,14 @@ option\&. Default:
\fI55\fR
.RE
.PP
+\fB\-\-bt\-metadata\-only\fR[=\fItrue\fR|\fIfalse\fR]
+.RS 4
+Download 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
+\fB\-\-bt\-save\-metadata\fR
+option\&. Default:
+\fIfalse\fR
+.RE
+.PP
\fB\-\-bt\-min\-crypto\-level\fR=\fIplain\fR|\fIarc4\fR
.RS 4
Set minimum level of encryption method\&. If several encryption methods are provided by a peer, aria2 chooses the lowest one which satisfies the given level\&. Default:
@@ -555,7 +563,9 @@ or
.PP
\fB\-\-bt\-save\-metadata\fR[=\fItrue\fR|\fIfalse\fR]
.RS 4
-Save metadata as \&.torrent file\&. This option has effect only when BitTorrent Magnet URI is used\&. The filename is hex encoded info hash with suffix \&.torrent\&. The directory to be saved is the same directory where download file is saved\&. If the same file already exists, metadata is not saved\&. Default:
+Save metadata as \&.torrent file\&. This option has effect only when BitTorrent Magnet URI is used\&. The filename is hex encoded info hash with suffix \&.torrent\&. The directory to be saved is the same directory where download file is saved\&. If the same file already exists, metadata is not saved\&. See also
+\fB\-\-bt\-metadata\-only\fR
+option\&. Default:
\fIfalse\fR
.RE
.PP
@@ -1739,6 +1749,17 @@ bt\-max\-peers
.sp -1
.IP \(bu 2.3
.\}
+bt\-metadata\-only
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
bt\-min\-crypto\-level
.RE
.sp
diff --git a/doc/aria2c.1.html b/doc/aria2c.1.html
index 6912d5ca..6c80f684 100644
--- a/doc/aria2c.1.html
+++ b/doc/aria2c.1.html
@@ -929,7 +929,7 @@ aria2c -o myfile.zip "http://mirror1/file.zip" "http://mirror2/file.zip"</td>
<dd>
<p>
Send Cache-Control: no-cache and Pragma: no-cache header to avoid
- cached content. If <em>false</em> is given , these headers are not sent
+ cached content. If <em>false</em> is given, these headers are not sent
and you can add Cache-Control header with a directive you like
using <strong>--header</strong> option. Default: <em>true</em>
</p>
@@ -1213,6 +1213,16 @@ writes the piece to the appropriate files.</td>
</p>
</dd>
<dt class="hdlist1">
+<strong>--bt-metadata-only</strong>[=<em>true</em>|<em>false</em>]
+</dt>
+<dd>
+<p>
+ Download 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 <strong>--bt-save-metadata</strong> option. Default: <em>false</em>
+</p>
+</dd>
+<dt class="hdlist1">
<strong>--bt-min-crypto-level</strong>=<em>plain</em>|<em>arc4</em>
</dt>
<dd>
@@ -1271,7 +1281,8 @@ writes the piece to the appropriate files.</td>
BitTorrent Magnet URI is used. The filename is hex encoded info
hash with suffix .torrent. The directory to be saved is the same
directory where download file is saved. If the same file already
- exists, metadata is not saved. Default: <em>false</em>
+ exists, metadata is not saved. See also <strong>--bt-metadata-only</strong>
+ option. Default: <em>false</em>
</p>
</dd>
<dt class="hdlist1">
@@ -2399,6 +2410,11 @@ bt-max-peers
</li>
<li>
<p>
+bt-metadata-only
+</p>
+</li>
+<li>
+<p>
bt-min-crypto-level
</p>
</li>
@@ -3562,7 +3578,7 @@ files in the program, then also delete it here.</p></div>
<div id="footnotes"><hr /></div>
<div id="footer">
<div id="footer-text">
-Last updated 2010-01-10 16:34:37 JST
+Last updated 2010-01-12 23:26:20 JST
</div>
</div>
</body>
diff --git a/doc/aria2c.1.txt b/doc/aria2c.1.txt
index 8e9a3274..2807f582 100644
--- a/doc/aria2c.1.txt
+++ b/doc/aria2c.1.txt
@@ -216,7 +216,7 @@ HTTP Specific Options
*--http-no-cache*[='true'|'false']::
Send Cache-Control: no-cache and Pragma: no-cache header to avoid
- cached content. If 'false' is given , these headers are not sent
+ cached content. If 'false' is given, these headers are not sent
and you can add Cache-Control header with a directive you like
using *--header* option. Default: 'true'
@@ -358,6 +358,12 @@ BitTorrent Specific Options
unlimited. See also *--bt-request-peer-speed-limit* option.
Default: '55'
+*--bt-metadata-only*[='true'|'false']::
+
+ Download 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. Default: 'false'
+
*--bt-min-crypto-level*='plain'|'arc4'::
Set minimum level of encryption method.
If several encryption methods are provided by a peer, aria2 chooses the lowest
@@ -395,7 +401,8 @@ BitTorrent Specific Options
BitTorrent Magnet URI is used. The filename is hex encoded info
hash with suffix .torrent. The directory to be saved is the same
directory where download file is saved. If the same file already
- exists, metadata is not saved. Default: 'false'
+ exists, metadata is not saved. See also *--bt-metadata-only*
+ option. Default: 'false'
*--bt-seed-unverified*[='true'|'false']::
Seed previously downloaded files without verifying piece hashes.
@@ -996,6 +1003,7 @@ of URIs. These optional lines must start with white space(s).
* bt-hash-check-seed
* bt-max-open-files
* bt-max-peers
+* bt-metadata-only
* bt-min-crypto-level
* bt-prioritize-piece
* bt-require-crypto
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.")