mirror of https://github.com/aria2/aria2
2010-03-07 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added 'status' key to the response of getUri XML-RPC method. * doc/aria2c.1.txt * src/XmlRpcMethodImpl.ccpull/1/head
parent
e3b5d60893
commit
7923125382
|
@ -1,3 +1,9 @@
|
|||
2010-03-07 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||
|
||||
Added 'status' key to the response of getUri XML-RPC method.
|
||||
* doc/aria2c.1.txt
|
||||
* src/XmlRpcMethodImpl.cc
|
||||
|
||||
2010-03-06 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||
|
||||
Replaced Time::reset() call with assigning of global::wallclock.
|
||||
|
|
13
doc/aria2c.1
13
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: 03/06/2010
|
||||
.\" Date: 03/07/2010
|
||||
.\" Manual: Aria2 Manual
|
||||
.\" Source: Aria2 1.9.0a
|
||||
.\" Language: English
|
||||
.\"
|
||||
.TH "ARIA2C" "1" "03/06/2010" "Aria2 1\&.9\&.0a" "Aria2 Manual"
|
||||
.TH "ARIA2C" "1" "03/07/2010" "Aria2 1\&.9\&.0a" "Aria2 Manual"
|
||||
.\" -----------------------------------------------------------------
|
||||
.\" * Define some portability stuff
|
||||
.\" -----------------------------------------------------------------
|
||||
|
@ -2352,6 +2352,15 @@ uri
|
|||
.RS 4
|
||||
URI
|
||||
.RE
|
||||
.PP
|
||||
status
|
||||
.RS 4
|
||||
|
||||
\fIused\fR
|
||||
if the URI is already used\&.
|
||||
\fIwaiting\fR
|
||||
if the URI is waiting in the queue\&.
|
||||
.RE
|
||||
.sp
|
||||
\fBaria2\&.getFiles\fR \fIgid\fR
|
||||
.sp
|
||||
|
|
|
@ -2999,6 +2999,15 @@ uri
|
|||
URI
|
||||
</p>
|
||||
</dd>
|
||||
<dt class="hdlist1">
|
||||
status
|
||||
</dt>
|
||||
<dd>
|
||||
<p>
|
||||
<em>used</em> if the URI is already used. <em>waiting</em> if the URI is waiting
|
||||
in the queue.
|
||||
</p>
|
||||
</dd>
|
||||
</dl></div>
|
||||
<div class="paragraph"><p><strong>aria2.getFiles</strong> <em>gid</em></p></div>
|
||||
<div class="paragraph"><p>This method returns file list of the download denoted by <em>gid</em>. <em>gid</em>
|
||||
|
@ -3740,7 +3749,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-03-06 23:18:27 JST
|
||||
Last updated 2010-03-07 00:00:09 JST
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
|
|
@ -1330,6 +1330,11 @@ uri::
|
|||
|
||||
URI
|
||||
|
||||
status::
|
||||
|
||||
'used' if the URI is already used. 'waiting' if the URI is waiting
|
||||
in the queue.
|
||||
|
||||
*aria2.getFiles* 'gid'
|
||||
|
||||
This method returns file list of the download denoted by 'gid'. 'gid'
|
||||
|
|
|
@ -83,6 +83,7 @@ const BDE BDE_WAITING = BDE("waiting");
|
|||
const BDE BDE_REMOVED = BDE("removed");
|
||||
const BDE BDE_ERROR = BDE("error");
|
||||
const BDE BDE_COMPLETE = BDE("complete");
|
||||
const BDE BDE_USED = BDE("used");
|
||||
|
||||
const std::string KEY_GID = "gid";
|
||||
const std::string KEY_ERROR_CODE = "errorCode";
|
||||
|
@ -311,6 +312,30 @@ BDE RemoveXmlRpcMethod::process(const XmlRpcRequest& req, DownloadEngine* e)
|
|||
return createGIDResponse(gid);
|
||||
}
|
||||
|
||||
static void createUriEntry(BDE& uriList, const SharedHandle<FileEntry>& file)
|
||||
{
|
||||
{
|
||||
const std::deque<std::string>& uris = file->getSpentUris();
|
||||
for(std::deque<std::string>::const_iterator i = uris.begin(),
|
||||
eoi = uris.end(); i != eoi; ++i) {
|
||||
BDE entry = BDE::dict();
|
||||
entry[KEY_URI] = *i;
|
||||
entry[KEY_STATUS] = BDE_USED;
|
||||
uriList << entry;
|
||||
}
|
||||
}
|
||||
{
|
||||
const std::deque<std::string>& uris = file->getRemainingUris();
|
||||
for(std::deque<std::string>::const_iterator i = uris.begin(),
|
||||
eoi = uris.end(); i != eoi; ++i) {
|
||||
BDE entry = BDE::dict();
|
||||
entry[KEY_URI] = *i;
|
||||
entry[KEY_STATUS] = BDE_WAITING;
|
||||
uriList << entry;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<typename InputIterator>
|
||||
static void createFileEntry(BDE& files, InputIterator first, InputIterator last)
|
||||
{
|
||||
|
@ -323,14 +348,7 @@ static void createFileEntry(BDE& files, InputIterator first, InputIterator last)
|
|||
entry[KEY_LENGTH] = util::uitos((*first)->getLength());
|
||||
|
||||
BDE uriList = BDE::list();
|
||||
std::vector<std::string> uris;
|
||||
(*first)->getUris(uris);
|
||||
for(std::vector<std::string>::const_iterator i = uris.begin(),
|
||||
eoi = uris.end(); i != eoi; ++i) {
|
||||
BDE uriEntry = BDE::dict();
|
||||
uriEntry[KEY_URI] = *i;
|
||||
uriList << uriEntry;
|
||||
}
|
||||
createUriEntry(uriList, *first);
|
||||
entry[KEY_URIS] = uriList;
|
||||
files << entry;
|
||||
}
|
||||
|
@ -559,14 +577,7 @@ BDE GetUrisXmlRpcMethod::process
|
|||
BDE uriList = BDE::list();
|
||||
// TODO Current implementation just returns first FileEntry's URIs.
|
||||
if(!group->getDownloadContext()->getFileEntries().empty()) {
|
||||
std::vector<std::string> uris;
|
||||
group->getDownloadContext()->getFirstFileEntry()->getUris(uris);
|
||||
for(std::vector<std::string>::const_iterator i = uris.begin(),
|
||||
eoi = uris.end(); i != eoi; ++i) {
|
||||
BDE entry = BDE::dict();
|
||||
entry[KEY_URI] = *i;
|
||||
uriList << entry;
|
||||
}
|
||||
createUriEntry(uriList, group->getDownloadContext()->getFirstFileEntry());
|
||||
}
|
||||
return uriList;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue