From 119cf01f6c4d30fc7648552b7b7c901fa592f013 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sat, 30 Oct 2010 04:15:30 +0000 Subject: [PATCH] 2010-10-30 Tatsuhiro Tsujikawa Added XML-RPC code example for options. * doc/aria2c.1.txt --- ChangeLog | 5 +++++ doc/aria2c.1 | 18 ++++++++++++++++++ doc/aria2c.1.html | 14 +++++++++++++- doc/aria2c.1.txt | 12 ++++++++++++ 4 files changed, 48 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index e9ccb0a3..b07ad739 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-10-30 Tatsuhiro Tsujikawa + + Added XML-RPC code example for options. + * doc/aria2c.1.txt + 2010-10-30 Tatsuhiro Tsujikawa Added internal cross reference for sections and subsections. diff --git a/doc/aria2c.1 b/doc/aria2c.1 index 58eee9be..664fecfa 100644 --- a/doc/aria2c.1 +++ b/doc/aria2c.1 @@ -3458,6 +3458,24 @@ In the option struct, name element is option name(without preceding "\-\-") and .if n \{\ .RE .\} +.sp +Following example adds a download with 2 options: dir and header\&. header option has 2 values, so it uses a list: +.sp +.if n \{\ +.RS 4 +.\} +.nf +>>> import xmlrpclib +>>> s = xmlrpclib\&.ServerProxy(\*(Aqhttp://localhost:6800/rpc\*(Aq) +>>> opts = dict(dir=\*(Aq/tmp\*(Aq, +\&.\&.\&. header=[\*(AqAccept\-Language: ja\*(Aq, +\&.\&.\&. \*(AqAccept\-Charset: utf\-8\*(Aq]) +>>> s\&.aria2\&.addUri([\*(Aqhttp://example\&.org/file\*(Aq], opts) +\*(Aq1\*(Aq +.fi +.if n \{\ +.RE +.\} .SS "Sample XML\-RPC Client Code" .sp The following Ruby script adds \fIhttp://localhost/aria2\&.tar\&.bz2\fR to aria2c operated on localhost with option \fB\-\-dir\fR=\fI/downloads\fR and prints its reponse\&. diff --git a/doc/aria2c.1.html b/doc/aria2c.1.html index cefcc6cc..75daec42 100644 --- a/doc/aria2c.1.html +++ b/doc/aria2c.1.html @@ -4088,6 +4088,18 @@ as well as string.

</member> </struct> +

Following example adds a download with 2 options: dir and header. +header option has 2 values, so it uses a list:

+
+
+
>>> import xmlrpclib
+>>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
+>>> opts = dict(dir='/tmp',
+...             header=['Accept-Language: ja',
+...                     'Accept-Charset: utf-8'])
+>>> s.aria2.addUri(['http://example.org/file'], opts)
+'1'
+

Sample XML-RPC Client Code

The following Ruby script adds http://localhost/aria2.tar.bz2 to aria2c operated on localhost with option --dir=/downloads and @@ -4538,7 +4550,7 @@ files in the program, then also delete it here.


diff --git a/doc/aria2c.1.txt b/doc/aria2c.1.txt index c468abbe..a1b9311e 100644 --- a/doc/aria2c.1.txt +++ b/doc/aria2c.1.txt @@ -2136,6 +2136,18 @@ as well as string. --------------------------------------------------------------- +Following example adds a download with 2 options: dir and header. +header option has 2 values, so it uses a list: +------------------------------------------------------------------------- +>>> import xmlrpclib +>>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc') +>>> opts = dict(dir='/tmp', +... header=['Accept-Language: ja', +... 'Accept-Charset: utf-8']) +>>> s.aria2.addUri(['http://example.org/file'], opts) +'1' +-------------------------------------------------------------------------- + Sample XML-RPC Client Code ~~~~~~~~~~~~~~~~~~~~~~~~~~