~ubuntu-branches/ubuntu/quantal/aria2/quantal

« back to all changes in this revision

Viewing changes to doc/aria2c.1.asciidoc

  • Committer: Bazaar Package Importer
  • Author(s): Kartik Mistry
  • Date: 2011-04-02 12:38:55 UTC
  • mfrom: (2.5.2 sid)
  • Revision ID: james.westby@ubuntu.com-20110402123855-znkslovhf5qvkjut
Tags: 1.11.1-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
4
4
:man source: Aria2
5
5
:man manual: Aria2 Manual
6
 
:man version: 1.10.9
 
6
:man version: 1.11.1
7
7
 
8
8
NAME
9
9
----
77
77
   usage for the options whose name includes that word.
78
78
   Available Values: '#basic', '#advanced', '#http', '#https', '#ftp',
79
79
   '#metalink', '#bittorrent', '#cookie', '#hook', '#file',
80
 
   '#xml-rpc', '#experimental', '#all'
 
80
   '#rpc', '#experimental', '#all'
81
81
   Default: '#basic'
82
82
 
83
83
HTTP/FTP Options
88
88
  defined proxy, use "".  You can override this setting and specify a
89
89
  proxy server for a particular protocol using *<<aria2_optref_http_proxy, --http-proxy>>*,
90
90
  *<<aria2_optref_https_proxy, --https-proxy>>* and *<<aria2_optref_ftp_proxy, --ftp-proxy>>* options.  This affects all URIs.
91
 
  The format of PROXY is [\\http://][USER:PASSWORD@]HOST[:PORT]
 
91
  The format of PROXY is [\\http://][USER:PASSWORD@]HOST[:PORT].
 
92
  See also *<<_environment, ENVIRONMENT>>* section.
92
93
 
93
94
[NOTE]
94
95
 
149
150
 
150
151
[[aria2_optref_max_tries]]*-m*, *--max-tries*=N::
151
152
  Set number of tries. '0' means unlimited.
 
153
  See also *<<aria2_optref_retry_wait, --retry-wait>>*.
152
154
  Default: '5'
153
155
 
154
156
[[aria2_optref_min_split_size]]*-k*, *--min-split-size*=SIZE::
201
203
  Reuse already used URIs if no unused URIs are left.
202
204
  Default: 'true'
203
205
 
 
206
[[aria2_optref_retry_wait]]*--retry-wait*=SEC::
 
207
 
 
208
  Set the seconds to wait between retries. With SEC > 0, aria2 will
 
209
  retry download when the HTTP server returns 503 response. Default:
 
210
  '0'
 
211
 
204
212
[[aria2_optref_server_stat_of]]*--server-stat-of*=FILE::
205
213
 
206
214
  Specify the filename to which performance profile of the servers is
442
450
writes the piece to the appropriate files.
443
451
 
444
452
[[aria2_optref_show_files]]*-S*, *--show-files*[='true'|'false']::
445
 
  Print file listing of .torrent or .metalink file and exit.
 
453
  Print file listing of .torrent, .meta4 and .metalink file and exit.
446
454
  In case of .torrent file, additional information
447
455
  (infohash, piece length, etc) is also printed.
448
456
 
697
705
Metalink Specific Options
698
706
~~~~~~~~~~~~~~~~~~~~~~~~~
699
707
[[aria2_optref_follow_metalink]]*--follow-metalink*='true'|'false'|'mem'::
700
 
  If 'true' or 'mem' is specified, when a file whose suffix is ".metalink" or content
701
 
  type of "application/metalink+xml" is downloaded, aria2 parses it as a metalink
 
708
  If 'true' or 'mem' is specified, when a file whose suffix is ".meta4" or ".metalink" or content
 
709
  type of "application/metalink4+xml" or "application/metalink+xml" is downloaded, aria2 parses it as a metalink
702
710
  file and downloads files mentioned in it.
703
711
  If 'mem' is specified, a metalink file is not written to the disk, but is just
704
712
  kept in memory.
707
715
 
708
716
[[aria2_optref_metalink_file]]*-M*, *--metalink-file*=METALINK_FILE::
709
717
 
710
 
  The file path to .metalink file. Reads input from stdin when '-' is
 
718
  The file path to .meta4 and .metalink file. Reads input from stdin when '-' is
711
719
  specified.  You are not required to use this option because you can
712
720
  specify .metalink files without *<<aria2_optref_metalink_file, -M>>*.
713
721
 
747
755
  protocol.
748
756
  Default: 'true'
749
757
 
750
 
XML-RPC Options
751
 
~~~~~~~~~~~~~~~
752
 
 
753
 
[[aria2_optref_enable_xml_rpc]]*--enable-xml-rpc*[='true'|'false']::
754
 
  Enable XML-RPC server.  It is strongly recommended to set username
755
 
  and password using *<<aria2_optref_xml_rpc_user, --xml-rpc-user>>* and *<<aria2_optref_xml_rpc_passwd, --xml-rpc-passwd>>*
756
 
  option. See also *<<aria2_optref_xml_rpc_listen_port, --xml-rpc-listen-port>>* option.  Default: 'false'
757
 
 
758
 
[[aria2_optref_xml_rpc_listen_all]]*--xml-rpc-listen-all*[='true'|'false']::
759
 
 
760
 
  Listen incoming XML-RPC requests on all network interfaces. If false
 
758
RPC Options
 
759
~~~~~~~~~~~
 
760
 
 
761
[[aria2_optref_enable_rpc]]*--enable-rpc*[='true'|'false']::
 
762
  Enable JSON-RPC/XML-RPC server.  It is strongly recommended to set username
 
763
  and password using *<<aria2_optref_rpc_user, --rpc-user>>* and *<<aria2_optref_rpc_passwd, --rpc-passwd>>*
 
764
  option. See also *<<aria2_optref_rpc_listen_port, --rpc-listen-port>>* option.  Default: 'false'
 
765
 
 
766
[[aria2_optref_rpc_listen_all]]*--rpc-listen-all*[='true'|'false']::
 
767
 
 
768
  Listen incoming JSON-RPC/XML-RPC requests on all network interfaces. If false
761
769
  is given, listen only on local loopback interface.  Default: 'false'
762
770
 
763
 
[[aria2_optref_xml_rpc_listen_port]]*--xml-rpc-listen-port*=PORT::
764
 
  Specify a port number for XML-RPC server to listen to.  Possible
 
771
[[aria2_optref_rpc_listen_port]]*--rpc-listen-port*=PORT::
 
772
  Specify a port number for JSON-RPC/XML-RPC server to listen to.  Possible
765
773
  Values: '1024'-'65535' Default: '6800'
766
774
 
767
 
[[aria2_optref_xml_rpc_max_request_size]]*--xml-rpc-max-request-size*=SIZE::
 
775
[[aria2_optref_rpc_max_request_size]]*--rpc-max-request-size*=SIZE::
768
776
 
769
 
  Set max size of XML-RPC request. If aria2 detects the request is
 
777
  Set max size of JSON-RPC/XML-RPC request. If aria2 detects the request is
770
778
  more than SIZE bytes, it drops connection. Default: '2M'
771
779
 
772
 
[[aria2_optref_xml_rpc_passwd]]*--xml-rpc-passwd*=PASSWD::
773
 
  Set XML-RPC password.
 
780
[[aria2_optref_rpc_passwd]]*--rpc-passwd*=PASSWD::
 
781
  Set JSON-RPC/XML-RPC password.
774
782
 
775
 
[[aria2_optref_xml_rpc_user]]*--xml-rpc-user*=USER::
776
 
  Set XML-RPC user.
 
783
[[aria2_optref_rpc_user]]*--rpc-user*=USER::
 
784
  Set JSON-RPC/XML-RPC user.
777
785
 
778
786
Advanced Options
779
787
~~~~~~~~~~~~~~~~
803
811
  Enable asynchronous DNS.
804
812
  Default: 'true'
805
813
 
 
814
[[aria2_optref_async_dns_server]]*--async-dns-server*=IPADDRESS[,...]::
 
815
 
 
816
  Comma separated list of DNS server address used in asynchronous DNS
 
817
  resolver. Usually asynchronous DNS resolver reads DNS server
 
818
  addresses from '/etc/resolv.conf'. When this option is used, it uses
 
819
  DNS servers specified in this option instead of ones in
 
820
  '/etc/resolv.conf'. You can specify both IPv4 and IPv6 address. This
 
821
  option is useful when the system does not have '/etc/resolv.conf' and
 
822
  user does not have the permission to create it.
 
823
 
806
824
[[aria2_optref_auto_file_renaming]]*--auto-file-renaming*[='true'|'false']::
807
825
  Rename file name if the same file already exists.
808
826
  This option works only in HTTP(S)/FTP download.
825
843
  will be ignored.  This function uses If-Modified-Since header to get
826
844
  only newer file conditionally. When getting modification time of
827
845
  local file, it uses user supplied filename(see *<<aria2_optref_out, --out>>* option) or
828
 
  filename part in URI if *<<aria2_optref_out, --out>>* is not specified.  Default: 'false'
 
846
  filename part in URI if *<<aria2_optref_out, --out>>* is not specified.
 
847
  To overwrite existing file, *<<aria2_optref_allow_overwrite, --allow-overwrite>>* is required.
 
848
  Default: 'false'
829
849
 
830
850
[[aria2_optref_conf_path]]*--conf-path*=PATH::
831
851
  Change the configuration file path to PATH.
965
985
  See *<<_event_hook, Event Hook>>* for more details about COMMAND.
966
986
  Possible Values: '/path/to/command'
967
987
 
 
988
[[aria2_optref_show_console_readout]]*--show-console-readout*[='true'|'false']::
 
989
 
 
990
  Show console readout. Default: 'true'
 
991
 
968
992
[[aria2_optref_summary_interval]]*--summary-interval*=SEC::
969
993
  Set interval in seconds to output download progress summary.
970
994
  Setting '0' suppresses the output.
1036
1060
 
1037
1061
  Save error/unfinished downloads to FILE on exit.  You can pass this
1038
1062
  output file to aria2c with *<<aria2_optref_input_file, -i>>* option on restart. Please note that
1039
 
  downloads added by *<<aria2_xmlrpc_aria2_addTorrent, aria2.addTorrent>>* and
1040
 
  *<<aria2_xmlrpc_aria2_addMetalink, aria2.addMetalink>>*
1041
 
  XML-RPC method are not saved.
 
1063
  downloads added by *<<aria2_rpc_aria2_addTorrent, aria2.addTorrent>>* and
 
1064
  *<<aria2_rpc_aria2_addMetalink, aria2.addMetalink>>*
 
1065
  RPC method and whose metadata could not be saved as a file are not saved.
1042
1066
 
1043
1067
[[aria2_optref_stop]]*--stop*=SEC::
1044
1068
  Stop application after SEC seconds has passed.
1121
1145
If number of files is more than one, file path is first one.  In
1122
1146
other words, this is the value of path key of first struct whose
1123
1147
selected key is true in the response of
1124
 
*<<aria2_xmlrpc_aria2_getFiles, aria2.getFiles>>*
1125
 
XML-RPC method.
1126
 
If you want to get all file paths, consider to use XML-RPC.  Please
 
1148
*<<aria2_rpc_aria2_getFiles, aria2.getFiles>>*
 
1149
RPC method.
 
1150
If you want to get all file paths, consider to use JSON-RPC/XML-RPC.  Please
1127
1151
note that file path may change during download in HTTP because of
1128
1152
redirection or Content-Disposition header.
1129
1153
 
1259
1283
  If bad/unrecognized option was given or unexpected option argument
1260
1284
  was given.
1261
1285
 
 
1286
*29*::
 
1287
 
 
1288
  If the remote server was unable to handle the request due to a
 
1289
  temporary overloading or maintenance.
 
1290
 
 
1291
*30*::
 
1292
 
 
1293
  If aria2 could not parse JSON-RPC request.
 
1294
 
1262
1295
[NOTE]
1263
1296
An error occurred in a finished download will not be reported
1264
1297
as exit status.
1287
1320
  Overrides all-proxy value in configuration file.
1288
1321
  The command-line option *<<aria2_optref_all_proxy, --all-proxy>>* overrides this value.
1289
1322
 
 
1323
[NOTE]
 
1324
 
 
1325
Although aria2 accepts ftp:// and https:// scheme in proxy URI, it
 
1326
simply assumes that http:// is specified and does not change its
 
1327
behavior based on the specified scheme.
 
1328
 
1290
1329
no_proxy [DOMAIN,...]::
1291
1330
 
1292
1331
  Specify comma-separated hostname, domains and network address with
1476
1515
* *<<aria2_optref_timeout, timeout>>*
1477
1516
* *<<aria2_optref_use_head, use-head>>*
1478
1517
* *<<aria2_optref_user_agent, user-agent>>*
 
1518
* *<<aria2_optref_retry_wait, retry-wait>>*
1479
1519
 
1480
1520
These options have exactly same meaning of the ones in the
1481
1521
command-line options, but it just applies to the URIs it belongs to.
1551
1591
host=localhost, protocol=ftp, dl_speed=0, last_updated=1222491632, status=ERROR
1552
1592
--------------------------------------------------------------------------------
1553
1593
 
1554
 
XML-RPC INTERFACE
1555
 
-----------------
 
1594
RPC INTERFACE
 
1595
-------------
 
1596
 
 
1597
aria2 provides both JSON-RPC and XML-RPC and they basically have the
 
1598
same functionality.
 
1599
 
 
1600
The request path of JSON-RPC interface is '/jsonrpc'.
 
1601
The request path of XML-RPC interface is '/rpc'.
 
1602
 
 
1603
The implemented JSON-RPC is based on http://groups.google.com/group/json-rpc/web/json-rpc-2-0[JSON-RPC 2.0 Specification (2010-03-26)] and supports HTTP POST and GET (JSONP).
 
1604
 
 
1605
The JSON-RPC interface does not support notification. It also
 
1606
does not support floating point number. The character encoding must be
 
1607
UTF-8.
 
1608
 
 
1609
When reading following document for JSON-RPC, interpret struct as JSON
 
1610
object.
1556
1611
 
1557
1612
Terminology
1558
1613
~~~~~~~~~~~
1570
1625
 
1571
1626
All code examples come from Python2.7 interpreter.
1572
1627
 
1573
 
[[aria2_xmlrpc_aria2_addUri]]
 
1628
[[aria2_rpc_aria2_addUri]]
1574
1629
*aria2.addUri* ('uris[, options[, position]]')
1575
1630
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1576
1631
 
1583
1638
be BitTorrent Magnet URI.  URIs in 'uris' must point to the same file.
1584
1639
If you mix other URIs which point to another file, aria2 does not
1585
1640
complain but download may fail.  'options' is of type struct and its
1586
 
members are a pair of option name and value. See *<<aria2_xmlrpc_options, Options>>* below for
 
1641
members are a pair of option name and value. See *<<aria2_rpc_options, Options>>* below for
1587
1642
more details.  If 'position' is given as an integer starting from 0,
1588
1643
the new download is inserted at 'position' in the waiting queue. If
1589
1644
'position' is not given or 'position' is larger than the size of the
1590
1645
queue, it is appended at the end of the queue.  This method returns
1591
1646
GID of registered download.
1592
1647
 
1593
 
Example
1594
 
+++++++
 
1648
JSON-RPC Example
 
1649
++++++++++++++++
 
1650
 
 
1651
The following example adds \http://example.org/file to aria2:
 
1652
 
 
1653
------------------------------------------------------------------
 
1654
>>> import urllib2, json
 
1655
>>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
 
1656
...                       'method':'aria2.addUri',
 
1657
...                       'params':[['http://example.org/file']]})
 
1658
>>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
 
1659
>>> c.read()
 
1660
'{"id":"qwer","jsonrpc":"2.0","result":"1"}'
 
1661
------------------------------------------------------------------
 
1662
 
 
1663
XML-RPC Example
 
1664
+++++++++++++++
1595
1665
 
1596
1666
The following example adds \http://example.org/file to aria2:
1597
1667
 
1605
1675
The following example adds 2 sources and some options:
1606
1676
 
1607
1677
--------------------------------------------------------------------------
1608
 
>>> s.aria2.addUri(['http://example.org/file'], dict(dir="/tmp"))
 
1678
>>> s.aria2.addUri(['http://example.org/file', 'http://mirror/file'],
 
1679
                    dict(dir="/tmp"))
1609
1680
'2'
1610
1681
--------------------------------------------------------------------------
1611
1682
 
1617
1688
'3'
1618
1689
---------------------------------------------------------------
1619
1690
 
1620
 
[[aria2_xmlrpc_aria2_addTorrent]]
 
1691
[[aria2_rpc_aria2_addTorrent]]
1621
1692
*aria2.addTorrent* ('torrent[, uris[, options[, position]]]')
1622
1693
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1623
1694
 
1625
1696
+++++++++++
1626
1697
 
1627
1698
This method adds BitTorrent download by uploading .torrent file.  If
1628
 
you want to add BitTorrent Magnet URI, use *<<aria2_xmlrpc_aria2_addUri, aria2.addUri>>* method
 
1699
you want to add BitTorrent Magnet URI, use *<<aria2_rpc_aria2_addUri, aria2.addUri>>* method
1629
1700
instead.  'torrent' is of type base64 which contains Base64-encoded
1630
1701
.torrent file.  'uris' is of type array and its element is URI which
1631
1702
is of type string. 'uris' is used for Web-seeding.  For single file
1633
1704
ends with /, name in torrent file is added. For multi-file torrents,
1634
1705
name and path in torrent are added to form a URI for each file.
1635
1706
'options' is of type struct and its members are a pair of option name
1636
 
and value. See *<<aria2_xmlrpc_options, Options>>* below for more details.  If 'position' is
 
1707
and value. See *<<aria2_rpc_options, Options>>* below for more details.  If 'position' is
1637
1708
given as an integer starting from 0, the new download is inserted at
1638
1709
'position' in the waiting queue. If 'position' is not given or
1639
1710
'position' is larger than the size of the queue, it is appended at the
1640
1711
end of the queue.  This method returns GID of registered download.
1641
 
Please note that the downloads added by this method are not saved by
 
1712
The uploaded data is saved as a file named hex string of SHA-1 hash of data
 
1713
plus ".torrent" in the directory specified by *<<aria2_optref_dir, --dir>>*
 
1714
option.
 
1715
The example of filename is 0a3893293e27ac0490424c06de4d09242215f0a6.torrent.
 
1716
If same file already exists, it is overwritten.
 
1717
If the file cannot be saved successfully,
 
1718
the downloads added by this method are not saved by
1642
1719
*<<aria2_optref_save_session, --save-session>>*.
1643
1720
 
1644
 
Example
1645
 
+++++++
 
1721
JSON-RPC Example
 
1722
++++++++++++++++
 
1723
 
 
1724
The following example adds local file file.torrent to aria2:
 
1725
 
 
1726
---------------------------------------------------------------------------
 
1727
>>> import urllib2, json, base64
 
1728
>>> torrent = base64.b64encode(open('file.torrent').read())
 
1729
>>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'asdf',
 
1730
...                       'method':'aria2.addTorrent', 'params':[torrent]})
 
1731
>>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
 
1732
>>> c.read()
 
1733
'{"id":"asdf","jsonrpc":"2.0","result":"6"}'
 
1734
---------------------------------------------------------------------------
 
1735
 
 
1736
XML-RPC Example
 
1737
+++++++++++++++
1646
1738
 
1647
1739
The following example adds local file file.torrent to aria2:
1648
1740
 
1653
1745
'6'
1654
1746
---------------------------------------------------------------------
1655
1747
 
1656
 
[[aria2_xmlrpc_aria2_addMetalink]]
 
1748
[[aria2_rpc_aria2_addMetalink]]
1657
1749
*aria2.addMetalink* ('metalink[, options[, position]]')
1658
1750
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1659
1751
 
1663
1755
This method adds Metalink download by uploading .metalink file.
1664
1756
'metalink' is of type base64 which contains Base64-encoded .metalink
1665
1757
file.  'options' is of type struct and its members are a pair of
1666
 
option name and value. See *<<aria2_xmlrpc_options, Options>>* below for more details.  If
 
1758
option name and value. See *<<aria2_rpc_options, Options>>* below for more details.  If
1667
1759
'position' is given as an integer starting from 0, the new download is
1668
1760
inserted at 'position' in the waiting queue. If 'position' is not
1669
1761
given or 'position' is larger than the size of the queue, it is
1670
1762
appended at the end of the queue.  This method returns array of GID of
1671
 
registered download.  Please note that the downloads added by this
1672
 
method are not saved by *<<aria2_optref_save_session, --save-session>>*.
1673
 
 
1674
 
Example
1675
 
+++++++
 
1763
registered download.
 
1764
The uploaded data is saved as a file named hex string of SHA-1 hash of data
 
1765
plus ".metalink" in the directory specified by *<<aria2_optref_dir, --dir>>*
 
1766
option.
 
1767
The example of filename is 0a3893293e27ac0490424c06de4d09242215f0a6.metalink.
 
1768
If same file already exists, it is overwritten.
 
1769
If the file cannot be saved successfully,
 
1770
the downloads added by this method are not saved by
 
1771
*<<aria2_optref_save_session, --save-session>>*.
 
1772
 
 
1773
JSON-RPC Example
 
1774
++++++++++++++++
 
1775
 
 
1776
The following example adds local file file.meta4 to aria2:
 
1777
 
 
1778
-----------------------------------------------------------------------------
 
1779
>>> import urllib2, json, base64
 
1780
>>> metalink = base64.b64encode(open('file.meta4').read())
 
1781
>>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
 
1782
...                       'method':'aria2.addMetalink', 'params':[metalink]})
 
1783
>>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
 
1784
>>> c.read()
 
1785
'{"id":"qwer","jsonrpc":"2.0","result":["8"]}'
 
1786
-----------------------------------------------------------------------------
 
1787
 
 
1788
XML-RPC Example
 
1789
+++++++++++++++
1676
1790
 
1677
1791
The following example adds local file file.meta4 to aria2:
1678
1792
 
1683
1797
['8']
1684
1798
--------------------------------------------------------------------
1685
1799
 
1686
 
[[aria2_xmlrpc_aria2_remove]]
 
1800
[[aria2_rpc_aria2_remove]]
1687
1801
*aria2.remove* ('gid')
1688
1802
^^^^^^^^^^^^^^^^^^^^^^
1689
1803
 
1695
1809
first. The status of removed download becomes "removed".  This method
1696
1810
returns GID of removed download.
1697
1811
 
1698
 
Example
1699
 
+++++++
 
1812
JSON-RPC Example
 
1813
++++++++++++++++
 
1814
 
 
1815
The following example removes download whose GID is "3":
 
1816
 
 
1817
-----------------------------------------------------------------------------
 
1818
>>> import urllib2, json
 
1819
>>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
 
1820
...                       'method':'aria2.remove', 'params':['3']})
 
1821
>>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
 
1822
>>> c.read()
 
1823
'{"id":"qwer","jsonrpc":"2.0","result":"3"}'
 
1824
-----------------------------------------------------------------------------
 
1825
 
 
1826
XML-RPC Example
 
1827
+++++++++++++++
1700
1828
 
1701
1829
The following example removes download whose GID is "3":
1702
1830
 
1707
1835
'3'
1708
1836
--------------------------------------------------------------------
1709
1837
 
1710
 
[[aria2_xmlrpc_aria2_forceRemove]]
 
1838
[[aria2_rpc_aria2_forceRemove]]
1711
1839
*aria2.forceRemove* ('gid')
1712
1840
^^^^^^^^^^^^^^^^^^^^^^^^^^^
1713
1841
 
1715
1843
+++++++++++
1716
1844
 
1717
1845
This method removes the download denoted by 'gid'.  This method
1718
 
behaves just like *<<aria2_xmlrpc_aria2_remove, aria2.remove>>* except that this method removes
 
1846
behaves just like *<<aria2_rpc_aria2_remove, aria2.remove>>* except that this method removes
1719
1847
download without any action which takes time such as contacting
1720
1848
BitTorrent tracker.
1721
1849
 
1722
 
[[aria2_xmlrpc_aria2_pause]]
 
1850
[[aria2_rpc_aria2_pause]]
1723
1851
*aria2.pause* ('gid')
1724
1852
^^^^^^^^^^^^^^^^^^^^^
1725
1853
 
1730
1858
string. The status of paused download becomes "paused".  If the
1731
1859
download is active, the download is placed on the first position of
1732
1860
waiting queue.  As long as the status is "paused", the download is not
1733
 
started.  To change status to "waiting", use *<<aria2_xmlrpc_aria2_unpause, aria2.unpause>>* method.
 
1861
started.  To change status to "waiting", use *<<aria2_rpc_aria2_unpause, aria2.unpause>>* method.
1734
1862
This method returns GID of paused download.
1735
1863
 
1736
 
[[aria2_xmlrpc_aria2_pauseAll]]
 
1864
[[aria2_rpc_aria2_pauseAll]]
1737
1865
*aria2.pauseAll* ()
1738
1866
^^^^^^^^^^^^^^^^^^^
1739
1867
 
1740
1868
Description
1741
1869
+++++++++++
1742
1870
 
1743
 
This method is equal to calling *<<aria2_xmlrpc_aria2_pause, aria2.pause>>* for every active/waiting
 
1871
This method is equal to calling *<<aria2_rpc_aria2_pause, aria2.pause>>* for every active/waiting
1744
1872
download. This methods returns "OK" for success.
1745
1873
 
1746
 
[[aria2_xmlrpc_aria2_forcePause]]
 
1874
[[aria2_rpc_aria2_forcePause]]
1747
1875
*aria2.forcePause* ('pid')
1748
1876
^^^^^^^^^^^^^^^^^^^^^^^^^^
1749
1877
 
1751
1879
+++++++++++
1752
1880
 
1753
1881
This method pauses the download denoted by 'gid'.  This method
1754
 
behaves just like *<<aria2_xmlrpc_aria2_pause, aria2.pause>>* except that this method pauses
 
1882
behaves just like *<<aria2_rpc_aria2_pause, aria2.pause>>* except that this method pauses
1755
1883
download without any action which takes time such as contacting
1756
1884
BitTorrent tracker.
1757
1885
 
1758
 
[[aria2_xmlrpc_aria2_forcePauseAll]]
 
1886
[[aria2_rpc_aria2_forcePauseAll]]
1759
1887
*aria2.forcePauseAll* ()
1760
1888
^^^^^^^^^^^^^^^^^^^^^^^^
1761
1889
 
1762
1890
Description
1763
1891
+++++++++++
1764
1892
 
1765
 
This method is equal to calling *<<aria2_xmlrpc_aria2_forcePause, aria2.forcePause>>* for every
 
1893
This method is equal to calling *<<aria2_rpc_aria2_forcePause, aria2.forcePause>>* for every
1766
1894
active/waiting download. This methods returns "OK" for success.
1767
1895
 
1768
 
[[aria2_xmlrpc_aria2_unpause]]
 
1896
[[aria2_rpc_aria2_unpause]]
1769
1897
*aria2.unpause* ('gid')
1770
1898
^^^^^^^^^^^^^^^^^^^^^^^
1771
1899
 
1777
1905
'gid' is of type string.  This method returns GID of unpaused
1778
1906
download.
1779
1907
 
1780
 
[[aria2_xmlrpc_aria2_unpauseAll]]
 
1908
[[aria2_rpc_aria2_unpauseAll]]
1781
1909
*aria2.unpauseAll* ()
1782
1910
^^^^^^^^^^^^^^^^^^^^^
1783
1911
 
1784
1912
Description
1785
1913
+++++++++++
1786
1914
 
1787
 
This method is equal to calling *<<aria2_xmlrpc_aria2_unpause, aria2.unpause>>* for every active/waiting
 
1915
This method is equal to calling *<<aria2_rpc_aria2_unpause, aria2.unpause>>* for every active/waiting
1788
1916
download. This methods returns "OK" for success.
1789
1917
 
1790
 
[[aria2_xmlrpc_aria2_tellStatus]]
 
1918
[[aria2_rpc_aria2_tellStatus]]
1791
1919
*aria2.tellStatus* ('gid[, keys]')
1792
1920
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1793
1921
 
1799
1927
specified, the response contains only keys in 'keys' array. If 'keys'
1800
1928
is empty or not specified, the response contains all keys.  This is
1801
1929
useful when you just want specific keys and avoid unnecessary
1802
 
transfers. For example, *<<aria2_xmlrpc_aria2_tellStatus, aria2.tellStatus>>*("1", ["gid", "status"])
 
1930
transfers. For example, *<<aria2_rpc_aria2_tellStatus, aria2.tellStatus>>*("1", ["gid", "status"])
1803
1931
returns 'gid' and 'status' key.  The response is of type struct and it
1804
1932
contains following keys. The value type is string.
1805
1933
 
1895
2023
files::
1896
2024
 
1897
2025
  Returns the list of files. The element of list is the same struct
1898
 
  used in *<<aria2_xmlrpc_aria2_getFiles, aria2.getFiles>>* method.
 
2026
  used in *<<aria2_rpc_aria2_getFiles, aria2.getFiles>>* method.
1899
2027
 
1900
2028
 
1901
2029
bittorrent::
1931
2059
 
1932
2060
      name in info dictionary. name.utf-8 is used if available.
1933
2061
 
1934
 
Example
1935
 
+++++++
 
2062
JSON-RPC Example
 
2063
++++++++++++++++
 
2064
 
 
2065
The following example gets information about download whose GID is
 
2066
"1":
 
2067
 
 
2068
---------------------------------------------------------------------------
 
2069
>>> import urllib2, json
 
2070
>>> from pprint import pprint
 
2071
>>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
 
2072
...                       'method':'aria2.tellStatus', 'params':['1']})
 
2073
>>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
 
2074
>>> pprint(json.loads(c.read()))
 
2075
{u'id': u'qwer',
 
2076
 u'jsonrpc': u'2.0',
 
2077
 u'result': {u'bitfield': u'0000000000',
 
2078
             u'completedLength': u'901120',
 
2079
             u'connections': u'1',
 
2080
             u'dir': u'/downloads',
 
2081
             u'downloadSpeed': u'15158',
 
2082
             u'files': [{u'index': u'1',
 
2083
                         u'length': u'34896138',
 
2084
                         u'path': u'/downloads/file',
 
2085
                         u'selected': u'true',
 
2086
                         u'uris': [{u'status': u'used',
 
2087
                                    u'uri': u'http://example.org/file'}]}],
 
2088
             u'gid': u'1',
 
2089
             u'numPieces': u'34',
 
2090
             u'pieceLength': u'1048576',
 
2091
             u'status': u'active',
 
2092
             u'totalLength': u'34896138',
 
2093
             u'uploadLength': u'0',
 
2094
             u'uploadSpeed': u'0'}}
 
2095
---------------------------------------------------------------------------
 
2096
 
 
2097
The following example gets information specifying keys you are
 
2098
interested in:
 
2099
 
 
2100
--------------------------------------------------------------------------
 
2101
>>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
 
2102
...                       'method':'aria2.tellStatus',
 
2103
...                       'params':['1', ['gid',
 
2104
...                                       'totalLength',
 
2105
...                                       'completedLength']]})
 
2106
>>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
 
2107
>>> pprint(json.loads(c.read()))
 
2108
{u'id': u'qwer',
 
2109
 u'jsonrpc': u'2.0',
 
2110
 u'result': {u'completedLength': u'5701632',
 
2111
             u'gid': u'1',
 
2112
             u'totalLength': u'34896138'}}
 
2113
--------------------------------------------------------------------------
 
2114
 
 
2115
XML-RPC Example
 
2116
+++++++++++++++
1936
2117
 
1937
2118
The following example gets information about download whose GID is
1938
2119
"1":
1973
2154
{'completedLength': '34896138', 'gid': '1', 'totalLength': '34896138'}
1974
2155
--------------------------------------------------------------------------
1975
2156
 
1976
 
[[aria2_xmlrpc_aria2_getUris]]
 
2157
[[aria2_rpc_aria2_getUris]]
1977
2158
*aria2.getUris* ('gid')
1978
2159
^^^^^^^^^^^^^^^^^^^^^^^
1979
2160
 
1993
2174
  'used' if the URI is already used. 'waiting' if the URI is waiting
1994
2175
  in the queue.
1995
2176
 
1996
 
Example
1997
 
+++++++
 
2177
JSON-RPC Example
 
2178
++++++++++++++++
 
2179
 
 
2180
--------------------------------------------------------------------
 
2181
>>> import urllib2, json
 
2182
>>> from pprint import pprint
 
2183
>>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
 
2184
...                       'method':'aria2.getUris', 'params':['1']})
 
2185
>>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
 
2186
>>> pprint(json.loads(c.read()))
 
2187
{u'id': u'qwer',
 
2188
 u'jsonrpc': u'2.0',
 
2189
 u'result': [{u'status': u'used',
 
2190
              u'uri': u'http://example.org/file'}]}
 
2191
--------------------------------------------------------------------
 
2192
 
 
2193
XML-RPC Example
 
2194
+++++++++++++++
1998
2195
 
1999
2196
--------------------------------------------------------------------
2000
2197
>>> import xmlrpclib
2005
2202
[{'status': 'used', 'uri': 'http://example.org/file'}]
2006
2203
--------------------------------------------------------------------
2007
2204
 
2008
 
[[aria2_xmlrpc_aria2_getFiles]]
 
2205
[[aria2_rpc_aria2_getFiles]]
2009
2206
*aria2.getFiles* ('gid')
2010
2207
^^^^^^^^^^^^^^^^^^^^^^^^
2011
2208
 
2038
2235
uris::
2039
2236
 
2040
2237
  Returns the list of URI for this file. The element of list is the
2041
 
  same struct used in *<<aria2_xmlrpc_aria2_getUris, aria2.getUris>>* method.
2042
 
 
2043
 
Example
2044
 
+++++++
 
2238
  same struct used in *<<aria2_rpc_aria2_getUris, aria2.getUris>>* method.
 
2239
 
 
2240
JSON-RPC Example
 
2241
++++++++++++++++
 
2242
 
 
2243
---------------------------------------------------------------------
 
2244
>>> import urllib2, json
 
2245
>>> from pprint import pprint
 
2246
>>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
 
2247
...                       'method':'aria2.getFiles', 'params':['1']})
 
2248
>>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
 
2249
>>> pprint(json.loads(c.read()))
 
2250
{u'id': u'qwer',
 
2251
 u'jsonrpc': u'2.0',
 
2252
 u'result': [{u'index': u'1',
 
2253
              u'length': u'34896138',
 
2254
              u'path': u'/downloads/file',
 
2255
              u'selected': u'true',
 
2256
              u'uris': [{u'status': u'used',
 
2257
                         u'uri': u'http://example.org/file'}]}]}
 
2258
---------------------------------------------------------------------
 
2259
 
 
2260
XML-RPC Example
 
2261
+++++++++++++++
2045
2262
 
2046
2263
--------------------------------------------------------------------------
2047
2264
>>> import xmlrpclib
2057
2274
            'uri': 'http://example.org/file'}]}]
2058
2275
--------------------------------------------------------------------------
2059
2276
 
2060
 
[[aria2_xmlrpc_aria2_getPeers]]
 
2277
[[aria2_rpc_aria2_getPeers]]
2061
2278
*aria2.getPeers* ('gid')
2062
2279
^^^^^^^^^^^^^^^^^^^^^^^^
2063
2280
 
2108
2325
 
2109
2326
  "true" is this client is a seeder. Otherwise "false".
2110
2327
 
2111
 
Example
2112
 
+++++++
 
2328
JSON-RPC Example
 
2329
++++++++++++++++
 
2330
 
 
2331
-----------------------------------------------------------------------
 
2332
>>> import urllib2, json
 
2333
>>> from pprint import pprint
 
2334
>>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
 
2335
...                       'method':'aria2.getPeers', 'params':['1']})
 
2336
>>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
 
2337
>>> pprint(json.loads(c.read()))
 
2338
{u'id': u'qwer',
 
2339
 u'jsonrpc': u'2.0',
 
2340
 u'result': [{u'amChoking': u'true',
 
2341
              u'bitfield': u'ffffffffffffffffffffffffffffffffffffffff',
 
2342
              u'downloadSpeed': u'10602',
 
2343
              u'ip': u'10.0.0.9',
 
2344
              u'peerChoking': u'false',
 
2345
              u'peerId': u'aria2%2F1%2E10%2E5%2D%87%2A%EDz%2F%F7%E6',
 
2346
              u'port': u'6881',
 
2347
              u'seeder': u'true',
 
2348
              u'uploadSpeed': u'0'},
 
2349
             {u'amChoking': u'false',
 
2350
              u'bitfield': u'ffffeff0fffffffbfffffff9fffffcfff7f4ffff',
 
2351
              u'downloadSpeed': u'8654',
 
2352
              u'ip': u'10.0.0.30',
 
2353
              u'peerChoking': u'false',
 
2354
              u'peerId': u'bittorrent client758',
 
2355
              u'port': u'37842',
 
2356
              u'seeder': u'false',
 
2357
              u'uploadSpeed': u'6890'}]}
 
2358
-----------------------------------------------------------------------
 
2359
 
 
2360
XML-RPC Example
 
2361
+++++++++++++++
2113
2362
 
2114
2363
--------------------------------------------------------------------------
2115
2364
>>> import xmlrpclib
2137
2386
  'uploadSpeed': '6890'}]
2138
2387
--------------------------------------------------------------------------
2139
2388
 
2140
 
[[aria2_xmlrpc_aria2_getServers]]
 
2389
[[aria2_rpc_aria2_getServers]]
2141
2390
*aria2.getServers* ('gid')
2142
2391
^^^^^^^^^^^^^^^^^^^^^^^^^^
2143
2392
 
2170
2419
 
2171
2420
    Download speed (byte/sec)
2172
2421
 
2173
 
Example
2174
 
+++++++
 
2422
JSON-RPC Example
 
2423
++++++++++++++++
 
2424
 
 
2425
-----------------------------------------------------------------------
 
2426
>>> import urllib2, json
 
2427
>>> from pprint import pprint
 
2428
>>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
 
2429
...                       'method':'aria2.getServers', 'params':['1']})
 
2430
>>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
 
2431
>>> pprint(json.loads(c.read()))
 
2432
{u'id': u'qwer',
 
2433
 u'jsonrpc': u'2.0',
 
2434
 u'result': [{u'index': u'1',
 
2435
              u'servers': [{u'currentUri': u'http://example.org/file',
 
2436
                            u'downloadSpeed': u'10467',
 
2437
                            u'uri': u'http://example.org/file'}]}]}
 
2438
-----------------------------------------------------------------------
 
2439
 
 
2440
XML-RPC Example
 
2441
+++++++++++++++
2175
2442
 
2176
2443
--------------------------------------------------------------------
2177
2444
>>> import xmlrpclib
2185
2452
               'uri': 'http://example.org/file'}]}]
2186
2453
--------------------------------------------------------------------
2187
2454
 
2188
 
[[aria2_xmlrpc_aria2_tellActive]]
 
2455
[[aria2_rpc_aria2_tellActive]]
2189
2456
*aria2.tellActive* ('[keys]')
2190
2457
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2191
2458
 
2194
2461
 
2195
2462
This method returns the list of active downloads.  The response is of
2196
2463
type array and its element is the same struct returned by
2197
 
*<<aria2_xmlrpc_aria2_tellStatus, aria2.tellStatus>>* method. For 'keys' parameter, please refer to
2198
 
*<<aria2_xmlrpc_aria2_tellStatus, aria2.tellStatus>>* method.
 
2464
*<<aria2_rpc_aria2_tellStatus, aria2.tellStatus>>* method. For 'keys' parameter, please refer to
 
2465
*<<aria2_rpc_aria2_tellStatus, aria2.tellStatus>>* method.
2199
2466
 
2200
 
[[aria2_xmlrpc_aria2_tellWaiting]]
 
2467
[[aria2_rpc_aria2_tellWaiting]]
2201
2468
*aria2.tellWaiting* ('offset, num, [keys]')
2202
2469
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2203
2470
 
2208
2475
downloads. 'offset' is of type integer and specifies the offset from
2209
2476
the download waiting at the front. 'num' is of type integer and
2210
2477
specifies the number of downloads to be returned.  For 'keys'
2211
 
parameter, please refer to *<<aria2_xmlrpc_aria2_tellStatus, aria2.tellStatus>>* method.
 
2478
parameter, please refer to *<<aria2_rpc_aria2_tellStatus, aria2.tellStatus>>* method.
2212
2479
 
2213
2480
If offset is a positive integer, this method returns downloads in the
2214
2481
range of ['offset', 'offset'+'num').
2224
2491
aria2.tellWaiting(-1, 2) returns ["C", "B"].
2225
2492
 
2226
2493
The response is of type array and its element is the same struct
2227
 
returned by *<<aria2_xmlrpc_aria2_tellStatus, aria2.tellStatus>>* method.
 
2494
returned by *<<aria2_rpc_aria2_tellStatus, aria2.tellStatus>>* method.
2228
2495
 
2229
 
[[aria2_xmlrpc_aria2_tellStopped]]
 
2496
[[aria2_rpc_aria2_tellStopped]]
2230
2497
*aria2.tellStopped* ('offset, num, [keys]')
2231
2498
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2232
2499
 
2236
2503
This method returns the list of stopped download.  'offset' is of type
2237
2504
integer and specifies the offset from the oldest download. 'num' is of
2238
2505
type integer and specifies the number of downloads to be returned.
2239
 
For 'keys' parameter, please refer to *<<aria2_xmlrpc_aria2_tellStatus, aria2.tellStatus>>* method.
 
2506
For 'keys' parameter, please refer to *<<aria2_rpc_aria2_tellStatus, aria2.tellStatus>>* method.
2240
2507
 
2241
 
'offset' and 'num' have the same semantics as *<<aria2_xmlrpc_aria2_tellWaiting, aria2.tellWaiting>>*
 
2508
'offset' and 'num' have the same semantics as *<<aria2_rpc_aria2_tellWaiting, aria2.tellWaiting>>*
2242
2509
method.
2243
2510
 
2244
2511
The response is of type array and its element is the same struct
2245
 
returned by *<<aria2_xmlrpc_aria2_tellStatus, aria2.tellStatus>>* method.
 
2512
returned by *<<aria2_rpc_aria2_tellStatus, aria2.tellStatus>>* method.
2246
2513
 
2247
 
[[aria2_xmlrpc_aria2_changePosition]]
 
2514
[[aria2_rpc_aria2_changePosition]]
2248
2515
*aria2.changePosition* ('gid, pos, how')
2249
2516
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2250
2517
 
2267
2534
aria2.changePosition(1, 0, POS_SET) will change its position to 0(the
2268
2535
beginning of the queue).
2269
2536
 
2270
 
Example
2271
 
+++++++
 
2537
JSON-RPC Example
 
2538
++++++++++++++++
 
2539
 
 
2540
The following example moves the download whose GID is "3" to the
 
2541
front of the waiting queue:
 
2542
 
 
2543
-----------------------------------------------------------------
 
2544
>>> import urllib2, json
 
2545
>>> from pprint import pprint
 
2546
>>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
 
2547
...                       'method':'aria2.changePosition',
 
2548
...                       'params':['3', 0, 'POS_SET']})
 
2549
>>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
 
2550
>>> pprint(json.loads(c.read()))
 
2551
{u'id': u'qwer', u'jsonrpc': u'2.0', u'result': 0}
 
2552
-----------------------------------------------------------------
 
2553
 
 
2554
XML-RPC Example
 
2555
+++++++++++++++
2272
2556
 
2273
2557
The following example moves the download whose GID is "3" to the
2274
2558
front of the waiting queue:
2280
2564
0
2281
2565
--------------------------------------------------------------------
2282
2566
 
2283
 
[[aria2_xmlrpc_aria2_changeUri]]
 
2567
[[aria2_rpc_aria2_changeUri]]
2284
2568
*aria2.changeUri* ('gid, fileIndex, delUris, addUris[, position]')
2285
2569
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2286
2570
 
2305
2589
the number of URIs deleted. The second integer is the number of URIs
2306
2590
added.
2307
2591
 
2308
 
Example
2309
 
+++++++
 
2592
JSON-RPC Example
 
2593
++++++++++++++++
 
2594
 
 
2595
The following example adds 1 URI \http://example.org/file to the file
 
2596
whose index is "1" and belongs to the download whose GID is "2":
 
2597
 
 
2598
------------------------------------------------------------------------------
 
2599
>>> import urllib2, json
 
2600
>>> from pprint import pprint
 
2601
>>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
 
2602
...                       'method':'aria2.changeUri',
 
2603
...                       'params':['2', 1, [], ['http://example.org/file']]})
 
2604
>>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
 
2605
>>> pprint(json.loads(c.read()))
 
2606
{u'id': u'qwer', u'jsonrpc': u'2.0', u'result': [0, 1]}
 
2607
------------------------------------------------------------------------------
 
2608
 
 
2609
XML-RPC Example
 
2610
+++++++++++++++
2310
2611
 
2311
2612
The following example adds 1 URI \http://example.org/file to the file
2312
2613
whose index is "1" and belongs to the download whose GID is "2":
2318
2619
[0, 1]
2319
2620
--------------------------------------------------------------------
2320
2621
 
2321
 
[[aria2_xmlrpc_aria2_getOption]]
 
2622
[[aria2_rpc_aria2_getOption]]
2322
2623
*aria2.getOption* ('gid')
2323
2624
^^^^^^^^^^^^^^^^^^^^^^^^^
2324
2625
 
2329
2630
response is of type struct. Its key is the name of option.  The value type
2330
2631
is string.
2331
2632
 
2332
 
Example
2333
 
+++++++
 
2633
JSON-RPC Example
 
2634
++++++++++++++++
 
2635
 
 
2636
The following example gets options of the download whose GID is "1":
 
2637
 
 
2638
----------------------------------------------------------------------
 
2639
>>> import urllib2, json
 
2640
>>> from pprint import pprint
 
2641
>>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
 
2642
...                       'method':'aria2.getOption', 'params':['1']})
 
2643
>>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
 
2644
>>> pprint(json.loads(c.read()))
 
2645
{u'id': u'qwer',
 
2646
 u'jsonrpc': u'2.0',
 
2647
 u'result': {u'allow-overwrite': u'false',
 
2648
             u'allow-piece-length-change': u'false',
 
2649
             u'always-resume': u'true',
 
2650
             u'async-dns': u'true',
 
2651
 ...
 
2652
----------------------------------------------------------------------
 
2653
 
 
2654
XML-RPC Example
 
2655
+++++++++++++++
2334
2656
 
2335
2657
The following example gets options of the download whose GID is "1":
2336
2658
 
2347
2669
 ....
2348
2670
--------------------------------------------------------------------
2349
2671
 
2350
 
[[aria2_xmlrpc_aria2_changeOption]]
 
2672
[[aria2_rpc_aria2_changeOption]]
2351
2673
*aria2.changeOption* ('gid, options')
2352
2674
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2353
2675
 
2360
2682
*<<aria2_optref_bt_request_peer_speed_limit, bt-request-peer-speed-limit>>*, *<<aria2_optref_max_download_limit, max-download-limit>>* and
2361
2683
*<<aria2_optref_max_upload_limit, max-upload-limit>>*.  This method returns "OK" for success.
2362
2684
 
2363
 
Example
2364
 
+++++++
 
2685
JSON-RPC Example
 
2686
++++++++++++++++
 
2687
 
 
2688
The following example sets
 
2689
*<<aria2_optref_max_download_limit, max-download-limit>>* option to "20K" for
 
2690
the download whose GID is "1".
 
2691
 
 
2692
------------------------------------------------------------------------
 
2693
>>> import urllib2, json
 
2694
>>> from pprint import pprint
 
2695
>>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
 
2696
...                       'method':'aria2.changeOption',
 
2697
...                       'params':['1', {'max-download-limit':'10K'}]})
 
