2010-03-07 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>

Added aria2.forceRemove XML-RPC method.
	* doc/aria2c.1.txt
	* src/XmlRpcMethodFactory.cc
	* src/XmlRpcMethodImpl.cc
	* src/XmlRpcMethodImpl.h
pull/1/head
Tatsuhiro Tsujikawa 2010-03-07 06:04:15 +00:00
parent 7f593c3ff8
commit 41e203bf84
7 changed files with 57 additions and 3 deletions

View File

@ -1,3 +1,11 @@
2010-03-07 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added aria2.forceRemove XML-RPC method.
* doc/aria2c.1.txt
* src/XmlRpcMethodFactory.cc
* src/XmlRpcMethodImpl.cc
* src/XmlRpcMethodImpl.h
2010-03-07 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net> 2010-03-07 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added debug log. Added debug log.

View File

@ -2208,6 +2208,10 @@ This method adds Metalink download by uploading \&.metalink file\&. \fImetalink\
.sp .sp
This method removes the download denoted by \fIgid\fR\&. \fIgid\fR is of type string\&. If specified download is in progress, it is stopped at first\&. The status of removed download becomes "removed"\&. This method returns GID of removed download\&. This method removes the download denoted by \fIgid\fR\&. \fIgid\fR is of type string\&. If specified download is in progress, it is stopped at first\&. The status of removed download becomes "removed"\&. This method returns GID of removed download\&.
.sp .sp
\fBaria2\&.forceRemove\fR \fIgid\fR
.sp
This method removes the download denoted by \fIgid\fR\&. This method behaves just like \fBaria2\&.remove\fR except that this method removes download without any action which takes time such as contacting BitTorrent tracker\&.
.sp
\fBaria2\&.tellStatus\fR \fIgid\fR \fBaria2\&.tellStatus\fR \fIgid\fR
.sp .sp
This method returns download progress of the download denoted by \fIgid\fR\&. \fIgid\fR is of type string\&. The response is of type struct and it contains following keys\&. The value type is string\&. This method returns download progress of the download denoted by \fIgid\fR\&. \fIgid\fR is of type string\&. The response is of type struct and it contains following keys\&. The value type is string\&.

View File

@ -2752,6 +2752,11 @@ registered download.</p></div>
string. If specified download is in progress, it is stopped at string. If specified download is in progress, it is stopped at
first. The status of removed download becomes "removed". This method first. The status of removed download becomes "removed". This method
returns GID of removed download.</p></div> returns GID of removed download.</p></div>
<div class="paragraph"><p><strong>aria2.forceRemove</strong> <em>gid</em></p></div>
<div class="paragraph"><p>This method removes the download denoted by <em>gid</em>. This method
behaves just like <strong>aria2.remove</strong> except that this method removes
download without any action which takes time such as contacting
BitTorrent tracker.</p></div>
<div class="paragraph"><p><strong>aria2.tellStatus</strong> <em>gid</em></p></div> <div class="paragraph"><p><strong>aria2.tellStatus</strong> <em>gid</em></p></div>
<div class="paragraph"><p>This method returns download progress of the download denoted by <div class="paragraph"><p>This method returns download progress of the download denoted by
<em>gid</em>. <em>gid</em> is of type string. The response is of type struct and it <em>gid</em>. <em>gid</em> is of type string. The response is of type struct and it
@ -3749,7 +3754,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-03-07 00:00:09 JST Last updated 2010-03-07 14:59:45 JST
</div> </div>
</div> </div>
</body> </body>

View File

@ -1189,6 +1189,13 @@ string. If specified download is in progress, it is stopped at
first. The status of removed download becomes "removed". This method first. The status of removed download becomes "removed". This method
returns GID of removed download. returns GID of removed download.
*aria2.forceRemove* 'gid'
This method removes the download denoted by 'gid'. This method
behaves just like *aria2.remove* except that this method removes
download without any action which takes time such as contacting
BitTorrent tracker.
*aria2.tellStatus* 'gid' *aria2.tellStatus* 'gid'
This method returns download progress of the download denoted by This method returns download progress of the download denoted by

View File

@ -58,6 +58,8 @@ XmlRpcMethodFactory::create(const std::string& methodName)
} }
else if(methodName == RemoveXmlRpcMethod::getMethodName()) { else if(methodName == RemoveXmlRpcMethod::getMethodName()) {
return SharedHandle<XmlRpcMethod>(new RemoveXmlRpcMethod()); return SharedHandle<XmlRpcMethod>(new RemoveXmlRpcMethod());
} else if(methodName == ForceRemoveXmlRpcMethod::getMethodName()) {
return SharedHandle<XmlRpcMethod>(new ForceRemoveXmlRpcMethod());
} else if(methodName == ChangePositionXmlRpcMethod::getMethodName()) { } else if(methodName == ChangePositionXmlRpcMethod::getMethodName()) {
return SharedHandle<XmlRpcMethod>(new ChangePositionXmlRpcMethod()); return SharedHandle<XmlRpcMethod>(new ChangePositionXmlRpcMethod());
} else if(methodName == TellStatusXmlRpcMethod::getMethodName()) { } else if(methodName == TellStatusXmlRpcMethod::getMethodName()) {

View File

@ -280,7 +280,8 @@ BDE AddMetalinkXmlRpcMethod::process
} }
#endif // ENABLE_METALINK #endif // ENABLE_METALINK
BDE RemoveXmlRpcMethod::process(const XmlRpcRequest& req, DownloadEngine* e) static BDE removeDownload
(const XmlRpcRequest& req, DownloadEngine* e, bool forceRemove)
{ {
const BDE& params = req._params; const BDE& params = req._params;
assert(params.isList()); assert(params.isList());
@ -305,11 +306,27 @@ BDE RemoveXmlRpcMethod::process(const XmlRpcRequest& req, DownloadEngine* e)
throw DL_ABORT_EX throw DL_ABORT_EX
(StringFormat("GID#%d cannot be removed now", gid).str()); (StringFormat("GID#%d cannot be removed now", gid).str());
} }
} else {
if(forceRemove) {
group->setForceHaltRequested(true, RequestGroup::USER_REQUEST);
} else { } else {
group->setHaltRequested(true, RequestGroup::USER_REQUEST); group->setHaltRequested(true, RequestGroup::USER_REQUEST);
} }
}
return createGIDResponse(gid); return createGIDResponse(gid);
}
BDE RemoveXmlRpcMethod::process(const XmlRpcRequest& req, DownloadEngine* e)
{
return removeDownload(req, e, false);
}
BDE ForceRemoveXmlRpcMethod::process
(const XmlRpcRequest& req, DownloadEngine* e)
{
return removeDownload(req, e, true);
} }
static void createUriEntry(BDE& uriList, const SharedHandle<FileEntry>& file) static void createUriEntry(BDE& uriList, const SharedHandle<FileEntry>& file)

View File

@ -73,6 +73,17 @@ public:
} }
}; };
class ForceRemoveXmlRpcMethod:public XmlRpcMethod {
protected:
virtual BDE process(const XmlRpcRequest& req, DownloadEngine* e);
public:
static const std::string& getMethodName()
{
static std::string methodName = "aria2.forceRemove";
return methodName;
}
};
#ifdef ENABLE_BITTORRENT #ifdef ENABLE_BITTORRENT
class AddTorrentXmlRpcMethod:public XmlRpcMethod { class AddTorrentXmlRpcMethod:public XmlRpcMethod {
protected: protected: