mirror of https://github.com/aria2/aria2
2010-07-16 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added --on-bt-download-complete=COMMAND option. For BitTorrent, a command specified in --on-download-complete is called when download completes and seeding is over. On the other hand, this option set the command to be executed when download completes but before seeding. * doc/aria2c.1.txt * src/DefaultPieceStorage.cc * src/OptionHandlerFactory.cc * src/prefs.cc * src/prefs.h * src/usage_text.h * src/util.cc * src/util.hpull/1/head
parent
db23e29ecf
commit
34036e58af
16
ChangeLog
16
ChangeLog
|
@ -1,3 +1,19 @@
|
||||||
|
2010-07-16 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
|
Added --on-bt-download-complete=COMMAND option. For BitTorrent, a
|
||||||
|
command specified in --on-download-complete is called when
|
||||||
|
download completes and seeding is over. On the other hand, this
|
||||||
|
option set the command to be executed when download completes but
|
||||||
|
before seeding.
|
||||||
|
* doc/aria2c.1.txt
|
||||||
|
* src/DefaultPieceStorage.cc
|
||||||
|
* src/OptionHandlerFactory.cc
|
||||||
|
* src/prefs.cc
|
||||||
|
* src/prefs.h
|
||||||
|
* src/usage_text.h
|
||||||
|
* src/util.cc
|
||||||
|
* src/util.h
|
||||||
|
|
||||||
2010-07-16 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
2010-07-16 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||||
|
|
||||||
Updated doc of --split option.
|
Updated doc of --split option.
|
||||||
|
|
10
doc/aria2c.1
10
doc/aria2c.1
|
@ -1249,6 +1249,16 @@ or
|
||||||
\fIdebug\fR
|
\fIdebug\fR
|
||||||
.RE
|
.RE
|
||||||
.PP
|
.PP
|
||||||
|
\fB\-\-on\-bt\-download\-complete\fR=COMMAND
|
||||||
|
.RS 4
|
||||||
|
For BitTorrent, a command specified in
|
||||||
|
\fB\-\-on\-download\-complete\fR
|
||||||
|
is called when download completes and seeding is over\&. On the other hand, this option set the command to be executed when download completes but before seeding\&. See
|
||||||
|
\fB\-\-on\-download\-start\fR
|
||||||
|
option for the requirement of COMMAND\&. Possible Values:
|
||||||
|
\fI/path/to/command\fR
|
||||||
|
.RE
|
||||||
|
.PP
|
||||||
\fB\-\-on\-download\-complete\fR=COMMAND
|
\fB\-\-on\-download\-complete\fR=COMMAND
|
||||||
.RS 4
|
.RS 4
|
||||||
Set the command to be executed when download completes\&. See
|
Set the command to be executed when download completes\&. See
|
||||||
|
|
|
@ -2077,6 +2077,18 @@ name.</td>
|
||||||
</p>
|
</p>
|
||||||
</dd>
|
</dd>
|
||||||
<dt class="hdlist1">
|
<dt class="hdlist1">
|
||||||
|
<strong>--on-bt-download-complete</strong>=COMMAND
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
<p>
|
||||||
|
For BitTorrent, a command specified in <strong>--on-download-complete</strong> is
|
||||||
|
called when download completes and seeding is over. On the other
|
||||||
|
hand, this option set the command to be executed when download
|
||||||
|
completes but before seeding. See <strong>--on-download-start</strong> option for
|
||||||
|
the requirement of COMMAND. Possible Values: <em>/path/to/command</em>
|
||||||
|
</p>
|
||||||
|
</dd>
|
||||||
|
<dt class="hdlist1">
|
||||||
<strong>--on-download-complete</strong>=COMMAND
|
<strong>--on-download-complete</strong>=COMMAND
|
||||||
</dt>
|
</dt>
|
||||||
<dd>
|
<dd>
|
||||||
|
@ -4230,7 +4242,7 @@ files in the program, then also delete it here.</p></div>
|
||||||
<div id="footnotes"><hr /></div>
|
<div id="footnotes"><hr /></div>
|
||||||
<div id="footer">
|
<div id="footer">
|
||||||
<div id="footer-text">
|
<div id="footer-text">
|
||||||
Last updated 2010-07-16 23:25:07 JST
|
Last updated 2010-07-16 23:44:34 JST
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -851,6 +851,14 @@ name.
|
||||||
LEVEL is either 'debug', 'info', 'notice', 'warn' or 'error'.
|
LEVEL is either 'debug', 'info', 'notice', 'warn' or 'error'.
|
||||||
Default: 'debug'
|
Default: 'debug'
|
||||||
|
|
||||||
|
*--on-bt-download-complete*=COMMAND::
|
||||||
|
|
||||||
|
For BitTorrent, a command specified in *--on-download-complete* is
|
||||||
|
called when download completes and seeding is over. On the other
|
||||||
|
hand, this option set the command to be executed when download
|
||||||
|
completes but before seeding. See *--on-download-start* option for
|
||||||
|
the requirement of COMMAND. Possible Values: '/path/to/command'
|
||||||
|
|
||||||
*--on-download-complete*=COMMAND::
|
*--on-download-complete*=COMMAND::
|
||||||
|
|
||||||
Set the command to be executed when download completes. See
|
Set the command to be executed when download completes. See
|
||||||
|
|
|
@ -59,6 +59,9 @@
|
||||||
#include "array_fun.h"
|
#include "array_fun.h"
|
||||||
#include "PieceStatMan.h"
|
#include "PieceStatMan.h"
|
||||||
#include "wallclock.h"
|
#include "wallclock.h"
|
||||||
|
#ifdef ENABLE_BITTORRENT
|
||||||
|
# include "bittorrent_helper.h"
|
||||||
|
#endif // ENABLE_BITTORRENT
|
||||||
|
|
||||||
namespace aria2 {
|
namespace aria2 {
|
||||||
|
|
||||||
|
@ -363,6 +366,16 @@ void DefaultPieceStorage::completePiece(const SharedHandle<Piece>& piece)
|
||||||
} else {
|
} else {
|
||||||
logger_->info(MSG_DOWNLOAD_COMPLETED);
|
logger_->info(MSG_DOWNLOAD_COMPLETED);
|
||||||
}
|
}
|
||||||
|
#ifdef ENABLE_BITTORRENT
|
||||||
|
if(downloadContext_->hasAttribute(bittorrent::BITTORRENT)) {
|
||||||
|
SharedHandle<TorrentAttribute> torrentAttrs =
|
||||||
|
bittorrent::getTorrentAttrs(downloadContext_);
|
||||||
|
if(!torrentAttrs->metadata.empty()) {
|
||||||
|
util::executeHookByOptName(downloadContext_->getOwnerRequestGroup(),
|
||||||
|
option_, PREF_ON_BT_DOWNLOAD_COMPLETE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif // ENABLE_BITTORRENT
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1401,6 +1401,16 @@ OptionHandlers OptionHandlerFactory::createOptionHandlers()
|
||||||
op->addTag(TAG_BITTORRENT);
|
op->addTag(TAG_BITTORRENT);
|
||||||
handlers.push_back(op);
|
handlers.push_back(op);
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
SharedHandle<OptionHandler> op(new DefaultOptionHandler
|
||||||
|
(PREF_ON_BT_DOWNLOAD_COMPLETE,
|
||||||
|
TEXT_ON_BT_DOWNLOAD_COMPLETE,
|
||||||
|
NO_DEFAULT_VALUE,
|
||||||
|
"/path/to/command"));
|
||||||
|
op->addTag(TAG_ADVANCED);
|
||||||
|
op->addTag(TAG_HOOK);
|
||||||
|
handlers.push_back(op);
|
||||||
|
}
|
||||||
{
|
{
|
||||||
SharedHandle<NumberOptionHandler> op(new NumberOptionHandler
|
SharedHandle<NumberOptionHandler> op(new NumberOptionHandler
|
||||||
(PREF_PEER_CONNECTION_TIMEOUT,
|
(PREF_PEER_CONNECTION_TIMEOUT,
|
||||||
|
|
|
@ -354,6 +354,8 @@ const std::string PREF_BT_TRACKER_TIMEOUT("bt-tracker-timeout");
|
||||||
const std::string PREF_BT_TRACKER_CONNECT_TIMEOUT("bt-tracker-connect-timeout");
|
const std::string PREF_BT_TRACKER_CONNECT_TIMEOUT("bt-tracker-connect-timeout");
|
||||||
// values: 1*digit
|
// values: 1*digit
|
||||||
const std::string PREF_DHT_MESSAGE_TIMEOUT("dht-message-timeout");
|
const std::string PREF_DHT_MESSAGE_TIMEOUT("dht-message-timeout");
|
||||||
|
// values: string
|
||||||
|
const std::string PREF_ON_BT_DOWNLOAD_COMPLETE("on-bt-download-complete");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Metalink related preferences
|
* Metalink related preferences
|
||||||
|
|
|
@ -358,6 +358,8 @@ extern const std::string PREF_BT_TRACKER_TIMEOUT;
|
||||||
extern const std::string PREF_BT_TRACKER_CONNECT_TIMEOUT;
|
extern const std::string PREF_BT_TRACKER_CONNECT_TIMEOUT;
|
||||||
// values: 1*digit
|
// values: 1*digit
|
||||||
extern const std::string PREF_DHT_MESSAGE_TIMEOUT;
|
extern const std::string PREF_DHT_MESSAGE_TIMEOUT;
|
||||||
|
// values: string
|
||||||
|
extern const std::string PREF_ON_BT_DOWNLOAD_COMPLETE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Metalink related preferences
|
* Metalink related preferences
|
||||||
|
|
|
@ -698,3 +698,11 @@
|
||||||
_(" --conditional-get[=true|false] Download file only when the local file is older\n" \
|
_(" --conditional-get[=true|false] Download file only when the local file is older\n" \
|
||||||
" than remote file. Currently, this function has\n" \
|
" than remote file. Currently, this function has\n" \
|
||||||
" many limitations. See man page for details.")
|
" many limitations. See man page for details.")
|
||||||
|
#define TEXT_ON_BT_DOWNLOAD_COMPLETE \
|
||||||
|
_(" --on-bt-download-complete=COMMAND For BitTorrent, a command specified in\n" \
|
||||||
|
" --on-download-complete is called when download\n" \
|
||||||
|
" completes and seeding is over. On the other hand,\n" \
|
||||||
|
" this option sets the command to be executed when\n" \
|
||||||
|
" download completes but before seeding.\n" \
|
||||||
|
" See --on-download-start option for the\n" \
|
||||||
|
" requirement of COMMAND.")
|
||||||
|
|
|
@ -1394,6 +1394,12 @@ void executeHook(const std::string& command, gid_t gid)
|
||||||
void executeHookByOptName
|
void executeHookByOptName
|
||||||
(const SharedHandle<RequestGroup>& group, const Option* option,
|
(const SharedHandle<RequestGroup>& group, const Option* option,
|
||||||
const std::string& opt)
|
const std::string& opt)
|
||||||
|
{
|
||||||
|
executeHookByOptName(group.get(), option, opt);
|
||||||
|
}
|
||||||
|
|
||||||
|
void executeHookByOptName
|
||||||
|
(const RequestGroup* group, const Option* option, const std::string& opt)
|
||||||
{
|
{
|
||||||
if(!option->blank(opt)) {
|
if(!option->blank(opt)) {
|
||||||
executeHook(option->get(opt), group->getGID());
|
executeHook(option->get(opt), group->getGID());
|
||||||
|
|
|
@ -402,6 +402,9 @@ void executeHookByOptName
|
||||||
(const SharedHandle<RequestGroup>& group, const Option* option,
|
(const SharedHandle<RequestGroup>& group, const Option* option,
|
||||||
const std::string& opt);
|
const std::string& opt);
|
||||||
|
|
||||||
|
void executeHookByOptName
|
||||||
|
(const RequestGroup* group, const Option* option, const std::string& opt);
|
||||||
|
|
||||||
} // namespace util
|
} // namespace util
|
||||||
|
|
||||||
} // namespace aria2
|
} // namespace aria2
|
||||||
|
|
Loading…
Reference in New Issue