2698
>>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
 
2699
>>> pprint(json.loads(c.read()))
 
2700
{u'id': u'qwer', u'jsonrpc': u'2.0', u'result': u'OK'}
 
2701
------------------------------------------------------------------------
 
2702
 
 
2703
XML-RPC Example
 
2704
+++++++++++++++
2365
2705
 
2366
2706
The following example sets
2367
2707
*<<aria2_optref_max_download_limit, max-download-limit>>* option to "20K" for
2374
2714
'OK'
2375
2715
--------------------------------------------------------------------
2376
2716
 
2377
 
[[aria2_xmlrpc_aria2_getGlobalOption]]
 
2717
[[aria2_rpc_aria2_getGlobalOption]]
2378
2718
*aria2.getGlobalOption* ()
2379
2719
^^^^^^^^^^^^^^^^^^^^^^^^^^
2380
2720
 
2385
2725
struct. Its key is the name of option.  The value type is string.
2386
2726
Because global options are used as a template for the options of newly
2387
2727
added download, the response contains keys returned by
2388
 
*<<aria2_xmlrpc_aria2_getOption, aria2.getOption>>* method.
 
2728
*<<aria2_rpc_aria2_getOption, aria2.getOption>>* method.
2389
2729
 
2390
 
[[aria2_xmlrpc_aria2_changeGlobalOption]]
 
2730
[[aria2_rpc_aria2_changeGlobalOption]]
2391
2731
*aria2.changeGlobalOption* ('options')
2392
2732
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2393
2733
 
2402
2742
value. Note that log file is always opened in append mode. This method
2403
2743
returns "OK" for success.
2404
2744
 
2405
 
[[aria2_xmlrpc_aria2_purgeDownloadResult]]
 
2745
[[aria2_rpc_aria2_purgeDownloadResult]]
2406
2746
*aria2.purgeDownloadResult* ()
2407
2747
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2408
2748
 
2412
2752
This method purges completed/error/removed downloads to free memory.
2413
2753
This method returns "OK".
2414
2754
 
2415
 
[[aria2_xmlrpc_aria2_getVersion]]
 
2755
[[aria2_rpc_aria2_removeDownloadResult]]
 
2756
*aria2.removeDownloadResult* ('gid')
 
2757
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
2758
 
 
2759
Description
 
2760
+++++++++++
 
2761
 
 
2762
This method removes completed/error/removed download denoted by 'gid'
 
2763
from memory. This method returns "OK" for success.
 
2764
 
 
2765
JSON-RPC Example
 
2766
++++++++++++++++
 
2767
 
 
2768
The following example removes the download result of the download
 
2769
whose GID is "1".
 
2770
 
 
2771
------------------------------------------------------------------
 
2772
>>> import urllib2, json
 
2773
>>> from pprint import pprint
 
2774
>>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
 
2775
...                       'method':'aria2.removeDownloadResult',
 
2776
...                       'params':['1']})
 
2777
>>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
 
2778
>>> pprint(json.loads(c.read()))
 
2779
{u'id': u'qwer', u'jsonrpc': u'2.0', u'result': u'OK'}
 
2780
------------------------------------------------------------------
 
2781
 
 
2782
XML-RPC Example
 
2783
+++++++++++++++
 
2784
 
 
2785
The following example removes the download result of the download
 
2786
whose GID is "1".
 
2787
 
 
2788
--------------------------------------------------------------------
 
2789
>>> import xmlrpclib
 
2790
>>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
 
2791
>>> s.aria2.removeDownloadResult('1')
 
2792
'OK'
 
2793
--------------------------------------------------------------------
 
2794
 
 
2795
[[aria2_rpc_aria2_getVersion]]
2416
2796
*aria2.getVersion* ()
2417
2797
^^^^^^^^^^^^^^^^^^^^^
2418
2798
 
2430
2810
 
2431
2811
  List of enabled features. Each feature name is of type string.
2432
2812
 
2433
 
Example
2434
 
+++++++
 
2813
JSON-RPC Example
 
2814
++++++++++++++++
 
2815
 
 
2816
------------------------------------------------------------------
 
2817
>>> import urllib2, json
 
2818
>>> from pprint import pprint
 
2819
>>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
 
2820
...                       'method':'aria2.getVersion'})
 
2821
>>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
 
2822
>>> pprint(json.loads(c.read()))
 
2823
{u'id': u'qwer',
 
2824
 u'jsonrpc': u'2.0',
 
2825
 u'result': {u'enabledFeatures': [u'Async DNS',
 
2826
                                  u'BitTorrent',
 
2827
                                  u'Firefox3 Cookie',
 
2828
                                  u'GZip',
 
2829
                                  u'HTTPS',
 
2830
                                  u'Message Digest',
 
2831
                                  u'Metalink',
 
2832
                                  u'XML-RPC'],
 
2833
             u'version': u'1.11.0'}}
 
2834
------------------------------------------------------------------
 
2835
 
 
2836
XML-RPC Example
 
2837
+++++++++++++++
2435
2838
 
2436
2839
--------------------------------------------------------------------
2437
2840
>>> import xmlrpclib
2447
2850
                     'Message Digest',
2448
2851
                     'Metalink',
2449
2852
                     'XML-RPC'],
2450
 
 'version': '1.10.5'}
 
2853
 'version': '1.11.0'}
2451
2854
--------------------------------------------------------------------
2452
2855
 
2453
 
[[aria2_xmlrpc_aria2_getSessionInfo]]
 
2856
[[aria2_rpc_aria2_getSessionInfo]]
2454
2857
*aria2.getSessionInfo* ()
2455
2858
^^^^^^^^^^^^^^^^^^^^^^^^^
2456
2859
 
2464
2867
 
2465
2868
  Session ID, which is generated each time when aria2 is invoked.
2466
2869
 
2467
 
Example
2468
 
+++++++
 
2870
JSON-RPC Example
 
2871
++++++++++++++++
 
2872
 
 
2873
------------------------------------------------------------------------
 
2874
>>> import urllib2, json
 
2875
>>> from pprint import pprint
 
2876
>>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
 
2877
...                       'method':'aria2.getSessionInfo'})
 
2878
>>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
 
2879
>>> pprint(json.loads(c.read()))
 
2880
{u'id': u'qwer',
 
2881
 u'jsonrpc': u'2.0',
 
2882
 u'result': {u'sessionId': u'cd6a3bc6a1de28eb5bfa181e5f6b916d44af31a9'}}
 
2883
------------------------------------------------------------------------
 
2884
 
 
2885
XML-RPC Example
 
2886
+++++++++++++++
2469
2887
 
2470
2888
--------------------------------------------------------------------
2471
2889
>>> import xmlrpclib
2474
2892
{'sessionId': 'cd6a3bc6a1de28eb5bfa181e5f6b916d44af31a9'}
2475
2893
--------------------------------------------------------------------
2476
2894
 
2477
 
[[aria2_xmlrpc_aria2_shutdown]]
 
2895
[[aria2_rpc_aria2_shutdown]]
2478
2896
*aria2.shutdown* ()
2479
2897
^^^^^^^^^^^^^^^^^^^
2480
2898
 
2483
2901
 
2484
2902
This method shutdowns aria2.  This method returns "OK".
2485
2903
 
2486
 
[[aria2_xmlrpc_aria2_forceShutdown]]
 
2904
[[aria2_rpc_aria2_forceShutdown]]
2487
2905
*aria2.forceShutdown* ()
2488
2906
^^^^^^^^^^^^^^^^^^^^^^^^
2489
2907
 
2490
2908
Description
2491
2909
+++++++++++
2492
2910
 
2493
 
This method shutdowns aria2. This method behaves like *<<aria2_xmlrpc_aria2_shutdown, aria2.shutdown>>*
 
2911
This method shutdowns aria2. This method behaves like *<<aria2_rpc_aria2_shutdown, aria2.shutdown>>*
2494
2912
except that any actions which takes time such as contacting BitTorrent
2495
2913
tracker are skipped. This method returns "OK".
2496
2914
 
