2010-10-31 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>

Added XML-RPC examples.
	* doc/aria2c.1.txt
This commit is contained in:
Tatsuhiro Tsujikawa 2010-10-31 08:51:26 +00:00
parent 35cc4ed1e7
commit 064fc46637
4 changed files with 472 additions and 28 deletions

View File

@ -1,3 +1,8 @@
2010-10-31 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added XML-RPC examples.
* doc/aria2c.1.txt
2010-10-31 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Return empty range if byte-range-resp-spec or instance-length is

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: 10/30/2010
.\" Date: 10/31/2010
.\" Manual: Aria2 Manual
.\" Source: Aria2 1.10.5
.\" Language: English
.\"
.TH "ARIA2C" "1" "10/30/2010" "Aria2 1\&.10\&.5" "Aria2 Manual"
.TH "ARIA2C" "1" "10/31/2010" "Aria2 1\&.10\&.5" "Aria2 Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
@ -2919,7 +2919,7 @@ All code examples come from Python2\&.7 interpreter\&.
.sp
This method adds new HTTP(S)/FTP/BitTorrent Magnet URI\&. \fIuris\fR is of type array and its element is URI which is of type string\&. For BitTorrent Magnet URI, \fIuris\fR must have only one element and it should be BitTorrent Magnet URI\&. URIs in \fIuris\fR must point to the same file\&. If you mix other URIs which point to another file, aria2 does not complain but download may fail\&. \fIoptions\fR is of type struct and its members are a pair of option name and value\&. See \fBOptions\fR below for more details\&. If \fIposition\fR is given as an integer starting from 0, the new download is inserted at \fIposition\fR in the waiting queue\&. If \fIposition\fR is not given or \fIposition\fR is larger than the size of the queue, it is appended at the end of the queue\&. This method returns GID of registered download\&.
.sp
Adding http://example\&.org/file to aria2:
The following example adds http://example\&.org/file to aria2:
.sp
.if n \{\
.RS 4
@ -2934,7 +2934,7 @@ Adding http://example\&.org/file to aria2:
.RE
.\}
.sp
Adding 2 sources and some options:
The following example adds 2 sources and some options:
.sp
.if n \{\
.RS 4
@ -2947,7 +2947,7 @@ Adding 2 sources and some options:
.RE
.\}
.sp
Adding a download and insert it to the front of waiting downloads:
The following example adds a download and insert it to the front of waiting downloads:
.sp
.if n \{\
.RS 4
@ -2971,7 +2971,7 @@ Adding a download and insert it to the front of waiting downloads:
.sp
This method adds BitTorrent download by uploading \&.torrent file\&. If you want to add BitTorrent Magnet URI, use \fBaria2\&.addUri\fR method instead\&. \fItorrent\fR is of type base64 which contains Base64\-encoded \&.torrent file\&. \fIuris\fR is of type array and its element is URI which is of type string\&. \fIuris\fR is used for Web\-seeding\&. For single file torrents, URI can be a complete URI pointing to the resource or if URI ends with /, name in torrent file is added\&. For multi\-file torrents, name and path in torrent are added to form a URI for each file\&. \fIoptions\fR is of type struct and its members are a pair of option name and value\&. See \fBOptions\fR below for more details\&. If \fIposition\fR is given as an integer starting from 0, the new download is inserted at \fIposition\fR in the waiting queue\&. If \fIposition\fR is not given or \fIposition\fR is larger than the size of the queue, it is appended at the end of the queue\&. This method returns GID of registered download\&. Please note that the downloads added by this method are not saved by \fB\-\-save\-session\fR\&.
.sp
Adding local file file\&.torrent to aria2:
The following example adds local file file\&.torrent to aria2:
.sp
.if n \{\
.RS 4
@ -2997,7 +2997,7 @@ Adding local file file\&.torrent to aria2:
.sp
This method adds Metalink download by uploading \&.metalink file\&. \fImetalink\fR is of type base64 which contains Base64\-encoded \&.metalink file\&. \fIoptions\fR is of type struct and its members are a pair of option name and value\&. See \fBOptions\fR below for more details\&. If \fIposition\fR is given as an integer starting from 0, the new download is inserted at \fIposition\fR in the waiting queue\&. If \fIposition\fR is not given or \fIposition\fR is larger than the size of the queue, it is appended at the end of the queue\&. This method returns array of GID of registered download\&. Please note that the downloads added by this method are not saved by \fB\-\-save\-session\fR\&.
.sp
Adding local file file\&.meta4 to aria2:
The following example adds local file file\&.meta4 to aria2:
.sp
.if n \{\
.RS 4
@ -3023,7 +3023,7 @@ Adding local file file\&.meta4 to aria2:
.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\&.
.sp
Removing download whose GID is \fI3\fR:
The following example removes download whose GID is "3":
.sp
.if n \{\
.RS 4
@ -3260,7 +3260,7 @@ name in info dictionary\&. name\&.utf\-8 is used if available\&.
.RE
.RE
.sp
Get information about download whose GID is \fI1\fR:
The following example gets information about download whose GID is "1":
.sp
.if n \{\
.RS 4
@ -3295,7 +3295,7 @@ Get information about download whose GID is \fI1\fR:
.RE
.\}
.sp
Get information specifying keys you are interested in:
The following example gets information specifying keys you are interested in:
.sp
.if n \{\
.RS 4
@ -3333,6 +3333,21 @@ if the URI is already used\&.
\fIwaiting\fR
if the URI is waiting in the queue\&.
.RE
.sp
.if n \{\
.RS 4
.\}
.nf
>>> import xmlrpclib
>>> from pprint import pprint
>>> s = xmlrpclib\&.ServerProxy(\*(Aqhttp://localhost:6800/rpc\*(Aq)
>>> r = s\&.aria2\&.getUris(\*(Aq1\*(Aq)
>>> pprint(r)
[{\*(Aqstatus\*(Aq: \*(Aqused\*(Aq, \*(Aquri\*(Aq: \*(Aqhttp://example\&.org/file\*(Aq}]
.fi
.if n \{\
.RE
.\}
.RE
.sp
.it 1 an-trap
@ -3375,6 +3390,26 @@ Returns the list of URI for this file\&. The element of list is the same struct
\fBaria2\&.getUris\fR
method\&.
.RE
.sp
.if n \{\
.RS 4
.\}
.nf
>>> import xmlrpclib
>>> from pprint import pprint
>>> s = xmlrpclib\&.ServerProxy(\*(Aqhttp://localhost:6800/rpc\*(Aq)
>>> r = s\&.aria2\&.getFiles(\*(Aq1\*(Aq)
>>> pprint(r)
[{\*(Aqindex\*(Aq: \*(Aq1\*(Aq,
\*(Aqlength\*(Aq: \*(Aq34896138\*(Aq,
\*(Aqpath\*(Aq: \*(Aq/downloads/file\*(Aq,
\*(Aqselected\*(Aq: \*(Aqtrue\*(Aq,
\*(Aquris\*(Aq: [{\*(Aqstatus\*(Aq: \*(Aqused\*(Aq,
\*(Aquri\*(Aq: \*(Aqhttp://example\&.org/file\*(Aq}]}]
.fi
.if n \{\
.RE
.\}
.RE
.sp
.it 1 an-trap
@ -3431,6 +3466,38 @@ seeder
.RS 4
"true" is this client is a seeder\&. Otherwise "false"\&.
.RE
.sp
.if n \{\
.RS 4
.\}
.nf
>>> import xmlrpclib
>>> from pprint import pprint
>>> s = xmlrpclib\&.ServerProxy(\*(Aqhttp://localhost:6800/rpc\*(Aq)
>>> r = s\&.aria2\&.getPeers(\*(Aq1\*(Aq)
>>> pprint(r)
[{\*(AqamChoking\*(Aq: \*(Aqtrue\*(Aq,
\*(Aqbitfield\*(Aq: \*(Aqffffffffffffffffffffffffffffffffffffffff\*(Aq,
\*(AqdownloadSpeed\*(Aq: \*(Aq10602\*(Aq,
\*(Aqip\*(Aq: \*(Aq10\&.0\&.0\&.9\*(Aq,
\*(AqpeerChoking\*(Aq: \*(Aqfalse\*(Aq,
\*(AqpeerId\*(Aq: \*(Aqaria2%2F1%2E10%2E5%2D%87%2A%EDz%2F%F7%E6\*(Aq,
\*(Aqport\*(Aq: \*(Aq6881\*(Aq,
\*(Aqseeder\*(Aq: \*(Aqtrue\*(Aq,
\*(AquploadSpeed\*(Aq: \*(Aq0\*(Aq},
{\*(AqamChoking\*(Aq: \*(Aqfalse\*(Aq,
\*(Aqbitfield\*(Aq: \*(Aqffffeff0fffffffbfffffff9fffffcfff7f4ffff\*(Aq,
\*(AqdownloadSpeed\*(Aq: \*(Aq8654\*(Aq,
\*(Aqip\*(Aq: \*(Aq10\&.0\&.0\&.30\*(Aq,
\*(AqpeerChoking\*(Aq: \*(Aqfalse\*(Aq,
\*(AqpeerId\*(Aq: \*(Aqbittorrent client758\*(Aq,
\*(Aqport\*(Aq: \*(Aq37842\*(Aq,
\*(Aqseeder\*(Aq: \*(Aqfalse,
\*(AquploadSpeed\*(Aq: \*(Aq6890\*(Aq}]
.fi
.if n \{\
.RE
.\}
.RE
.sp
.it 1 an-trap
@ -3467,6 +3534,24 @@ downloadSpeed
Download speed (byte/sec)
.RE
.RE
.sp
.if n \{\
.RS 4
.\}
.nf
>>> import xmlrpclib
>>> from pprint import pprint
>>> s = xmlrpclib\&.ServerProxy(\*(Aqhttp://localhost:6800/rpc\*(Aq)
>>> r = s\&.aria2\&.getServers(\*(Aq1\*(Aq)
>>> pprint(r)
[{\*(Aqindex\*(Aq: \*(Aq1\*(Aq,
\*(Aqservers\*(Aq: [{\*(AqcurrentUri\*(Aq: \*(Aqhttp://example\&.org/dl/file\*(Aq,
\*(AqdownloadSpeed\*(Aq: \*(Aq20285\*(Aq,
\*(Aquri\*(Aq: \*(Aqhttp://example\&.org/file\*(Aq}]}]
.fi
.if n \{\
.RE
.\}
.RE
.sp
.it 1 an-trap
@ -3525,6 +3610,21 @@ The response is of type array and its element is the same struct returned by \fB
This method changes the position of the download denoted by \fIgid\fR\&. \fIpos\fR is of type integer\&. \fIhow\fR is of type string\&. If \fIhow\fR is "POS_SET", it moves the download to a position relative to the beginning of the queue\&. If \fIhow\fR is "POS_CUR", it moves the download to a position relative to the current position\&. If \fIhow\fR is "POS_END", it moves the download to a position relative to the end of the queue\&. If the destination position is less than 0 or beyond the end of the queue, it moves the download to the beginning or the end of the queue respectively\&. The response is of type integer and it is the destination position\&.
.sp
For example, if GID#1 is placed in position 3, aria2\&.changePosition(1, \-1, POS_CUR) will change its position to 2\&. Additional aria2\&.changePosition(1, 0, POS_SET) will change its position to 0(the beginning of the queue)\&.
.sp
The following example moves the download whose GID is "3" to the front of the waiting queue:
.sp
.if n \{\
.RS 4
.\}
.nf
>>> import xmlrpclib
>>> s = xmlrpclib\&.ServerProxy(\*(Aqhttp://localhost:6800/rpc\*(Aq)
>>> s\&.aria2\&.changePosition(\*(Aq3\*(Aq, 0, \*(AqPOS_SET\*(Aq)
0
.fi
.if n \{\
.RE
.\}
.RE
.sp
.it 1 an-trap
@ -3536,6 +3636,21 @@ For example, if GID#1 is placed in position 3, aria2\&.changePosition(1, \-1, PO
.RS 4
.sp
This method removes URIs in \fIdelUris\fR from and appends URIs in \fIaddUris\fR to download denoted by \fIgid\fR\&. \fIdelUris\fR and \fIaddUris\fR are list of string\&. A download can contain multiple files and URIs are attached to each file\&. \fIfileIndex\fR is used to select which file to remove/attach given URIs\&. \fIfileIndex\fR is 1\-based\&. \fIposition\fR is used to specify where URIs are inserted in the existing waiting URI list\&. \fIposition\fR is 0\-based\&. When \fIposition\fR is omitted, URIs are appended to the back of the list\&. This method first execute removal and then addition\&. \fIposition\fR is the position after URIs are removed, not the position when this method is called\&. When removing URI, if same URIs exist in download, only one of them is removed for each URI in \fIdelUris\fR\&. In other words, there are three URIs "http://example\&.org/aria2" and you want remove them all, you have to specify (at least) 3 "http://example\&.org/aria2" in \fIdelUris\fR\&. This method returns a list which contains 2 integers\&. The first integer is the number of URIs deleted\&. The second integer is the number of URIs added\&.
.sp
The following example adds 1 URI http://example\&.org/file to the file whose index is "1" and belongs to the download whose GID is "2":
.sp
.if n \{\
.RS 4
.\}
.nf
>>> import xmlrpclib
>>> s = xmlrpclib\&.ServerProxy(\*(Aqhttp://localhost:6800/rpc\*(Aq)
>>> s\&.aria2\&.changeUri(\*(Aq2\*(Aq, 1, [], [\*(Aqhttp://example\&.org/file\*(Aq])
[0, 1]
.fi
.if n \{\
.RE
.\}
.RE
.sp
.it 1 an-trap
@ -3547,6 +3662,27 @@ This method removes URIs in \fIdelUris\fR from and appends URIs in \fIaddUris\fR
.RS 4
.sp
This method returns options of the download denoted by \fIgid\fR\&. The response is of type struct\&. Its key is the name of option\&. The value type is string\&.
.sp
The following example gets options of the download whose GID is "1":
.sp
.if n \{\
.RS 4
.\}
.nf
>>> import xmlrpclib
>>> from pprint import pprint
>>> s = xmlrpclib\&.ServerProxy(\*(Aqhttp://localhost:6800/rpc\*(Aq)
>>> r = s\&.aria2\&.getOption(\*(Aq1\*(Aq)
>>> pprint(r)
{\*(Aqallow\-overwrite\*(Aq: \*(Aqfalse\*(Aq,
\*(Aqallow\-piece\-length\-change\*(Aq: \*(Aqfalse\*(Aq,
\*(Aqalways\-resume\*(Aq: \*(Aqtrue\*(Aq,
\*(Aqasync\-dns\*(Aq: \*(Aqtrue\*(Aq,
\&.\&.\&.\&.
.fi
.if n \{\
.RE
.\}
.RE
.sp
.it 1 an-trap
@ -3558,6 +3694,21 @@ This method returns options of the download denoted by \fIgid\fR\&. The response
.RS 4
.sp
This method changes options of the download denoted by \fIgid\fR dynamically\&. \fIgid\fR is of type string\&. \fIoptions\fR is of type struct and the available options are: \fBbt\-max\-peers\fR, \fBbt\-request\-peer\-speed\-limit\fR, \fBmax\-download\-limit\fR and \fBmax\-upload\-limit\fR\&. This method returns "OK" for success\&.
.sp
The following example sets \fBmax\-download\-limit\fR option to "20K" for the download whose GID is "1"\&.
.sp
.if n \{\
.RS 4
.\}
.nf
>>> import xmlrpclib
>>> s = xmlrpclib\&.ServerProxy(\*(Aqhttp://localhost:6800/rpc\*(Aq)
>>> s\&.aria2\&.changeOption(\*(Aq1\*(Aq, {\*(Aqmax\-download\-limit\*(Aq:\*(Aq20K\*(Aq})
\*(AqOK\*(Aq
.fi
.if n \{\
.RE
.\}
.RE
.sp
.it 1 an-trap

View File

@ -3285,7 +3285,8 @@ the new download is inserted at <em>position</em> in the waiting queue. If
<em>position</em> is not given or <em>position</em> is larger than the size of the
queue, it is appended at the end of the queue. This method returns
GID of registered download.</p></div>
<div class="paragraph"><p>Adding http://example.org/file to aria2:</p></div>
<h5 id="_example">Example</h5>
<div class="paragraph"><p>The following example adds http://example.org/file to aria2:</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>&gt;&gt;&gt; import xmlrpclib
@ -3293,13 +3294,14 @@ GID of registered download.</p></div>
&gt;&gt;&gt; s.aria2.addUri(['http://example.org/file'])
'1'</tt></pre>
</div></div>
<div class="paragraph"><p>Adding 2 sources and some options:</p></div>
<div class="paragraph"><p>The following example adds 2 sources and some options:</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>&gt;&gt;&gt; s.aria2.addUri(['http://example.org/file'], dict(dir="/tmp"))
'2'</tt></pre>
</div></div>
<div class="paragraph"><p>Adding a download and insert it to the front of waiting downloads:</p></div>
<div class="paragraph"><p>The following example adds a download and insert it to the front of
waiting downloads:</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>&gt;&gt;&gt; s.aria2.addUri(['http://example.org/file'], {}, 0)
@ -3323,7 +3325,8 @@ given as an integer starting from 0, the new download is inserted at
end of the queue. This method returns GID of registered download.
Please note that the downloads added by this method are not saved by
<strong><a href="#aria2_optref_save_session">--save-session</a></strong>.</p></div>
<div class="paragraph"><p>Adding local file file.torrent to aria2:</p></div>
<h5 id="_example_2">Example</h5>
<div class="paragraph"><p>The following example adds local file file.torrent to aria2:</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>&gt;&gt;&gt; import xmlrpclib
@ -3343,7 +3346,8 @@ given or <em>position</em> is larger than the size of the queue, it is
appended at the end of the queue. This method returns array of GID of
registered download. Please note that the downloads added by this
method are not saved by <strong><a href="#aria2_optref_save_session">--save-session</a></strong>.</p></div>
<div class="paragraph"><p>Adding local file file.meta4 to aria2:</p></div>
<h5 id="_example_3">Example</h5>
<div class="paragraph"><p>The following example adds local file file.meta4 to aria2:</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>&gt;&gt;&gt; import xmlrpclib
@ -3357,7 +3361,8 @@ method are not saved by <strong><a href="#aria2_optref_save_session">--save-sess
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.</p></div>
<div class="paragraph"><p>Removing download whose GID is <em>3</em>:</p></div>
<h5 id="_example_4">Example</h5>
<div class="paragraph"><p>The following example removes download whose GID is "3":</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>&gt;&gt;&gt; import xmlrpclib
@ -3645,7 +3650,9 @@ name
</dl></div>
</dd>
</dl></div>
<div class="paragraph"><p>Get information about download whose GID is <em>1</em>:</p></div>
<h5 id="_example_5">Example</h5>
<div class="paragraph"><p>The following example gets information about download whose GID is
"1":</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>&gt;&gt;&gt; import xmlrpclib
@ -3673,7 +3680,8 @@ name
'uploadLength': '0',
'uploadSpeed': '0'}</tt></pre>
</div></div>
<div class="paragraph"><p>Get information specifying keys you are interested in:</p></div>
<div class="paragraph"><p>The following example gets information specifying keys you are
interested in:</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>&gt;&gt;&gt; r = s.aria2.tellStatus('1', ['gid', 'totalLength', 'completedLength'])
@ -3704,6 +3712,16 @@ status
</p>
</dd>
</dl></div>
<h5 id="_example_6">Example</h5>
<div class="listingblock">
<div class="content">
<pre><tt>&gt;&gt;&gt; import xmlrpclib
&gt;&gt;&gt; from pprint import pprint
&gt;&gt;&gt; s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
&gt;&gt;&gt; r = s.aria2.getUris('1')
&gt;&gt;&gt; pprint(r)
[{'status': 'used', 'uri': 'http://example.org/file'}]</tt></pre>
</div></div>
<h4 id="aria2_xmlrpc_aria2_getFiles"><strong>aria2.getFiles</strong> (<em>gid</em>)</h4>
<h5 id="_description_15">Description</h5>
<div class="paragraph"><p>This method returns file list of the download denoted by <em>gid</em>. <em>gid</em>
@ -3755,6 +3773,21 @@ uris
</p>
</dd>
</dl></div>
<h5 id="_example_7">Example</h5>
<div class="listingblock">
<div class="content">
<pre><tt>&gt;&gt;&gt; import xmlrpclib
&gt;&gt;&gt; from pprint import pprint
&gt;&gt;&gt; s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
&gt;&gt;&gt; r = s.aria2.getFiles('1')
&gt;&gt;&gt; pprint(r)
[{'index': '1',
'length': '34896138',
'path': '/downloads/file',
'selected': 'true',
'uris': [{'status': 'used',
'uri': 'http://example.org/file'}]}]</tt></pre>
</div></div>
<h4 id="aria2_xmlrpc_aria2_getPeers"><strong>aria2.getPeers</strong> (<em>gid</em>)</h4>
<h5 id="_description_16">Description</h5>
<div class="paragraph"><p>This method returns peer list of the download denoted by <em>gid</em>. <em>gid</em>
@ -3838,6 +3871,33 @@ seeder
</p>
</dd>
</dl></div>
<h5 id="_example_8">Example</h5>
<div class="listingblock">
<div class="content">
<pre><tt>&gt;&gt;&gt; import xmlrpclib
&gt;&gt;&gt; from pprint import pprint
&gt;&gt;&gt; s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
&gt;&gt;&gt; r = s.aria2.getPeers('1')
&gt;&gt;&gt; pprint(r)
[{'amChoking': 'true',
'bitfield': 'ffffffffffffffffffffffffffffffffffffffff',
'downloadSpeed': '10602',
'ip': '10.0.0.9',
'peerChoking': 'false',
'peerId': 'aria2%2F1%2E10%2E5%2D%87%2A%EDz%2F%F7%E6',
'port': '6881',
'seeder': 'true',
'uploadSpeed': '0'},
{'amChoking': 'false',
'bitfield': 'ffffeff0fffffffbfffffff9fffffcfff7f4ffff',
'downloadSpeed': '8654',
'ip': '10.0.0.30',
'peerChoking': 'false',
'peerId': 'bittorrent client758',
'port': '37842',
'seeder': 'false,
'uploadSpeed': '6890'}]</tt></pre>
</div></div>
<h4 id="aria2_xmlrpc_aria2_getServers"><strong>aria2.getServers</strong> (<em>gid</em>)</h4>
<h5 id="_description_17">Description</h5>
<div class="paragraph"><p>This method returns currently connected HTTP(S)/FTP servers of the download denoted by <em>gid</em>. <em>gid</em> is of type string. The response
@ -3889,6 +3949,19 @@ downloadSpeed
</dl></div>
</dd>
</dl></div>
<h5 id="_example_9">Example</h5>
<div class="listingblock">
<div class="content">
<pre><tt>&gt;&gt;&gt; import xmlrpclib
&gt;&gt;&gt; from pprint import pprint
&gt;&gt;&gt; s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
&gt;&gt;&gt; r = s.aria2.getServers('1')
&gt;&gt;&gt; pprint(r)
[{'index': '1',
'servers': [{'currentUri': 'http://example.org/dl/file',
'downloadSpeed': '20285',
'uri': 'http://example.org/file'}]}]</tt></pre>
</div></div>
<h4 id="aria2_xmlrpc_aria2_tellActive"><strong>aria2.tellActive</strong> (<em>[keys]</em>)</h4>
<h5 id="_description_18">Description</h5>
<div class="paragraph"><p>This method returns the list of active downloads. The response is of
@ -3940,6 +4013,16 @@ destination position.</p></div>
-1, POS_CUR) will change its position to 2. Additional
aria2.changePosition(1, 0, POS_SET) will change its position to 0(the
beginning of the queue).</p></div>
<h5 id="_example_10">Example</h5>
<div class="paragraph"><p>The following example moves the download whose GID is "3" to the
front of the waiting queue:</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>&gt;&gt;&gt; import xmlrpclib
&gt;&gt;&gt; s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
&gt;&gt;&gt; s.aria2.changePosition('3', 0, 'POS_SET')
0</tt></pre>
</div></div>
<h4 id="aria2_xmlrpc_aria2_changeUri"><strong>aria2.changeUri</strong> (<em>gid, fileIndex, delUris, addUris[, position]</em>)</h4>
<h5 id="_description_22">Description</h5>
<div class="paragraph"><p>This method removes URIs in <em>delUris</em> from and appends URIs in
@ -3959,11 +4042,36 @@ specify (at least) 3 "http://example.org/aria2" in <em>delUris</em>. This
method returns a list which contains 2 integers. The first integer is
the number of URIs deleted. The second integer is the number of URIs
added.</p></div>
<h5 id="_example_11">Example</h5>
<div class="paragraph"><p>The following example adds 1 URI http://example.org/file to the file
whose index is "1" and belongs to the download whose GID is "2":</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>&gt;&gt;&gt; import xmlrpclib
&gt;&gt;&gt; s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
&gt;&gt;&gt; s.aria2.changeUri('2', 1, [], ['http://example.org/file'])
[0, 1]</tt></pre>
</div></div>
<h4 id="aria2_xmlrpc_aria2_getOption"><strong>aria2.getOption</strong> (<em>gid</em>)</h4>
<h5 id="_description_23">Description</h5>
<div class="paragraph"><p>This method returns options of the download denoted by <em>gid</em>. The
response is of type struct. Its key is the name of option. The value type
is string.</p></div>
<h5 id="_example_12">Example</h5>
<div class="paragraph"><p>The following example gets options of the download whose GID is "1":</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>&gt;&gt;&gt; import xmlrpclib
&gt;&gt;&gt; from pprint import pprint
&gt;&gt;&gt; s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
&gt;&gt;&gt; r = s.aria2.getOption('1')
&gt;&gt;&gt; pprint(r)
{'allow-overwrite': 'false',
'allow-piece-length-change': 'false',
'always-resume': 'true',
'async-dns': 'true',
....</tt></pre>
</div></div>
<h4 id="aria2_xmlrpc_aria2_changeOption"><strong>aria2.changeOption</strong> (<em>gid, options</em>)</h4>
<h5 id="_description_24">Description</h5>
<div class="paragraph"><p>This method changes options of the download denoted by <em>gid</em>
@ -3971,6 +4079,17 @@ dynamically. <em>gid</em> is of type string. <em>options</em> is of type struc
and the available options are: <strong><a href="#aria2_optref_bt_max_peers">bt-max-peers</a></strong>,
<strong><a href="#aria2_optref_bt_request_peer_speed_limit">bt-request-peer-speed-limit</a></strong>, <strong><a href="#aria2_optref_max_download_limit">max-download-limit</a></strong> and
<strong><a href="#aria2_optref_max_upload_limit">max-upload-limit</a></strong>. This method returns "OK" for success.</p></div>
<h5 id="_example_13">Example</h5>
<div class="paragraph"><p>The following example sets
<strong><a href="#aria2_optref_max_download_limit">max-download-limit</a></strong> option to "20K" for
the download whose GID is "1".</p></div>
<div class="listingblock">
<div class="content">
<pre><tt>&gt;&gt;&gt; import xmlrpclib
&gt;&gt;&gt; s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
&gt;&gt;&gt; s.aria2.changeOption('1', {'max-download-limit':'20K'})
'OK'</tt></pre>
</div></div>
<h4 id="aria2_xmlrpc_aria2_getGlobalOption"><strong>aria2.getGlobalOption</strong> ()</h4>
<h5 id="_description_25">Description</h5>
<div class="paragraph"><p>This method returns global options. The response is of type
@ -4013,6 +4132,7 @@ enabledFeatures
</p>
</dd>
</dl></div>
<h5 id="_example_14">Example</h5>
<div class="listingblock">
<div class="content">
<pre><tt>&gt;&gt;&gt; import xmlrpclib
@ -4044,6 +4164,7 @@ sessionId
</p>
</dd>
</dl></div>
<h5 id="_example_15">Example</h5>
<div class="listingblock">
<div class="content">
<pre><tt>&gt;&gt;&gt; import xmlrpclib
@ -4069,6 +4190,7 @@ method. This method returns array of responses. The element of array
will either be a one-item array containing the return value of each
method call or struct of fault element if an encapsulated method call
fails.</p></div>
<h5 id="_example_16">Example</h5>
<div class="paragraph"><p>In the following example, we add 2 downloads. First one is
http://example.org/file and second one is file.torrent:</p></div>
<div class="listingblock">
@ -4166,7 +4288,7 @@ r = s.aria2.addUri(["http://localhost/aria2.tar.bz2"], {"dir":"/downloads"})
pprint(r)</tt></pre>
</div></div>
</div>
<h2 id="_example">EXAMPLE</h2>
<h2 id="_example_17">EXAMPLE</h2>
<div class="sectionbody">
<h3 id="_http_ftp_segmented_download">HTTP/FTP Segmented Download</h3><div style="clear:left"></div>
<h4 id="_download_a_file">Download a file</h4>
@ -4586,7 +4708,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-10-30 21:20:38 JST
Last updated 2010-10-31 17:50:07 JST
</div>
</div>
</body>

View File

@ -1473,7 +1473,11 @@ the new download is inserted at 'position' in the waiting queue. If
queue, it is appended at the end of the queue. This method returns
GID of registered download.
Adding \http://example.org/file to aria2:
Example
+++++++
The following example adds \http://example.org/file to aria2:
----------------------------------------------------------
>>> import xmlrpclib
>>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
@ -1481,13 +1485,16 @@ Adding \http://example.org/file to aria2:
'1'
----------------------------------------------------------
Adding 2 sources and some options:
The following example adds 2 sources and some options:
--------------------------------------------------------------------------
>>> s.aria2.addUri(['http://example.org/file'], dict(dir="/tmp"))
'2'
--------------------------------------------------------------------------
Adding a download and insert it to the front of waiting downloads:
The following example adds a download and insert it to the front of
waiting downloads:
---------------------------------------------------------------
>>> s.aria2.addUri(['http://example.org/file'], {}, 0)
'3'
@ -1517,7 +1524,11 @@ end of the queue. This method returns GID of registered download.
Please note that the downloads added by this method are not saved by
*<<aria2_optref_save_session, --save-session>>*.
Adding local file file.torrent to aria2:
Example
+++++++
The following example adds local file file.torrent to aria2:
---------------------------------------------------------------------
>>> import xmlrpclib
>>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
@ -1543,7 +1554,11 @@ appended at the end of the queue. This method returns array of GID of
registered download. Please note that the downloads added by this
method are not saved by *<<aria2_optref_save_session, --save-session>>*.
Adding local file file.meta4 to aria2:
Example
+++++++
The following example adds local file file.meta4 to aria2:
--------------------------------------------------------------------
>>> import xmlrpclib
>>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
@ -1563,7 +1578,11 @@ 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.
Removing download whose GID is '3':
Example
+++++++
The following example removes download whose GID is "3":
--------------------------------------------------------------------
>>> import xmlrpclib
>>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
@ -1795,7 +1814,12 @@ bittorrent::
name in info dictionary. name.utf-8 is used if available.
Get information about download whose GID is '1':
Example
+++++++
The following example gets information about download whose GID is
"1":
--------------------------------------------------------------------
>>> import xmlrpclib
>>> from pprint import pprint
@ -1823,7 +1847,9 @@ Get information about download whose GID is '1':
'uploadSpeed': '0'}
--------------------------------------------------------------------
Get information specifying keys you are interested in:
The following example gets information specifying keys you are
interested in:
--------------------------------------------------------------------------
>>> r = s.aria2.tellStatus('1', ['gid', 'totalLength', 'completedLength'])
>>> pprint(r)
@ -1850,6 +1876,18 @@ status::
'used' if the URI is already used. 'waiting' if the URI is waiting
in the queue.
Example
+++++++
--------------------------------------------------------------------
>>> import xmlrpclib
>>> from pprint import pprint
>>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
>>> r = s.aria2.getUris('1')
>>> pprint(r)
[{'status': 'used', 'uri': 'http://example.org/file'}]
--------------------------------------------------------------------
[[aria2_xmlrpc_aria2_getFiles]]
*aria2.getFiles* ('gid')
^^^^^^^^^^^^^^^^^^^^^^^^
@ -1885,6 +1923,23 @@ uris::
Returns the list of URI for this file. The element of list is the
same struct used in *<<aria2_xmlrpc_aria2_getUris, aria2.getUris>>* method.
Example
+++++++
--------------------------------------------------------------------------
>>> import xmlrpclib
>>> from pprint import pprint
>>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
>>> r = s.aria2.getFiles('1')
>>> pprint(r)
[{'index': '1',
'length': '34896138',
'path': '/downloads/file',
'selected': 'true',
'uris': [{'status': 'used',
'uri': 'http://example.org/file'}]}]
--------------------------------------------------------------------------
[[aria2_xmlrpc_aria2_getPeers]]
*aria2.getPeers* ('gid')
^^^^^^^^^^^^^^^^^^^^^^^^
@ -1936,6 +1991,35 @@ seeder::
"true" is this client is a seeder. Otherwise "false".
Example
+++++++
--------------------------------------------------------------------------
>>> import xmlrpclib
>>> from pprint import pprint
>>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
>>> r = s.aria2.getPeers('1')
>>> pprint(r)
[{'amChoking': 'true',
'bitfield': 'ffffffffffffffffffffffffffffffffffffffff',
'downloadSpeed': '10602',
'ip': '10.0.0.9',
'peerChoking': 'false',
'peerId': 'aria2%2F1%2E10%2E5%2D%87%2A%EDz%2F%F7%E6',
'port': '6881',
'seeder': 'true',
'uploadSpeed': '0'},
{'amChoking': 'false',
'bitfield': 'ffffeff0fffffffbfffffff9fffffcfff7f4ffff',
'downloadSpeed': '8654',
'ip': '10.0.0.30',
'peerChoking': 'false',
'peerId': 'bittorrent client758',
'port': '37842',
'seeder': 'false,
'uploadSpeed': '6890'}]
--------------------------------------------------------------------------
[[aria2_xmlrpc_aria2_getServers]]
*aria2.getServers* ('gid')
^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -1969,6 +2053,21 @@ servers::
Download speed (byte/sec)
Example
+++++++
--------------------------------------------------------------------
>>> import xmlrpclib
>>> from pprint import pprint
>>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
>>> r = s.aria2.getServers('1')
>>> pprint(r)
[{'index': '1',
'servers': [{'currentUri': 'http://example.org/dl/file',
'downloadSpeed': '20285',
'uri': 'http://example.org/file'}]}]
--------------------------------------------------------------------
[[aria2_xmlrpc_aria2_tellActive]]
*aria2.tellActive* ('[keys]')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -2051,6 +2150,19 @@ For example, if GID#1 is placed in position 3, aria2.changePosition(1,
aria2.changePosition(1, 0, POS_SET) will change its position to 0(the
beginning of the queue).
Example
+++++++
The following example moves the download whose GID is "3" to the
front of the waiting queue:
--------------------------------------------------------------------
>>> import xmlrpclib
>>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
>>> s.aria2.changePosition('3', 0, 'POS_SET')
0
--------------------------------------------------------------------
[[aria2_xmlrpc_aria2_changeUri]]
*aria2.changeUri* ('gid, fileIndex, delUris, addUris[, position]')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -2076,6 +2188,19 @@ method returns a list which contains 2 integers. The first integer is
the number of URIs deleted. The second integer is the number of URIs
added.
Example
+++++++
The following example adds 1 URI \http://example.org/file to the file
whose index is "1" and belongs to the download whose GID is "2":
--------------------------------------------------------------------
>>> import xmlrpclib
>>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
>>> s.aria2.changeUri('2', 1, [], ['http://example.org/file'])
[0, 1]
--------------------------------------------------------------------
[[aria2_xmlrpc_aria2_getOption]]
*aria2.getOption* ('gid')
^^^^^^^^^^^^^^^^^^^^^^^^^
@ -2087,6 +2212,24 @@ This method returns options of the download denoted by 'gid'. The
response is of type struct. Its key is the name of option. The value type
is string.
Example
+++++++
The following example gets options of the download whose GID is "1":
--------------------------------------------------------------------
>>> import xmlrpclib
>>> from pprint import pprint
>>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
>>> r = s.aria2.getOption('1')
>>> pprint(r)
{'allow-overwrite': 'false',
'allow-piece-length-change': 'false',
'always-resume': 'true',
'async-dns': 'true',
....
--------------------------------------------------------------------
[[aria2_xmlrpc_aria2_changeOption]]
*aria2.changeOption* ('gid, options')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -2100,6 +2243,20 @@ and the available options are: *<<aria2_optref_bt_max_peers, bt-max-peers>>*,
*<<aria2_optref_bt_request_peer_speed_limit, bt-request-peer-speed-limit>>*, *<<aria2_optref_max_download_limit, max-download-limit>>* and
*<<aria2_optref_max_upload_limit, max-upload-limit>>*. This method returns "OK" for success.
Example
+++++++
The following example sets
*<<aria2_optref_max_download_limit, max-download-limit>>* option to "20K" for
the download whose GID is "1".
--------------------------------------------------------------------
>>> import xmlrpclib
>>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
>>> s.aria2.changeOption('1', {'max-download-limit':'20K'})
'OK'
--------------------------------------------------------------------
[[aria2_xmlrpc_aria2_getGlobalOption]]
*aria2.getGlobalOption* ()
^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -2156,6 +2313,9 @@ enabledFeatures::
List of enabled features. Each feature name is of type string.
Example
+++++++
--------------------------------------------------------------------
>>> import xmlrpclib
>>> from pprint import pprint
@ -2187,6 +2347,9 @@ sessionId::
Session ID, which is generated each time when aria2 is invoked.
Example
+++++++
--------------------------------------------------------------------
>>> import xmlrpclib
>>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
@ -2230,6 +2393,9 @@ will either be a one-item array containing the return value of each
method call or struct of fault element if an encapsulated method call
fails.
Example
+++++++
In the following example, we add 2 downloads. First one is
\http://example.org/file and second one is file.torrent: