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
pull/1/head
Tatsuhiro Tsujikawa 2010-01-12 14:30:47 +00:00
parent f3b1defc97
commit a77d96e2cf
10 changed files with 98 additions and 17 deletions

View File

@ -1,3 +1,17 @@
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

View File

@ -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

View File

@ -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>

View File

@ -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

View File

@ -979,6 +979,15 @@ OptionHandlers OptionHandlerFactory::createOptionHandlers()
handlers.push_back(op);
}
{
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,

View File

@ -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

View File

@ -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,

View File

@ -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

View File

@ -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

View File

@ -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.")