2497
 
[[aria2_xmlrpc_system_multicall]]
 
2915
[[aria2_rpc_system_multicall]]
2498
2916
*system.multicall* ('methods')
2499
2917
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2500
2918
 
2510
2928
method call or struct of fault element if an encapsulated method call
2511
2929
fails.
2512
2930
 
2513
 
Example
2514
 
+++++++
 
2931
JSON-RPC Example
 
2932
++++++++++++++++
 
2933
 
 
2934
In the following example, we add 2 downloads. First one is
 
2935
\http://example.org/file and second one is file.torrent:
 
2936
 
 
2937
---------------------------------------------------------------------------------------------------
 
2938
>>> import urllib2, json, base64
 
2939
>>> from pprint import pprint
 
2940
>>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
 
2941
...                       'method':'system.multicall',
 
2942
...                       'params':[[{'methodName':'aria2.addUri',
 
2943
...                                   'params':[['http://example.org']]},
 
2944
...                                  {'methodName':'aria2.addTorrent',
 
2945
...                                   'params':[base64.b64encode(open('file.torrent').read())]}]]})
 
2946
>>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
 
2947
>>> pprint(json.loads(c.read()))
 
2948
{u'id': u'qwer', u'jsonrpc': u'2.0', u'result': [[u'1'], [u'2']]}
 
2949
---------------------------------------------------------------------------------------------------
 
2950
 
 
2951
JSON-RPC also supports Batch request described in JSON-RPC 2.0 Specification:
 
2952
 
 
2953
----------------------------------------------------------------------------------------
 
2954
>>> jsonreq = json.dumps([{'jsonrpc':'2.0', 'id':'qwer',
 
2955
...                        'method':'aria2.addUri',
 
2956
...                        'params':[['http://example.org']]},
 
2957
...                       {'jsonrpc':'2.0', 'id':'asdf',
 
2958
...                        'method':'aria2.addTorrent',
 
2959
...                        'params':[base64.b64encode(open('file.torrent').read())]}])
 
2960
>>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
 
2961
>>> pprint(json.loads(c.read()))
 
2962
[{u'id': u'qwer', u'jsonrpc': u'2.0', u'result': u'1'},
 
2963
 {u'id': u'asdf', u'jsonrpc': u'2.0', u'result': u'2'}]
 
2964
----------------------------------------------------------------------------------------
 
2965
 
 
2966
XML-RPC Example
 
2967
+++++++++++++++
2515
2968
 
2516
2969
In the following example, we add 2 downloads. First one is
2517
2970
\http://example.org/file and second one is file.torrent:
2530
2983
Error Handling
2531
2984
~~~~~~~~~~~~~~
2532
2985
 
2533
 
In case of error, aria2 returns faultCode=1 and the error message in
 
2986
In JSON-RPC, aria2 returns JSON object which contains error code in
 
2987
code and the error message in message.
 
2988
 
 
2989
In XML-RPC, aria2 returns faultCode=1 and the error message in
2534
2990
faultString.
2535
2991
 
2536
 
[[aria2_xmlrpc_options]]
 
2992
[[aria2_rpc_options]]
2537
2993
Options
2538
2994
~~~~~~~
2539
2995
 
2543
2999
In the option struct, name element is option name(without preceding
2544
3000
"--") and value element is argument as string.
2545
3001
 
 
3002
JSON-RPC Example
 
3003
^^^^^^^^^^^^^^^^
 
3004
 
 
3005
----------------------------------------------
 
3006
{'split':'1', 'http-proxy':'http://proxy/'}
 
3007
----------------------------------------------
 
3008
 
 
3009
XML-RPC Example
 
3010
^^^^^^^^^^^^^^^
 
3011
 
2546
3012
-------------------------------------------------
2547
3013
<struct>
2548
3014
  <member>
2563
3029
not enough. To overcome this situation, they can take array as value
2564
3030
as well as string.
2565
3031
 
 
3032
JSON-RPC Example
 
3033
^^^^^^^^^^^^^^^^
 
3034
 
 
3035
-------------------------------------------------------------
 
3036
{'header':['Accept-Language: ja', 'Accept-Charset: utf-8']}
 
3037
-------------------------------------------------------------
 
3038
 
 
3039
XML-RPC Example
 
3040
^^^^^^^^^^^^^^^
 
3041
 
2566
3042
---------------------------------------------------------------
2567
3043
<struct>
2568
3044
  <member>
2591
3067
'1'
2592
3068
--------------------------------------------------------------------------
2593
3069
 
 
3070
JSON-RPC using HTTP GET
 
3071
~~~~~~~~~~~~~~~~~~~~~~~
 
3072
 
 
3073
The JSON-RPC interface also supports request via HTTP GET.
 
3074
The encoding scheme in GET parameters is based on http://groups.google.com/group/json-rpc/web/json-rpc-over-http[JSON-RPC over HTTP Specification (2008-1-15(RC1))].
 
3075
The encoding of GET parameters are follows:
 
3076
 
 
3077
--------------------------------------------------------------
 
3078
/jsonrpc?method=METHOD_NAME&id=ID&params=BASE64_ENCODED_PARAMS
 
3079
--------------------------------------------------------------
 
3080
 
 
3081
The 'method' and 'id' are always treated as JSON string and their
 
3082
encoding must be UTF-8.
 
3083
 
 
3084
For example, The encoded string of aria2.tellStatus('3') with id='foo'
 
3085
looks like this:
 
3086
 
 
3087
---------------------------------------------------------
 
3088
/jsonrpc?method=aria2.tellStatus&id=foo&params=WyIzIl0%3D
 
3089
---------------------------------------------------------
 
3090
 
 
3091
The 'params' parameter is Base64-encoded JSON array which usually
 
3092
appears in 'params' attribute in JSON-RPC request object.  In the
 
3093
above example, the params is ['3'], therefore:
 
3094
 
 
3095
-------------------------------------------------------------
 
3096
['3'] --(Base64)--> WyIzIl0= --(Percent Encode)--> WyIzIl0%3D
 
3097
-------------------------------------------------------------
 
3098
 
 
3099
The JSON-RPC interface supports JSONP. You can specify the callback
 
3100
function in 'jsoncallback' parameter.
 
3101
 
 
3102
-------------------------------------------------------------------------
 
3103
/jsonrpc?method=aria2.tellStatus&id=foo&params=WyIzIl0%3D&jsoncallback=cb
 
3104
-------------------------------------------------------------------------
 
3105
 
 
3106
For Batch request, 'method' and 'id' parameter must not be specified.
 
3107
Whole request must be specified in 'params' parameter. For example,
 
3108
Batch request
 
3109
 
 
3110
-------------------------------------------------------------
 
3111
[{'jsonrpc':'2.0', 'id':'qwer', 'method':'aria2.getVersion'},
 
3112
 {'jsonrpc':'2.0', 'id':'asdf', 'method':'aria2.tellActive'}]
 
3113
-------------------------------------------------------------
 
3114
 
 
3115
will be encoded like this:
 
3116
 
 
3117
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 
3118
/jsonrpc?params=W3sianNvbnJwYyI6ICIyLjAiLCAiaWQiOiAicXdlciIsICJtZXRob2QiOiAiYXJpYTIuZ2V0VmVyc2lvbiJ9LCB7Impzb25ycGMiOiAiMi4wIiwgImlkIjogImFzZGYiLCAibWV0aG9kIjogImFyaWEyLnRlbGxBY3RpdmUifV0%3D
 
3119
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 
3120
 
2594
3121
Sample XML-RPC Client Code
2595
3122
~~~~~~~~~~~~~~~~~~~~~~~~~~
2596
3123
 
2962
3489
 
2963
3490
COPYRIGHT
2964
3491
---------
2965
 
Copyright (C) 2006, 2010 Tatsuhiro Tsujikawa
 
3492
Copyright (C) 2006, 2011 Tatsuhiro Tsujikawa
2966
3493
 
2967
3494
This program is free software; you can redistribute it and/or modify
2968
3495
it under the terms of the GNU General Public License as published by