1.. _aria2c:
2
3aria2c(1)
4=========
5
6SINOPSE
7-------
8
9**aria2c** [<OPÇÕES>] [<URI>|<MAGNET>|<ARQUIVO_TORRENT>|<ARQUIVO_METALINK>] ...
10
11.. index::   double:  Descrição; Sumário
12             double: Resumo; Executivo
13             triple: O que; Por que; Porque
14
15
16DESCRIÇÃO
17---------
18
19.. warning::
20
21   This translation has been outdated quite sometime now, and lacks
22   many recent changes.  Please consult English version manual for
23   updated information.
24
25Observação: Para executar o aria2 em um terminal ou no prompt da
26linha de comando do windows, utilize o comando aria2c.
27
28aria2 é um utilitário para download de arquivos. Os protocolos suportados são
29HTTP, HTTPS, FTP, BitTorrent e Metalink. aria2 pode efetuar download de arquivos
30a partir de múltiplas fontes e protocolos e tenta utilizar a máxima capacidade
31de banda. Há suporte para download de arquivos que tem origem em HTTP, HTTPS,
32FTP, BitTorrent e Metalink ao mesmo tempo, enquanto os dados baixados podem ser
33(uploaded) e compartilhados pelo BitTorrent. Usando conferência / aferição (checksum) nos
34Metalinks, aria2 automaticamente valida o conteúdo dos dados enquanto faz
35o download do arquivo como BitTorrent.
36
37.. index::   double: Opções; Básicas;
38
39Opções Básicas do aria2
40-----------------------
41
42Opções Comuns
43~~~~~~~~~~~~~
44
45.. option:: -d, --dir=<DIR>
46
47  O diretório onde será armazenado o arquivo baixado.
48
49.. option:: -i, --input-file=<ARQUIVO>
50
51  Executa download da(s) URI encontradas no ARQUIVO. Podem ser especificados
52  múltiplos URI para uma simples entidade: separe URI na mesma linha com
53  um caracter TAB (tabulação).
54  Quando desejar ler a entrada padrão (stdin) especificar ``-`` (hífen).
55  Adicionalmente, diversas opções podem ser especificadas após cada linha de URI.
56  Esta(s) linha(s) opcional(is) deve(m) começar(em) com um ou mais espaços em
57  branco e possuir(em) apenas uma opção por linha.
58  Ver subseção `Arquivo de Entrada`_ para mais detalhes.
59  Ver também opção :option:`--deferred-input`.
60
61.. option:: -l, --log=<LOG>
62
63  O nome do arquivo de log. Se ``-`` for especificado (entrada padrão), log é
64  gravado em stdout (saída padrão). Se uma string vazia("") é especificada, log
65  não será gravado em arquivo.
66
67.. option:: -j, --max-concurrent-downloads=<N>
68
69  Configura o número máximo de downloads paralelos para cada URI (HTTP,
70  HTTPS, FTP), Torrent e Metalink. Ver também opção :option:`--split <-s>`.
71  Padrão: ``5``
72
73.. option:: -V, --check-integrity [true|false]
74
75  Verifica a integridade do arquivo validando pedaços hashes ou um hash do
76  arquivo inteiro.  Essa opção tem efeito só em downloads BitTorrent, Metalink
77  com checksums ou HTTP, HTTPS e FTP com a opção :option:`--checksum`. Se pedaços
78  de hashes são providos, essa opção pode detectar porções danificadas de um
79  arquivo e efetuar novamente o download desses pedaços. Se especificar hash
80  do arquivo inteiro, a verificação do hash ocorrerá só ao final do download,
81  validação que leva em conta o tamanho do arquivo, e o download reinicirá a
82  partir do início.  Se houver especificação de ambos métodos de hash será
83  utilizado o hash de pedações.
84  Padrão:
85  ``false``
86
87.. option:: -c, --continue [true|false]
88
89   Continua o download a partir de um download parcial, anteriormente
90   interrompido.  Use esta opção para retormar um download iniciado a partir
91   de um browser (navegador) ou outro programa que faz baixa de arquivos
92   sequencialmente desde o início.
93   Atualmente esta opção só é aplicavel a download de HTTP, HTTPS e FTP.
94
95.. option:: -h, --help[=<TÓPICO>|<PALAVRA-CHAVE>]
96
97   As mensagens de Ajuda são classificadas em temas. Um tema se inicia com
98   ``#``. Por exemplo, digitar ``--help=#http`` para obter a explicação do uso das
99   opções do tema ``#http``. Se digitar um termo que não é tema, haverá exibição
100   das opções que incluem o termo informado.
101   Valores disponíveis para temas podem ser: ``#basic``, ``#advanced``,
102   ``#http``, ``#https``, ``#ftp``,
103   ``#metalink``, ``#bittorrent``, ``#cookie``, ``#hook``, ``#file``, ``#rpc``,
104   ``#checksum``, ``#experimental``, ``#deprecated``, ``#help``, ``#all``
105   Padrão: ``#basic``
106
107Opções HTTP / FTP
108~~~~~~~~~~~~~~~~~
109
110.. index::	double: proxy; servidor;
111		triple: usuário; senha; proxy;
112
113.. option:: --all-proxy=<PROXY>
114
115  Usar este servidor proxy para todos protocolos.  Para limpar proxy
116  previamente definido, use "".  Esta configuração pode ser sobreposta através
117  da especificação de um servidor proxy para um determinado protocolo usando
118  opções :option:`--http-proxy`, :option:`--https-proxy` e :option:`--ftp-proxy`.
119  Isto afeta todas as URIs.
120  O formato da opção PROXY é ``[http://][USUÁRIO:SENHA@]SERVIDOR[:PORTA]``.
121  Ver também seção `VARIÁVEIS DE AMBIENTE`_  section.
122
123  .. note::
124
125    Se usuário e senha são embutidos na URI do proxy eles também podem ser
126    especificados através das opções
127    *--{http,https,ftp,all}-proxy-{usuário,senha}*,
128    aqueles que aparecerem por último assumem a precedência.
129    Por exemplo, quando temos:
130    ``http-proxy-user=meunome``, ``http-proxy-passwd=minhasenha``
131    em aria2.conf e especificamos ``--http-proxy="http://svrproxy"`` na
132    linha de comando, então obtemos como proxy HTTP ``http://svrproxy``
133    com o usuário ``meunome`` e senha ``minhasenha``.
134
135    Outro exemplo: quando especificamos na linha de comando:
136    ``--http-proxy="http://usuário:senha@svrproxy" --http-proxy-user="meunome"
137    --http-proxy-passwd="minhasenha"``, então obtemos proxy HTTP
138    ``http://svrproxy`` com usuário ``meunome`` e senha ``minhasenha``.
139
140    Mais um exemplo: se especificamos na linha de comando:
141    ``--http-proxy-user="meunome" --http-proxy-passwd="minhasenha"
142    --http-proxy="http://utilizador:acesso@svrproxy"``, então obtemos
143    o proxy HTTP ``http://svrproxy`` com o usuário ``utilizador``
144    e a senha ``acesso``.
145
146.. option:: --all-proxy-passwd=<SENHA>
147
148  Define senha para a opção :option:`--all-proxy`.
149
150.. option:: --all-proxy-user=<USUÁRIO>
151
152  Define usuário para opção :option:`--all-proxy`.
153
154.. option:: --checksum=<TIPO>=<ALGORITMO>
155
156  Define verificação (checksum). TIPO é o tipo de algoritmo(hash). Os tipos de
157  algoritmos estão listados em ``Algoritmos de Hash`` e podem ser obtidos
158  através do do comando ``aria2c -v``. DIGEST é o código hexadecimal.  Por
159  examplo, definindo sha-1 o resultado parece com:
160  ``sha-1=0192ba11326fe2298c8cb4de616f4d4140213838`` Essa opção aplica-se
161  apenas para downloads HTTP, HTTPS e FTP.
162
163.. option:: --connect-timeout=<SEGUNDOS>
164
165  Define o tempo de espera em segundos para estabelecer a conexão com o servidor
166  proxy. Após o estabelecimento da conexão, esta opção não tem mais efeito, mas
167  a opção :option:`--timeout <-t>` será utilizada.
168  Padrão: ``60``
169
170.. option:: --dry-run [true|false]
171
172  Se ``true`` é informado, aria2 apenas verifica se o arquivo remoto está
173  disponível para download dos dados. Esta opção tem efeito em downloads de
174  servidores HTTP, HTTPS e FTP.  Downloads de BitTorrent serão cancelados se for
175  especificado ``true``.
176  Padrão: ``false``
177
178.. option:: --lowest-speed-limit=<VELOCIDADE>
179
180  Fecha a conexão se a velocidade de download é menor ou igual ao valor
181  especificado, bytes por segundo.
182  ``0`` significa que aria2 não levará em conta limite de velocidade mínima.
183  Pode ser anexado ``K`` ou ``M`` (1K = 1024, 1M = 1024K).
184  Esta opção não abrange downloads do tipo BitTorrent.
185  Padrão: ``0``
186
187.. option:: -x, --max-connection-per-server=<NÚMERO>
188
189  O número máximo de conexões para um servidor em cada download.
190  Padrão: ``1``
191
192.. option:: --max-file-not-found=<NÚMERO>
193
194  Se aria2 recebe çódigo de retorno "arquivo não encontrado" de um servidor
195  remoto de HTTP / FTP um NÚMERO de vezes sem obter nenhum byte, então o
196  download é forçado a falhar.
197  Especificar ``0`` para desabilitar esta opção. Esta opção só é válida
198  para servidores HTTP / FTP.
199  Padrão: ``0``
200
201.. option:: -m, --max-tries=<NÚMERO>
202
203  Define o número de tentativas. ``0`` significa ilimitadas.
204  See also :option:`--retry-wait`.
205  Padrão: ``5``
206
207.. option:: -k, --min-split-size=<TAMANHO>
208
209  aria2 não divide menos que 2 * TAMANHO o intervalo de bytes.  Por exemplo,
210  considere download de um arquivo de 20MiB. Se o TAMANHO é 10M, aria2 pode
211  dividir o arquivo em 2 intervalos de [0-10MiB) e [10MiB-20MiB) e executar o
212  download usando 2 fontes (logicamente se a opção :option:`--split <-s>` >= 2).
213  Se o TAMANHO é 15M, desde que 2 * 15M > 20Mib, aria2 não dividirá o arquivo e
214  fará o download de 1 fonte.  Pde ser anexado ``K`` ou ``M``
215  (1K = 1024, 1M = 1024K).
216  Valores Possíveis: ``1M`` -``1024M``
217  Padrão: ``20M``
218
219.. option:: -n, --no-netrc [true|false]
220
221  Desabilita suporte netrc.
222  Padrão: Suporte a netrc é habilitado por padrão.
223
224  .. note::
225
226    arquivo netrc é lido somente no início se a opção :option:`--no-netrc <-n>` é
227    ``false``.
228    Portanto se a opção :option:`--no-netrc <-n>` é ``true`` no início, não haverá
229    netrc disponível durante toda a sessão, mesmo que seja utilizada a opção
230    :func:`aria2.changeGlobalOption` para executar a opção :option:
231    `--no-netrc=false <-n>`.
232    .
233
234.. option:: --no-proxy=<DOMÍNIOS>
235
236  Especifica nomes de servidores, domínios e endereços de redes com ou sem blocos
237  CIDR para os quais não serão utilizados proxy.
238
239  .. note::
240
241    Para endereço de rede com blocos CIDR, ambos endereços IPv4 ou IPv6 funcionam.
242    Implementação atual, não resolve nome host em URI para comparar com endereço
243    especificado na opção :option:`--no-proxy`. Portanto só será efetiva se a URI
244    possuir números de endereço IP.
245
246.. option:: -o, --out=<ARQUIVO>
247
248  O nome do arquivo baixado. Quando a opção :option:`--force-sequential <-Z>` é
249  utilizada esta opção será ignorada.
250
251  .. note::
252
253    Em um download Metalink ou BitTorrent não poderá ser especificado o nome
254    do arquivo. O nome do arquivo especificado aqui é usado quando através
255    da linha de comando é informada para o aria2 sem a utilização da opção
256    :option:`--input-file <-i>`, :option:`--force-sequential <-Z>`.
257    Por exemplo:
258
259    .. code-block:: console
260
261      $ aria2c -o meuarquivo.zip "http://server1/arquivo.zip" "http://server2/arquivo.zip"
262
263.. option:: --proxy-method=<MÉTODO>
264
265  Define o método utilizado para requisições de proxy.  MÉTODO é ``get`` ou
266  ``tunnel``. Downloads HTTPS sempre utiliza ``tunnel``, independentemente
267  desta opção.
268  Padrão: ``get``
269
270.. option:: -R, --remote-time [true|false]
271
272  Recuperar timestamp do arquivo remoto a partir do servidor remoto HTTP / FTP
273  e se disponível, aplicá-lo ao arquivo local.
274  Padrão: ``false``
275
276.. option:: --reuse-uri [true|false]
277
278  Reutilizar uma URI já utilizada. Se não habilitada as URIs já utilizadas serão
279  abandonadas.
280  Padrão: ``true``
281
282.. option:: --retry-wait=<SEGUNDOS>
283
284  Define quantos segundos haverá entre as tentativas. Com SEGUNDOS > 0, aria2 irá
285  tentará fazer o download quando o servidor HTTP retornar código resposta 503.
286  Padrão:  ``0``
287
288.. option:: --server-stat-of=<ARQUIVO>
289
290  Define o nome do arquivo no qual será salvo o perfil de performance de um
291  ou mais servidores acessados.
292  Para carregar dados já salvos utilizar opção :option:`--server-stat-if`.
293  Ver subseção `Perfil Performance Servidor`_ abaixo,
294  para o formato do arquivo.
295
296
297.. option:: --server-stat-if=<ARQUIVO>
298
299  Specify the filename to load performance profile of the servers. The
300  loaded data will be used in some URI selector such as ``feedback``.
301  See also :option:`--uri-selector` option. See
302  `Perfil Performance Servidor`_
303  subsection below for file format.
304
305.. option:: --server-stat-timeout=<SEGUNDOS>
306
307  Specifies timeout in seconds to invalidate performance profile of
308  the servers since the last contact to them.
309  Padrão: ``86400`` (24hours)
310
311.. option:: -s, --split=<N>
312
313  Download a file using N connections.  If more than N URIs are given,
314  first N URIs are used and remaining URIs are used for backup.  If
315  less than N URIs are given, those URIs are used more than once so
316  that N connections total are made simultaneously.  The number of
317  connections to the same host is restricted by
318  :option:`--max-connection-per-server <-x>` option.
319  See also :option:`--min-split-size <-k>` option.
320  Padrão: ``5``
321
322  .. note::
323
324    Some Metalinks regulate the number of servers to connect.  aria2
325    strictly respects them.  This means that if Metalink defines the
326    maxconnections attribute lower than N, then aria2 uses the
327    value of maxconnections attribute instead of N.
328
329.. option:: --stream-piece-selector=<SELECTOR>
330
331  Specify piece selection algorithm used in HTTP e FTP download. Piece
332  means fixed length segment which is downloaded in parallel in
333  segmented download. If ``default`` is given, aria2 selects piece so
334  that it reduces the number of establishing connection. This is
335  reasonable default behaviour because establishing connection is an
336  expensive operation.  If ``inorder`` is given, aria2 selects piece
337  which has minimum index. Index=0 means first of the file. This will
338  be useful to view movie while downloading it.
339  :option:`--enable-http-pipelining` option may
340  be useful to reduce reconnection overhead.  Please note that aria2
341  honors
342  :option:`--min-split-size <-k>` option,
343  so it will be necessary to specify a reasonable value to
344  :option:`--min-split-size <-k>` option.
345  If ``geom`` is given, at the beginning aria2 selects piece which has
346  minimum index like ``inorder``, but it exponentially increasingly
347  keeps space from previously selected piece. This will reduce the
348  number of establishing connection and at the same time it will
349  download the beginning part of the file first. This will be useful
350  to view movie while downloading it.
351  Padrão: ``default``
352
353.. option:: -t, --timeout=<SEGUNDOS>
354
355  Set timeout in seconds.
356  Padrão: ``60``
357
358.. option:: --uri-selector=<SELECTOR>
359
360  Specify URI selection algorithm. The possible values are ``inorder``,
361  ``feedback`` and ``adaptive``.  If ``inorder`` is given, URI is tried in
362  the order appeared in the URI list.  If ``feedback`` is given, aria2
363  uses download speed observed in the previous downloads and choose
364  fastest server in the URI list. This also effectively skips dead
365  mirrors. The observed download speed is a part of performance
366  profile of servers mentioned in :option:`--server-stat-of` and
367  :option:`--server-stat-if` options.  If ``adaptive`` is given, selects one of
368  the best mirrors for the first and reserved connections.  For
369  supplementary ones, it returns mirrors which has not been tested
370  yet, and if each of them has already been tested, returns mirrors
371  which has to be tested again. Otherwise, it doesn't select anymore
372  mirrors. Like ``feedback``, it uses a performance profile of servers.
373  Padrão: ``feedback``
374
375Opções Específicas de HTTP e HTTPS
376~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
377
378.. index:	triple: hhtp; http; opções
379
380.. option:: --ca-certificate=<ARQUIVO>
381
382  Utilizar o certificado do ARQUIVO FILE para verificar os Servidores.
383  O certificado precisa estar no formato PEM e pode conter múltiplos
384  certificados CA.
385
386  Utilizar a opção :option:`--check-certificate` para habilitar a verificação.
387
388  .. note::
389
390    Se aria2 foi compilado com OpenSSL ou versão mais recente de GnuTLS a qual
391    tem a função ``gnutls_certificate_set_x509_system_trust()`` e a biblioteca
392    foi adequadamente configurada para localizar o certificado CA existente,
393    aria2 irá carregar automaticamente estes certificados no início.
394
395.. option:: --certificate=<ARQUIVO>
396
397  Usar arquivo com certificado cliente.
398  O certificado deve estar no formato PEM.
399  Pode ser usada a opção :option:`--private-key` para especificar uma chave
400  particular.
401
402.. option:: --check-certificate [true|false]
403
404  Verifica se o peer esta usando o certificado especificado na opção
405  :option:`--ca-certificate`.
406  Padrão: ``true``
407
408.. option:: --http-accept-gzip [true|false]
409
410  Envia cabeçalho requisição ``Accept: deflate, gzip`` e faz (inflate) se
411  o servidor remoto responder com  ``Content-Encoding: gzip`` ou
412  ``Content-Encoding: deflate``.  Padrão: ``false``
413
414  .. note::
415
416    Alguns servidores respondem com ``Content-Encoding: gzip`` para arquivos
417    que são gzip. aria2 faz inflate destes por causa do cabeçalho de resposta.
418
419.. option:: --http-auth-challenge [true|false]
420
421  Envia cabeçalho de autorização HTTP só quando requisitado pelo servidor.
422  Se ``false`` é habilitado, então o cabeçalho de autorização sempre será
423  enviado ao servidor.  Há uma exceção: se o nome do usuário de senha são
424  embutidas na URI, o cabeçalho de autorização sempre será enviado ao servidor
425  independente desta opção.  Padrão: ``false``
426
427.. option:: --http-no-cache [true|false]
428
429   Envia Cache-Control: no-cache e Pragma: cabeçalho no-cache para evitar
430   conteúdo do cache.  Se ``false`` é fornecido, esses cabeçalhos não serão
431   enviados e poderá ser adicionado o cabeçalho de Cache-Control com a diretiva
432   desejada usando a opção :option:`--header`. Padrão: ``true``
433
434.. option:: --http-user=<USUÁRIO>
435
436  Define usuário HTTP. Isto afeta todas as URIs.
437
438.. option:: --http-passwd=<PASSWD>
439
440  Define senha HTTP. Isto afeta todas as URIs.
441
442.. option:: --http-proxy=<PROXY>
443
444  Usar este servidor proxy para HTTP.  Para limpar o proxy anteriormente
445  definido use "".  Ver também opção :option:`--all-proxy`.  Isto afeta todas
446  URIs.  O formato de PROXY é ``[http://][USUÁRIO:SENHA@]SERVIDOR[:PORTA]``
447
448.. option:: --http-proxy-passwd=<SENHA>
449
450  Define a senha para opção :option:`--http-proxy`.
451
452.. option:: --http-proxy-user=<USUÁRIO>
453
454  Define o usuário para a opção :option:`--http-proxy`.
455
456.. option:: --https-proxy=<PROXY>
457
458  Usar este servidor proxy para HTTPS. Para limpar o proxy anteriormente,
459  use "".  Ver também opção :option:`--all-proxy`.  Isto afeta todas URIs.  O
460  formato de PROXY é ``[https://][USUÁRIO:SENHA@]SERVIDOR[:PORTA]``
461
462.. option:: --https-proxy-passwd=<SENHA>
463
464  Define senha para a opção :option:`--https-proxy`.
465
466.. option:: --https-proxy-user=<USUÁRIO>
467
468  Define usuário para a opção :option:`--https-proxy`.
469
470.. option:: --private-key=<ARQUIVO>
471
472  Define o arquivo de chave particular que será usado.
473  A chave particular deve estar no formato PEM e não pode estar criptografada.
474  O comportamento quando estiver criptografada é indefinido.
475  Ver também a opção :option:`--certificate`.
476
477.. option:: --referer=<REFERER>
478
479  Define a referência. Afeta todas URIs. Se ``*`` é usado, cada URI requisitada é usada
480  como referência (referer). Pode ser útil quando usado em conjunto com a opção
481  :option:`--parameterized-uri`.
482
483.. option:: --enable-http-keep-alive [true|false]
484
485  Enable HTTP/1.1 persistent connection.
486  Padrão: ``true``
487
488.. option:: --enable-http-pipelining [true|false]
489
490  Habilita pipelining para HTTP/1.1.
491  Padrão: ``false``
492
493  .. note::
494
495    Da perspectiva de performance, não há vantagem em habilitar esta opção.
496
497.. option:: --header=<HEADER>
498
499  Anexa CABEÇALHOao ao cabeçalho HTTP requisitado.
500  Pode usar esta opção várias vezes para especificar múltiplos cabeçalhos:
501
502  .. code-block:: console
503
504        $ aria2c --header="X-A: b78" --header="X-B: 9J1" "http://servidor/arquivo"
505
506.. index::	triple: cookies; load; save;
507
508.. option:: --load-cookies=<ARQUIVO>
509
510  Carregar Cookies do ARQUIVO usando formato Firefox3 format (SQLite3),
511  Chromium / Google Chrome (SQLite3) e formato
512  Mozilla / Firefox(1.x/2.x) / Netscape.
513
514  .. note::
515
516    Se aria2 é compilado sem libsqlite3, então não havera suporte aos formatos
517    de cookie Firefox3 e Chromium / Google Chrome.
518
519.. option:: --save-cookies=<ARQUIVO>
520
521  Salva Cookies para o ARQUIVO no formato Mozilla / Firefox(1.x/2.x) /
522  Netscape.  Se ARQUIVO já existe, será sobreposto.  Cookies da Sessão também
523  serão salvos e seus valores de expiração serão tratados como 0.
524  Valores Possíveis: ``/caminho/do/arquivo``
525
526.. option:: --use-head [true|false]
527
528  Usar método HEAD para a primeira requisição ao servidor HTTP.
529  Padrão: ``false``
530
531
532.. option:: -U, --user-agent=<AGENTE_USUÁRIO>
533
534  Define usuário agente para download HTTP, HTTPS.
535  Padrão: ``aria2/$VERSION``, $VERSION é substituída pela versão do aria2.
536
537Opções Específicas de FTP
538~~~~~~~~~~~~~~~~~~~~~~~~~
539
540.. option:: --ftp-user=<USUÁRIO>
541
542  Definir o usuário FTP. Isto afeta todas as URIs.
543  Padrão: ``anonymous``
544
545.. option:: --ftp-passwd=<SENHA_FTP>
546
547  Definir senha FTP. Isto afeta todas as URIs.
548  Se o nome existe, mas a senha esta ausente, para login em uma URI, aria2
549  tenta obter a senha usando o arquivo .netrc, caso exista senha declarada
550  no .netrc. Se não existir será utilizada a senha declarada nesta opção.
551  Padrão: ``ARIA2USER@``
552
553.. option:: -p, --ftp-pasv [true|false]
554
555  Usar modo passivo no FTP.
556  Se ``false`` é informado, o modo ativo será usado.
557  Padrão: ``true``
558
559.. option:: --ftp-proxy=<PROXY>
560
561  Usar este servidor proxy para FTP.  Para limpar definição proxy previamente
562  definido, use "".  Ver também opção :option:`--all-proxy`.
563  Isto afeta todas URIs.  O formato do PROXY é
564  ``[http://][USUÁRIO:SENHA@]SERVIDOR[:PORTA]``
565
566.. option:: --ftp-proxy-passwd=<PASSWD>
567
568  Define senha para a opção :option:`--ftp-proxy`.
569
570.. option:: --ftp-proxy-user=<USUÁRIO>
571
572  Define senha para opção :option:`--ftp-proxy`.
573
574.. option:: --ftp-type=<TYPE>
575
576  Define tipo de transferência FTP. Que pode ser: ``binary`` ou ``ascii``.
577  Padrão: ``binary``
578
579.. option:: --ftp-reuse-connection [true|false]
580
581  Reutilizar conexão FTP.
582  Padrão: ``true``
583
584Opções Comuns de BitTorrent / Metalink
585~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
586
587.. option:: --select-file=<INDEX>...
588
589  Define arquivo para download através da especificação de seu index.
590  Para achar o index do arquivo use a opção :option:`--show-files <-S>`.
591  Múltiplos indíces podem ser especificados usando-se ``,``, por exemplo:
592  ``3,6``.  Também pode ser usado ``-`` para especificar intervalos:
593  ``1-5``.  Ambos podem ser usados juntos ``,`` e ``-`` exemplo:
594  ``1-5,8,9``.  Quando usados com a opção -M, o índice pode variar dependendo
595  das opções da query. Ver opções (*--metalink-\ **).
596
597  .. note::
598
599    Em torrent de múltiplos arquivos, os arquivos adjacentes especificados
600    por essa opção também podem ser baixados. Esse é o comportamento esperado
601    não é um bug/erro.  Um simples pedaço pode incluir diversos arquivos ou
602    partes de arquivos, e aria2 grava o pedaço(s) no(s) arquivo(s)
603    apropriado(s).
604
605.. option:: -S, --show-files [true|false]
606
607  Imprimir a lista de arquivos do ".torrent", ".meta4" e ".metalink" e termina.
608  No caso de arquivo ".torrent", informações adicionais são impressas.
609  (infohash, tamanho pedaço, etc).
610
611Opções Específicas de BitTorrent
612~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
613
614.. option:: --bt-enable-lpd [true|false]
615
616  Habilita Descobrir Peer Local.  Se indicador particular é configurado
617  no torrent, aria2 não usa esta funcionalidade mesmo que ``true`` foi
618  informato.
619  Padrão: ``false``
620
621.. option:: --bt-exclude-tracker=<URI>[,...]
622
623  Lista separada por vírgulas, de trackers de URI BitTorrent que devem ser
624  removidas.  Pode ser usado o valor especial ``*`` para especificar todas
625  URIs; isso irá excluir todas URIs de "announce".  Quando especificar ``*``
626  em uma linha de comando do shell, lembre-se de forçar o escape or delimite
627  com aspas, apóstrofo ou em linux com crase caracter `.
628  Ver também opção :option: `--bt-tracker`.
629
630.. option:: --bt-external-ip=<ENDEREÇO-IP>
631
632  Especificar o IP externo para reportar um track BitTorrent.  Mesmo que esta
633  função tenha o nome ``external``, ela pode aceitar qualquer tipo de endereço
634  IP.  ENDEREÇO-IP deve ser um endereço IP numérico.
635
636.. option:: --bt-hash-check-seed [true|false]
637
638 Se ``true`` é informado, após o check do hash usando a opção :option:
639 `--check-integrity <-V>` e o arquivo esta completo, continue o arquivo seed.
640 Se desejar verificar o arquivo e efetuar o download somente quando ele estiver
641 imcompleto ou danificado, defina esta opção para ``false``.  Esta opção
642 só tem efeito para download de BitTorrent.
643 Padrão: ``true``
644
645.. option:: --bt-lpd-interface=<INTERFACE>
646
647  Use o interface de rede informado para Descobrir o Peer Local. Se esta opção
648  não é especificada, o interface padrão é usado. Pode ser especificado o nome
649  do interface e o endereço IP.
650  Valores possíveis: interface, endereço IP
651
652.. option:: --bt-max-open-files=<NÚMERO>
653
654  Especificar o número máximo de arquivos para abrir para cada download
655  BitTorrent.
656  Padrão: ``100``
657
658.. option:: --bt-max-peers=<NÚMERO>
659
660  Especificar o número máximo de peers para cada torrent.  ``0`` significa
661  ilimitado.  Ver também a opção :option: `--bt-request-peer-speed-limit`.
662  Padrão: ``55``
663
664.. option:: --bt-metadata-only [true|false]
665
666  Download somente os metadados. O(s) arquivo(s) descrito(s) no(s) metadado(s)
667  não será(ão) baixado(s). Esta opção só tem efeito para URI BitTorrent Magnet.
668  Ver também a opção :option: `--bt-save-metadata`.
669  Padrão: ``false``
670
671.. option:: --bt-min-crypto-level=plain|arc4
672
673  Define o nível mínimo do método de critografia.
674  Se existem diversos métodos são fornecidos por um peer, aria2 escolhe o que
675  satisfaz o menor nível especificado.
676  Padrão: ``plain``
677
678.. option:: --bt-prioritize-piece=head[=<TAMANHO>],tail[=<TAMANHO>]
679
680  Tentar primeiramente o download do primeiro e último pedaço de cada arquivo
681  Isto é útil para ver antecipadamente os arquivos. O argumento pode conter
682  duas palavras chave:
683  ``head`` e ``tail``. Para incluir ambos, devem estar separados por vírgula.
684  Estas palavras chave possuem um parâmetro tamanho. Por examplo,
685  se ``head=<TAMANHO>`` é especificado, pedaço no intervalo do número de bytes
686  iniciais de cada arquivo terão prioridade.    ``tail=<TAMANHO>`` significa
687  que o intervalo final no TAMANHO informado de cada arquivo. TAMANHO pode
688  incluir ``K`` ou ``M`` (1K = 1024, 1M = 1024K). Se TAMANHO é omitido,
689  TAMNHA de 1M será usado.
690
691.. option:: --bt-remove-unselected-file [true|false]
692
693   Remove os arquivos não selecionados quando o download do BitTorrent estiver
694   completo. Para selecionar arquivo(s) use a opção :option:`--select-file`.
695   Se não for usada esta opção, é assumido que todos os arquivos serão
696   selecionados. Use esta opção com critério pois ela realmente remove
697   arquivo(s) do seu disco.
698   Padrão: ``false``
699
700.. option:: --bt-require-crypto [true|false]
701
702  Se true é informado, aria2 não aceita nem estabelece conexão com handshake de
703  BitTorrent (protocolo \19BitTorrent). Em vez disso aria2 usa
704  (Obfuscation handshake.
705  Padrão: ``false``
706
707.. option:: --bt-request-peer-speed-limit=<VELOCIDADE>
708
709  Se a velocidade total de download do torrent é menor que a <VELOCIDADE>,
710  aria2 temporariamente incrementa o número de peers para tentar maior
711  velocidade de download.  Configurando esta opção com sua velocidade
712  preferida pode incrementar a velocidade de download em alguns casos. Pode
713  ser anexado ``K`` ou ``M`` (1K = 1024, 1M = 1024K).
714  Padrão: ``50K``
715
716.. option:: --bt-save-metadata [true|false]
717
718  Salvar metadados como arquivo ".torrent" file. Esta opção tem efeito somente
719  se URI usada é de BitTorrent Magnet.  O nome do arquivo é codificado em hash
720  em hexadecimal com sufixo de ".torrent". O diretório onde será salvo o
721  o metadado, é o mesmo onde aponta o download do arquivo. Se o arquivo já
722  existe, o metadado não será salvo. Ver tambémn a opção :option:
723  `--bt-metadata-only`.
724  Padrão: ``false``
725
726.. option:: --bt-seed-unverified [true|false]
727
728  Faz Seed do arquivo previamente baixado sem verificar os hashes dos pedaços.
729  Padrão: ``false``
730
731.. option:: --bt-stop-timeout=<SEGUNDOS>
732
733  Interrompe o download do BitTorrent se a velocidade do for zero por
734  consecutivos SEGUNDOS. Se ``0`` é informado, esta funcionalidade é
735  desabilitada.
736  Padrão: ``0``
737
738.. option:: --bt-tracker=<URI>[,...]
739
740  Lista URI, separada por vírgulas, dos rastreadores BitTorrent. Estas URIs não
741  são afetadas pela opção :option:`--bt-exclude-tracker`, porque elas são
742  adicionadas após as URIs da opção :option:`--bt-exclude-tracker` serem
743  removidas.
744
745.. option:: --bt-tracker-connect-timeout=<SEGUNDOS>
746
747  Define o tempo de conexão em segundos para estabelecera conexão com o tracker.
748  Após a conexão ser estabelecida, esta opção não tem mais efeito e a opção
749  :option:`--bt-tracker-timeout` é usada.
750  Padrão: ``60``
751
752.. option:: --bt-tracker-interval=<SEGUNDOS>
753
754  Define o intervalo em segundos, entre as requisições ao tracker / rastreador.
755  Isso sobrepõe o valor do intervalo e aria2 passa a usá-los e ignorar o
756  valor mínimo de resposta do tracker / rastreador. Se ``0`` é definido, aria2
757  assume que o intervalo será baseado no tracker / rastreador e o download
758  irá prosseguir.
759  Padrão: ``0``
760
761.. option:: --bt-tracker-timeout=<SEGUNDOS>
762
763  Define em segundos o intervalo do timeout.
764  Padrão: ``60``
765
766.. option:: --dht-entry-point=<SERVIDOR>:<PORTA>
767
768  Define servidor e a porta da rede DHT IPv4.
769
770.. option:: --dht-entry-point6=<SERVIDOR>:<PORTA>
771
772  Define servidor e a porta da rede DHT IPv6.
773
774.. option:: --dht-file-path=<CAMINHO>
775
776  Modifica o caminho (CAMINHO) para o arquivo da tabela de roteamento DHT IPv4.
777  Padrão: ``$HOME/.aria2/dht.dat``
778
779.. option:: --dht-file-path6=<PATH>
780
781  Modifica o caminho (CAMINHO) para o arquivo da tabela de roteamento DHT IPv6.
782  Padrão: ``$HOME/.aria2/dht6.dat``
783
784.. option:: --dht-listen-addr6=<ADDR>
785
786  Define o endereço para o bind do socket para DHT IPv6.  Deve ser endereço
787  global IPv6 do servidor.
788
789.. option:: --dht-listen-port=<PORT>...
790
791  Define portas UDP para ouvir para DHT (IPv4 e IPv6) e rastreador UDP.
792  Múltiplas portas podem ser especificadas através do uso de ``,``,
793  por exemplo: ``6881,6885``.  Também pode ser usado ``-`` para especificar
794  intervalo, exemplo: ``6881-6999``.  Ambos ``,`` and ``-`` podem ser
795  usados em conjunto.
796  Padrão: ``6881-6999``
797
798  .. note::
799
800    Cerfifique-se que as portas especificadas estão disponíveis para tráfego UDP
801    de entrada.
802
803.. option:: --dht-message-timeout=<SEGUNDOS>
804
805  Define timeout em segundos.
806  Padrão: ``10``
807
808.. option:: --enable-dht [true|false]
809
810  Habilita funcionalidade DHT IPv4. Tambem habilita suporte a rastreador UDP.
811  Se um identificador particular é usado em um torrente, aria2 não usa DHT
812  para aquele download, mesmo que ``true`` foi informado.
813  Padrão: ``true``
814
815.. option:: --enable-dht6 [true|false]
816
817   Habilita funcionalidade DHT IPv6. Se identificador particular é usado em um
818   torrent, aria2 não usa DHT para aquele download mesmo que ``true`` foi
819   informado. Usar opção :option:`--dht-listen-port` para especificar número(s)
820   de porta(s) para ser(em) ouvida(s). Ver também opção :option:`
821   --dht-listen-addr6`
822   Padrão: ``true``
823
824.. option:: --enable-peer-exchange [true|false]
825
826  Habilita extensão Peer Exchange.  Se um indicador particular é usado nesse
827  torrent, essa funcionalidade será desabilitada para o download, mesmo que
828  ``true`` foi informado.
829  Padrão: ``true``
830
831.. option:: --follow-torrent=true|false|mem
832
833  Se ``true`` ou ``mem`` é especificado, quando um arquivo cujo sufixo é
834  ``.torrent`` ou o tipo de conteúdo é ``application/x-bittorrent`` é baixado,
835  aria2 faz o parse como arquivo torrent e executa o download dos arquivos
836  mencionados nele.
837  Se ``mem`` é especificado, o arquivo torrent não será gravado em disco, apenas
838  será mantido em memória.
839  Se ``false`` é especificado, a ação acima descrita não será executada.
840  Padrão: ``true``
841
842.. option:: -O, --index-out=<INDEX>=<PATH>
843
844  Define o caminho do arquivo com índice=INDEX. O arquivo índice pode ser
845  localizado usando-se a opção :option:`--show-files <-S>`. PATH é o caminho
846  relativo ao caminho especificado na opção :option:`--dir <-d>`.
847  Esta opção pode ser usada múltiplas vezes. Com esta opção pode-se especificar
848  o nome dos arquivos que serão baixados pelo BitTorrent.
849
850.. option:: --listen-port=<PORT>...
851
852  Define o número das portas TCP para download de BitTorrent.
853  Multiplas portas são especificadas usando ``,``,  por exemplo: ``6881,6885``.
854  Também pode usar ``-`` para especificar intervalos: ``6881-6999``.
855  Ambos ``,`` and ``-`` podem ser usados em conjunto: ``6881-6889,6999``.
856  Padrão: ``6881-6999``
857
858  .. note::
859
860    Certifique-se que as portas estejam habilitadas para tráfego TCP de entrada.
861
862.. option:: --max-overall-upload-limit=<VELOCIDADE>
863
864  Define a velocidade máxima geral de upload em bytes/seg.  ``0`` significa
865  irrestrito.  Pode anexar ``K`` ou ``M`` (1K = 1024, 1M = 1024K).  Para
866  limitar a velocidade de upload por torrent, usar opção
867  :option:`--max-upload-limit <-u>`.
868  Padrão: ``0``
869
870.. option:: -u, --max-upload-limit=<VELOCIDADE>
871
872  Define a velocidade máxima para cada torrent em bytes/seg.  ``0`` significa
873  irrestrito.  Pode anexar ``K`` ou ``M`` (1K = 1024, 1M = 1024K).  Para
874  limitar a velocidade global de upload de torrent, usar opção
875  :option:`--max-overall-upload-limit`.
876  Padrão: ``0``
877
878.. option:: --peer-id-prefix=<PEER_ID_PREFIX>
879
880  Especifica o prefixo para ID do peer. O ID do peer em um BitTorrent tem o
881  tamanho de 20 bytes. Se mais de 20 bytes são especificados, somente os 20
882  bytes iniciais serão usados. Se menos de 20 bytes são especificados, dados
883  randomicos serão adicionados para completar o tamanho de 20 bytes.
884  Padrão: ``aria2/$VERSÃO-``, $VERSÃO é a versão do pacote aria2.
885
886.. option:: --seed-ratio=<RATIO>
887
888  Specify share ratio. Seed completed torrents until share ratio reaches
889  RATIO.
890  You are strongly encouraged to specify equals or more than ``1.0`` here.
891  Specify ``0.0`` if you intend to do seeding regardless of share ratio.
892  If :option:`--seed-time` option is specified along with this option,
893  seeding ends when at least one of the conditions is satisfied.
894  Padrão: ``1.0``
895
896.. option:: --seed-time=<MINUTES>
897
898  Especificar o tempo de (seeding) em minutos. Ver também a opção
899  :option:`--seed-ratio`.
900
901  .. note::
902
903    Especificando :option:`--seed-time=0 <--seed-time>` desabilita o (seeding)
904    após o download ter sido completado.
905
906.. option:: -T, --torrent-file=<TORRENT_FILE>
907
908  O caminho para o arquivo ".torrent".  Não é obrigatório usar esta opção pois
909  pode ser especificado arquivo ".torrent" sem a opção
910  :option:`--torrent-file <-T>`.
911
912Opções Específicas de Metalink
913~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
914
915.. option:: --follow-metalink=true|false|mem
916
917  If ``true`` or ``mem`` is specified, when a file whose suffix is ``.meta4``
918  or ``.metalink`` or content type of ``application/metalink4+xml`` or
919  ``application/metalink+xml`` is downloaded, aria2 parses it as a metalink
920  file and downloads files mentioned in it.
921  If ``mem`` is specified, a metalink file is not written to the disk,
922  but is just kept in memory.
923  If ``false`` is specified, the action mentioned above is not taken.
924  Padrão: ``true``
925
926.. option:: --metalink-base-uri=<URI>
927
928  Specify base URI to resolve relative URI in metalink:url and
929  metalink:metaurl element in a metalink file stored in local disk. If
930  URI points to a directory, URI must end with ``/``.
931
932.. option:: -M, --metalink-file=<METALINK_FILE>
933
934  The file path to ".meta4" and ".metalink" file. Reads input from stdin when
935  ``-`` is specified.  You are not required to use this option because you can
936  specify ".metalink" files without :option:`--metalink-file <-M>`.
937
938.. option:: --metalink-language=<LANGUAGE>
939
940  The language of the file to download.
941
942.. option:: --metalink-location=<LOCATION>[,...]
943
944  The location of the preferred server.
945  A comma-delimited list of locations is acceptable, for example, ``jp,us``.
946
947.. option:: --metalink-os=<OS>
948
949  The operating system of the file to download.
950
951.. option:: --metalink-version=<VERSION>
952
953  The version of the file to download.
954
955.. option:: --metalink-preferred-protocol=<PROTO>
956
957  Specify preferred protocol.
958  The possible values are ``http``, ``https``, ``ftp`` and ``none``.
959  Specify ``none`` to disable this feature.
960  Padrão: ``none``
961
962.. option:: --metalink-enable-unique-protocol [true|false]
963
964  If ``true`` is given and several protocols are available for a mirror in a
965  metalink file, aria2 uses one of them.
966  Use :option:`--metalink-preferred-protocol` option to specify
967  the preference of protocol.
968  Padrão: ``true``
969
970Opções específicas de RPC
971~~~~~~~~~~~~~~~~~~~~~~~~~
972
973.. option:: --enable-rpc [true|false]
974
975  Enable JSON-RPC/XML-RPC server.  It is strongly recommended to set username
976  and password using :option:`--rpc-user` and :option:`--rpc-passwd`
977  option. See also :option:`--rpc-listen-port` option.  Padrão: ``false``
978
979.. option:: --pause [true|false]
980
981  Pause o download após adicionado.  Está opção só é efetiva quando
982  a opção :option:`--enable-rpc=true <--enable-rpc>` é informada.
983  Padrão: ``false``
984
985.. option:: --rpc-allow-origin-all [true|false]
986
987  Adiciona o campo de cabeçalho,  ``Access-Control-Allow-Origin``,
988  com o valor ``*`` á resposta RPC.
989  Padrão: ``false``
990
991.. option:: --rpc-certificate=<ARQUIVO>
992
993  Usar o certificado no ARQUIVO para servidor RPC. O certificado
994  deve estar no formato PEM.  Usar opção :option:`--rpc-private-key`
995  para especificar chave particular. Usar a opção
996  :option:`--rpc-secure` para habilitar criptografia.
997  Usuários de *AppleTLS* precisam antes gerar o certificado próprio
998  auto-assinado através do utilitário ``Keychain Access``, por ex:
999  usando o assistente e tomando nota da identificação SHA-1 do
1000  certificado gerado.
1001  Para executar o aria2c com a opção :option:`--rpc-secure` usar
1002  `--rpc-certificate=<SHA-1>` e apenas omitir a opção
1003  :option:`--rpc-private-key`
1004
1005.. option:: --rpc-listen-all [true|false]
1006
1007  Listen incoming JSON-RPC/XML-RPC requests on all network interfaces. If false
1008  is given, listen only on local loopback interface.  Padrão: ``false``
1009
1010.. option:: --rpc-listen-port=<PORT>
1011
1012  Specify a port number for JSON-RPC/XML-RPC server to listen to.  Possible
1013  Values: ``1024`` -``65535`` Padrão: ``6800``
1014
1015.. option:: --rpc-max-request-size=<TAMANHO>
1016
1017  Set max size of JSON-RPC/XML-RPC request. If aria2 detects the request is
1018  more than SIZE bytes, it drops connection. Padrão: ``2M``
1019
1020.. option:: --rpc-passwd=<PASSWD>
1021
1022  Set JSON-RPC/XML-RPC password.
1023
1024.. option:: --rpc-private-key=<FILE>
1025
1026  Use the private key in FILE for RPC server.  The private key must be
1027  decrypted and in PEM format. Use :option:`--rpc-secure` option to
1028  enable encryption. See also :option:`--rpc-certificate` option.
1029
1030.. option:: --rpc-save-upload-metadata [true|false]
1031
1032  Save the uploaded torrent or metalink metadata in the directory
1033  specified by :option:`--dir` option. The filename consists of SHA-1
1034  hash hex string of metadata plus extension. For torrent, the
1035  extension is '.torrent'. For metalink, it is '.meta4'.  If false is
1036  given to this option, the downloads added by
1037  :func:`aria2.addTorrent` or :func:`aria2.addMetalink` will not be
1038  saved by :option:`--save-session` option. Default: ``false``
1039
1040.. option:: --rpc-secure [true|false]
1041
1042  RPC transport will be encrypted by SSL/TLS.  The RPC clients must
1043  use https scheme to access the server. For WebSocket client, use wss
1044  scheme. Use :option:`--rpc-certificate` and
1045  :option:`--rpc-private-key` options to specify the server
1046  certificate and private key.
1047
1048.. option:: --rpc-user=<USUÁRIO>
1049
1050  Set JSON-RPC/XML-RPC user.
1051
1052Opções Avançadas
1053~~~~~~~~~~~~~~~~
1054.. option:: --allow-overwrite [true|false]
1055
1056  Reiniciar o download desde o início se o correspondente arquivo de controle
1057  não existir.  Ver também a opção :option:`--auto-file-renaming`.
1058  Padrão: ``false``
1059
1060.. option:: --allow-piece-length-change [true|false]
1061
1062  Se ``false`` é informado, aria2 interrompe o download quando o tamanho de um
1063  pedaço for diferente do especificado no arquivo controle. Se ``true``
1064  é informado, o download prossegue mas o progresso será perdido.
1065  Padrão: ``false``
1066
1067.. option:: --always-resume [true|false]
1068
1069  Sempre continuar. Se If ``true`` é informado, aria2 sempre tentará
1070  retomar o download do ponto interrompido e se não for possivel o download
1071  será interrompido.  Se ``false`` é informado, quando todas URIs fornecidas
1072  não suportarem a continuidade do download ou aria2 encontrar ``N`` URIs as
1073  quais não suportem retomar o download (``N`` é o valor especificado na
1074  opção :option:`--max-resume-failure-tries`), aria2 irá iniciar o download
1075  do início.  Ver opção :option:`--max-resume-failure-tries`
1076  Padrão: ``true``
1077
1078.. option:: --async-dns [true|false]
1079
1080  Habilita DNS assíncrono.
1081  Padrão: ``true``
1082
1083.. option:: --async-dns-server=<ENDEREÇO-IP>[,...]
1084
1085  Lista separada por vírgulas, dos endereços dos servidores DNS assíncronos
1086  usados pelo resolvedor. Normalmente o resolvedor de DNS assíncronos faz a
1087  leitura dos endereços a partir do arquivo ``/etc/resolv.conf``.
1088  Quando essa opção é usada é feito uso dos servidores DNS especificados na
1089  opção em detrimento do conteúdo do arquivo ``/etc/resolv.conf``.
1090  Podem ser usados ambos endereços IPv4 e IPv6. Essa opção é útil
1091  quando o sistema não possui ``/etc/resolv.conf`` e o usuário não tem
1092  permissão para criá-lo.
1093
1094.. option:: --auto-file-renaming [true|false]
1095
1096  Renomear o arquivo se o mesmo já existir.
1097  Essa opção só funciona em download HTTP, HTTPS e FTP.
1098  O novo nome do arquivo terá um ponto e uma sequência (1..9999) como sufixo.
1099  Padrão: ``true``
1100
1101.. option:: --auto-save-interval=<SEGUNDOS>
1102
1103  Salvar o arquivo de controle (\*.aria2) a cada intervalo de SEGUNDOS.
1104  Se ``0`` é informado, o arquivo de controle não será salvo durante o
1105  download. aria2 salva o arquivo de controle quando parar, independentemente
1106  do valor. As possibilidades vão desde ``0`` até ``600``.
1107  Padrão: ``60``
1108
1109.. option:: --conditional-get [true|false]
1110
1111  Download file only when the local file is older than remote
1112  file. This function only works with HTTP, HTTPS,  downloads only.  It does
1113  not work if file size is specified in Metalink. It also ignores
1114  Content-Disposition header.  If a control file exists, this option
1115  will be ignored.  This function uses If-Modified-Since header to get
1116  only newer file conditionally. When getting modification time of
1117  local file, it uses user supplied filename(see :option:`--out <-o>` option) or
1118  filename part in URI if :option:`--out <-o>` is not specified.
1119  To overwrite existing file, :option:`--allow-overwrite` is required.
1120  Padrão: ``false``
1121
1122.. option:: --conf-path=<PATH>
1123
1124  Change the configuration file path to PATH.
1125  Padrão: ``$HOME/.aria2/aria2.conf``
1126
1127.. option:: --console-log-level=<LEVEL>
1128
1129  Set log level to output to console.  LEVEL is either ``debug``,
1130  ``info``, ``notice``, ``warn`` or ``error``.  Default: ``notice``
1131
1132.. option:: -D, --daemon [true|false]
1133
1134  Run as daemon. The current working directory will be changed to ``/``
1135  and standard input, standard output and standard error will be
1136  redirected to ``/dev/null``. Padrão: ``false``
1137
1138.. option:: --deferred-input [true|false]
1139
1140  If ``true`` is given, aria2 does not read all URIs and options from file
1141  specified by :option:`--input-file <-i>` option at startup,
1142  but it reads one by one when it
1143  needs later. This may reduce memory usage if input file contains a
1144  lot of URIs to download.  If ``false`` is given, aria2 reads all URIs
1145  and options at startup.
1146  Padrão: ``false``
1147
1148.. option:: --disable-ipv6 [true|false]
1149
1150  Disable IPv6. This is useful if you have to use broken DNS and want
1151  to avoid terribly slow AAAA record lookup. Padrão: ``false``
1152
1153.. option:: --disk-cache=<SIZE>
1154
1155  Enable disk cache. If SIZE is ``0``, the disk cache is
1156  disabled. This feature caches the downloaded data in memory, which
1157  grows to at most SIZE bytes. The cache storage is created for aria2
1158  instance and shared by all downloads. The one advantage of the disk
1159  cache is reduce the disk I/O because the data are written in larger
1160  unit and it is reordered by the offset of the file.  If hash
1161  checking is involved and the data are cached in memory, we don't
1162  need to read them from the disk.  SIZE can include ``K`` or ``M``
1163  (1K = 1024, 1M = 1024K). Default: ``16M``
1164
1165.. option:: --download-result=<OPT>
1166
1167  This option changes the way ``Download Results`` is formatted. If OPT
1168  is ``default``, print GID, status, average download speed and
1169  path/URI. If multiple files are involved, path/URI of first
1170  requested file is printed and remaining ones are omitted.  If OPT is
1171  ``full``, print GID, status, average download speed, percentage of
1172  progress and path/URI. The percentage of progress and path/URI are
1173  printed for each requested file in each row.
1174  Padrão: ``default``
1175
1176.. option:: --enable-async-dns6 [true|false]
1177
1178  Enable IPv6 name resolution in asynchronous DNS resolver. This
1179  option will be ignored when :option:`--async-dns=false. <--async-dns>`
1180  Padrão: ``false``
1181
1182.. option:: --enable-mmap [true|false]
1183
1184   Map files into memory. This option may not work if the file space
1185   is not pre-allocated. See :option:`--file-allocation`.
1186
1187   Padrão: ``false``
1188
1189.. option:: --event-poll=<POLL>
1190
1191  Specify the method for polling events.  The possible values are
1192  ``epoll``, ``kqueue``, ``port``, ``poll`` and ``select``.  For each ``epoll``,
1193  ``kqueue``, ``port`` and ``poll``, it is available if system supports it.
1194  ``epoll`` is available on recent Linux. ``kqueue`` is available on
1195  various \*BSD systems including Mac OS X. ``port`` is available on Open
1196  Solaris. The default value may vary depending on the system you use.
1197
1198.. option:: --file-allocation=<METHOD>
1199
1200  Specify file allocation method.
1201  ``none`` doesn't pre-allocate file space. ``prealloc`` pre-allocates file space
1202  before download begins. This may take some time depending on the size of the
1203  file.
1204  If you are using newer file systems such as ext4
1205  (with extents support), btrfs, xfs or NTFS(MinGW build only), ``falloc`` is
1206  your best choice. It allocates large(few GiB)
1207  files almost instantly. Don't use ``falloc`` with
1208  legacy file systems such as ext3 and FAT32 because it takes
1209  almost same time as ``prealloc`` and it blocks aria2
1210  entirely until allocation finishes. ``falloc`` may
1211  not be available if your system doesn't have
1212  :manpage:`posix_fallocate(3)` function.
1213  ``trunc`` uses :manpage:`ftruncate(2)` system call or
1214  platform-specific counterpart to truncate a file to a specified
1215  length.
1216
1217  Possible Values: ``none``, ``prealloc``, ``trunc``, ``falloc``
1218  Padrão: ``prealloc``
1219
1220.. option:: --force-save [true|false]
1221
1222  Save download with :option:`--save-session <--save-session>` option
1223  even if the download is completed or removed. This may be useful to
1224  save BitTorrent seeding which is recognized as completed state.
1225  Default: ``false``
1226
1227.. option:: --gid=<GID>
1228
1229  Set GID manually. aria2 identifies each download by the ID called
1230  GID. The GID must be hex string of 16 characters, thus [0-9a-zA-Z]
1231  are allowed and leading zeros must not be stripped. The GID all 0 is
1232  reserved and must not be used. The GID must be unique, otherwise
1233  error is reported and the download is not added.  This option is
1234  useful when restoring the sessions saved using
1235  :option:`--save-session <--save-session>` option. If this option is
1236  not used, new GID is generated by aria2.
1237
1238.. option:: --hash-check-only [true|false]
1239
1240  If ``true`` is given, after hash check using
1241  :option:`--check-integrity <-V>` option,
1242  abort download whether or not download is complete.
1243  Padrão: ``false``
1244
1245.. option:: --human-readable [true|false]
1246
1247  Print sizes and speed in human readable format (e.g., 1.2Ki, 3.4Mi)
1248  in the console readout. Padrão: ``true``
1249
1250.. option:: --interface=<INTERFACE>
1251
1252  Bind sockets to given interface. You can specify interface name, IP
1253  address and hostname.
1254  Possible Values: interface, IP address, hostname
1255
1256  .. note::
1257
1258    If an interface has multiple addresses, it is highly recommended to
1259    specify IP address explicitly. See also :option:`--disable-ipv6`.  If your
1260    system doesn't have :manpage:`getifaddrs(3)`, this option doesn't accept interface
1261    name.
1262
1263.. option:: --max-download-result=<NÚMERO>
1264
1265  Set maximum number of download result kept in memory. The download
1266  results are completed/error/removed downloads. The download results
1267  are stored in FIFO queue and it can store at most NUM download
1268  results. When queue is full and new download result is created,
1269  oldest download result is removed from the front of the queue and
1270  new one is pushed to the back. Setting big number in this option may
1271  result high memory consumption after thousands of
1272  downloads. Specifying 0 means no download result is kept. Padrão:
1273  ``1000``
1274
1275.. option:: --max-resume-failure-tries=<N>
1276
1277  When used with :option:`--always-resume=false, <--always-resume>` aria2 downloads file from
1278  scratch when aria2 detects N number of URIs that does not support
1279  resume. If N is ``0``, aria2 downloads file from scratch when all
1280  given URIs do not support resume.  See :option:`--always-resume` option.
1281  Padrão: ``0``
1282
1283.. option:: --log-level=<LEVEL>
1284
1285  Set log level to output.
1286  LEVEL is either ``debug``, ``info``, ``notice``, ``warn`` or ``error``.
1287  Padrão: ``debug``
1288
1289.. option:: --on-bt-download-complete=<COMMAND>
1290
1291  For BitTorrent, a command specified in :option:`--on-download-complete` is
1292  called after download completed and seeding is over. On the other
1293  hand, this option set the command to be executed after download
1294  completed but before seeding.
1295  See `Interação com Eventos (Hook)`_ for more details about COMMAND.
1296  Possible Values: ``/path/to/command``
1297
1298.. option:: --on-download-complete=<COMMAND>
1299
1300  Set the command to be executed after download completed.  See
1301  See `Interação com Eventos (Hook)`_ for more details about COMMAND.
1302  See also :option:`--on-download-stop` option.
1303  Possible Values: ``/path/to/command``
1304
1305.. option:: --on-download-error=<COMMAND>
1306
1307  Set the command to be executed after download aborted due to error.
1308  See `Interação com Eventos (Hook)`_ for more details about COMMAND.
1309  See also :option:`--on-download-stop` option.  Possible Values:
1310  ``/path/to/command``
1311
1312.. option:: --on-download-pause=<COMMAND>
1313
1314  Set the command to be executed after download was paused.
1315  See `Interação com Eventos (Hook)`_ for more details about COMMAND.
1316  Possible Values: ``/path/to/command``
1317
1318.. option:: --on-download-start=<COMMAND>
1319
1320  Set the command to be executed after download got started.
1321  See `Interação com Eventos (Hook)`_ for more details about COMMAND.
1322  Possible Values: ``/path/to/command``
1323
1324.. option:: --on-download-stop=<COMMAND>
1325
1326  Set the command to be executed after download stopped. You can override
1327  the command to be executed for particular download result using
1328  :option:`--on-download-complete` and :option:`--on-download-error`. If they are
1329  specified, command specified in this option is not executed.
1330  See `Interação com Eventos (Hook)`_ for more details about COMMAND.
1331  Possible Values: ``/path/to/command``
1332
1333.. option:: --piece-length=<LENGTH>
1334
1335  Set a piece length for HTTP e FTP downloads. This is the boundary when
1336  aria2 splits a file. All splits occur at multiple of this
1337  length. This option will be ignored in BitTorrent downloads.  It
1338  will be also ignored if Metalink file contains piece hashes.
1339  Padrão: ``1M``
1340
1341  .. note::
1342
1343    The possible usecase of :option:`--piece-length`
1344    option is change the request range in one HTTP pipelined request.
1345    To enable HTTP pipelining use
1346    :option:`--enable-http-pipelining`.
1347
1348.. option:: --show-console-readout [true|false]
1349
1350  Show console readout. Padrão: ``true``
1351
1352.. option:: --summary-interval=<SEGUNDOS>
1353
1354  Set interval in seconds to output download progress summary.
1355  Setting ``0`` suppresses the output.
1356  Padrão: ``60``
1357
1358  .. note::
1359
1360    In multi file torrent downloads, the files adjacent forward to the specified files
1361    are also allocated if they share the same piece.
1362
1363.. option:: -Z, --force-sequential [true|false]
1364
1365  Fetch URIs in the command-line sequentially and download each URI in a
1366  separate session, like the usual command-line download utilities.
1367  Padrão: ``false``
1368
1369.. option:: --max-overall-download-limit=<VELOCIDADE>
1370
1371  Set max overall download speed in bytes/sec.  ``0`` means
1372  unrestricted.  You can append ``K`` or ``M`` (1K = 1024, 1M = 1024K).  To
1373  limit the download speed per download, use :option:`--max-download-limit`
1374  option.  Padrão: ``0``
1375
1376.. option:: --max-download-limit=<VELOCIDADE>
1377
1378  Set max download speed per each download in bytes/sec. ``0`` means
1379  unrestricted.  You can append ``K`` or ``M`` (1K = 1024, 1M = 1024K).  To
1380  limit the overall download speed, use :option:`--max-overall-download-limit`
1381  option.  Padrão: ``0``
1382
1383.. option:: --no-conf [true|false]
1384
1385  Disable loading aria2.conf file.
1386
1387.. option:: --no-file-allocation-limit=<TAMANHO>
1388
1389  No file allocation is made for files whose size is smaller than SIZE.
1390  You can append ``K`` or ``M`` (1K = 1024, 1M = 1024K).
1391  Padrão: ``5M``
1392
1393.. option:: -P, --parameterized-uri [true|false]
1394
1395  Enable parameterized URI support.
1396  You can specify set of parts: ``http://{sv1,sv2,sv3}/foo.iso``.
1397  Also you can specify numeric sequences with step counter:
1398  ``http://host/image[000-100:2].img``.
1399  A step counter can be omitted.
1400  If all URIs do not point to the same file, such as the second example above,
1401  -Z option is required.
1402  Padrão: ``false``
1403
1404.. option:: -q, --quiet [true|false]
1405
1406  Make aria2 quiet (no console output).
1407  Padrão: ``false``
1408
1409.. option:: --realtime-chunk-checksum [true|false]
1410
1411   Validate chunk of data by calculating checksum while downloading a file if
1412   chunk checksums are provided.
1413   Padrão: ``true``
1414
1415
1416.. option:: --remove-control-file [true|false]
1417
1418   Remove control file before download. Using with
1419   :option:`--allow-overwrite=true, <--allow-overwrite>` download always starts from
1420   scratch. This will be useful for users behind proxy server which
1421   disables resume.
1422
1423.. option:: --save-session=<ARQUIVO>
1424
1425  Salvar downloads não concluídos ou com erro, para um ARQUIVO quando sair.
1426  Pode ser informado o nome do arquivo para o aria2 com a opção
1427  :option:`--input-file <-i>` no restart.  Note que downloads adicionados
1428  pela função :func:`aria2.addTorrent` e pela função
1429  :func:`aria2.addMetalink` método RPC e seus respectivos metadados não podem
1430  ser salvos. Downloads removidos usando a função :func:`aria2.remove` e
1431  :func:`aria2.forceRemove` não serão salvos.
1432
1433.. option:: --save-session-interval=<SEC>
1434
1435  Save error/unfinished downloads to a file specified by
1436  :option:`--save-session` option every SEC seconds. If ``0`` is
1437  given, file will be saved only when aria2 exits. Default: ``0``
1438
1439.. option:: --stop=<SEGUNDOS>
1440
1441  Finaliza a aplicação após SEGUNDOS se passarem.
1442  Se ``0`` é informado, essa funcionalidade é desabilitada.
1443  Padrão: ``0``
1444
1445.. option:: --stop-with-process=<PID>
1446
1447  Finaliza a aplicação quando o processo de número PID não estiver executando.
1448  Isso é útil se o processo aria2 foi derivado de um processo precursor.
1449  O processo precursor pode ter criado o processo aria2 com seu próprio pid
1450  e quando o processo precursor terminar por alguma razão, aria2 pode
1451  detectar por ele mesmo, essa situação e executar ele mesmo o shutdown.
1452  Este recurso evita que um processo gere subprocessos que ficam no
1453  limbo.
1454
1455.. option:: --truncate-console-readout [true|false]
1456
1457  Truncar a linha da console para ajustar-se a uma linha.
1458  Padrão: ``true``
1459
1460.. option:: -v, --version
1461
1462  Exibe o número da versão, copyright e informação da configuração e sai.
1463
1464Argumento(s) Opcional(is)
1465~~~~~~~~~~~~~~~~~~~~~~~~~
1466As opções que possuem seus argumentos delimitados por colchetes ([]), são
1467opcionais. Normalmente omitindo o argumento, ele será assumido como ``true``
1468(verdadeiro).
1469Se for usada a forma abreviada dessas opções (como em ``-V``) e informado
1470um argumento, estão o nome da opção e seu argumento devem ser concatenados,
1471por exemplo: (``-Vfalse``). Se houver espaços entre a opção e o argumento o
1472argumento será tratado como URI e normalmente não é isto o esperado.
1473
1474Unidades (K and M)
1475^^^^^^^^^^^^^^^^^^
1476
1477Algumas opções usam ``K`` e ``M`` para convenientemente representar
14781.024 e 1.048.576 respectivamente.  aria2 detecta estas caracteres de maneira
1479transparente (maiúsculas e minúsculas), portanto podem ser usados
1480`k`` ou ``K`` e ``m`` ou ``M``.
1481
1482URI, MAGNET, TORRENT_FILE, METALINK_FILE
1483~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1484
1485Podemos especificar múltiplas URIs em uma linha de comando.  A menos que seja
1486especificada a opção :option:`--force-sequential <-Z>`, todas as URIs devem
1487apontar para o mesmo arquivo que será baixado ou o download falhará.
1488
1489Pode-se especificar um número arbitrátio de URIs de BitTorrent Magnet URI.
1490Nove que eles sempre serão tratados como downloads separados.
1491São suportados Hash de Info de 40 characters  e Hast de Info Base32 de 32
1492characters. Múltiplos parâmetros ``tr`` são suportados.  Devido a URI
1493BitTorrent Magnet poder conter o caracter ``&``, é altamente recomendável
1494delimitar a URI com apóstrofo single(``'``) ou aspas double(``"``).
1495É altamente recomendável habilitar DHT especialmente quando ``tr`` o parâmetro
1496estiver ausente.  Ver http://www.bittorrent.org/beps/bep_0009.html
1497para maiores detalhes sobre URI BitTorrent Magnet.
1498
1499Pode-se também especificar um número arbitrário de arquivos torrent e
1500Documentos Metalink armazenados em um dispositivo local. Note que sempre serão
1501tratados como download distintos. Tanto Metalink4 quanto Metalink da versão 3
1502são suportados.
1503
1504Pode-se especificar arquivo torrent usando a opção -T e URI. Fazendo isso
1505o download será baixado do servidor swarm e HTTP, HTTPS e FTP ao mesmo tempo,
1506enquanto os dados do HTTP, HTTPS e FTP serão uploaded para o swarm torrent.
1507Para torrent de um arquivo a URI deve ser completa e apontar inclusive o
1508recurso ou se a URI terminar com / o nome do torrent será adicionado. Para
1509múltiplos torrents, name e caminho serão adicionados para formar a URI, para
1510cada um dos arquivos.
1511
1512.. note::
1513
1514  Certifique-se que a URI seja delimitada por apóstrofo single(``'``) ou
1515  aspas double(``"``) se a URI contiver ``&`` ou qualquer outro caracter que
1516  tenha significado especial para o shell.
1517
1518Continuar Download Interrompido
1519~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1520
1521Normalmente pode-se retomar uma transferência apenas executando-se o comando
1522aria2c URI, caso a transferência anterior estava sendo feita pelo aria2.
1523
1524Caso a transferência anterior estava sendo feita por um navegador ou wget de
1525maneira sequencial, então utilize a opção :option:`--continue <-c>` para
1526retomar do ponto onde foi interrompida a transferência.
1527
1528Interação com Eventos (Hook)
1529~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1530
1531aria2 possui opções para especificar comando arbitrário após um evento
1532específico ocorrer. Atualmente as seguintes opções estão disponíveis:
1533
1534:option:`--on-bt-download-complete`,
1535:option:`--on-download-pause`,
1536:option:`--on-download-complete`.
1537:option:`--on-download-start`,
1538:option:`--on-download-error`,
1539:option:`--on-download-stop`.
1540
1541aria2 passa 3 argumentos para um comando especificado quando este comando for
1542executado. Estes argumentos são: GID, o número de arquivos e o caminho dos
1543arquivos.  Para downloads HTTP, HTTPS e FTP normalmente o número de arquivos é 1.
1544BitTorrent podem conter múltiplos arquivos. Se o número de arquivos é maior
1545que 1, o caminho do arquivo é o primeiro.  Em outras palavras, este é o valor
1546da chave path da primeira estrutura se aquela chave for verdadeira como
1547resposta do método da função :func:`aria2.getFiles` RPC.
1548Se for necessário todos os caminhos dos arquivos, considere usar o método
1549JSON-RPC/XML-RPC.  Lembre-se que o caminho do arquivo pode ser modificado
1550durante o download no HTTP por causa do redirecionamento ou Disposição do
1551Conteúdo do Cabeçalho.
1552
1553Observemos um exemplo de como são passados argumentos para um comando:
1554
1555.. code-block:: console
1556
1557  $ cat hook.sh
1558  #!/bin/sh
1559  echo "chamado com [$1] [$2] [$3]"
1560  $ aria2c --on-download-complete hook.sh http://dobrasil.org/arquivo.iso
1561  chamado com [1] [1] [/caminho/para/arquivo.iso]
1562
1563
1564CÓDIGO DE RETORNO ou SAÍDA
1565--------------------------
1566
1567Como aria2 pode manipular múltiplos downloads concomitantemente, podem ser
1568encontrados vários erros durante uma sessão.  aria2 retorna os códigos de
1569retorno ou saída com base no último erro encontrado.
1570
15710
1572  Se todos os downloads terminam com sucesso.
1573
15741
1575  Erro desconhecido ocorreu.
1576
15772
1578  Tempo transcorrido (time out).
1579
15803
1581  Recurso não encontrado.
1582
15834
1584  Se aria2 tentou um número especificado de vezes e obteve "recurso não encontrado".
1585  Ver opção :option:`--max-file-not-found`.
1586
15875
1588  Se download interrompido porque a velocidade de download é muito baixa.
1589  Ver opção :option:`--lowest-speed-limit`
1590
15916
1592  Erro na rede (network).
1593
15947
1595  Se existem downloads não concluidos.  Esse erro é reportado somente se
1596  todos os downloads foram concluídos com sucesso mas existe uma fila quando
1597  aria2 foi interrompido por quando foi pressionado :kbd:`Ctrl-C` pelo usuário
1598  ou enviado o sinal TERM ou INT.
1599
16008
1601  Se o servidor remoto não suporta retomar um download que deve ser completado.
1602
16039
1604  Não há espaço em disco suficiente para os downloads.
1605
160610
1607  Se o tamanho do pedaço (piece) foi diferente do arquivo de controle .aria2.
1608  Ver opção :option:`--allow-piece-length-change`.
1609
161011
1611  Se aria2 estava fazendo o download do mesmo arquivo no momento.
1612
161312
1614  If aria2 estava fazendo o download do mesmo, hash do torrent, no momento.
1615
161613
1617  Se o arquivo já existe. Ver opção :option:`--allow-overwrite`.
1618
161914
1620  Se renomer o arquivo falhou. Ver opção :option:`--auto-file-renaming`.
1621
162215
1623  Se aria2 não pode abrir o arquivo existente.
1624
162516
1626  Se aria2 não pode criar novo arquivo ou truncar um arquivo já existente.
1627
162817
1629  Se ocorreu erro de I/O no arquivo.
1630
163118
1632  Se aria2 não pode criar diretório.
1633
163419
1635  Se resolução de nomes falhou.
1636
163720
1638  Se aria2 não pode passar documento Metalink.
1639
164021
1641  Se comando FTP falhou.
1642
164322
1644  Se cabeçalho de resposta HTTP está errado ou inesperado.
1645
164623
1647  Se muitos redirecionamentos ocorreram.
1648
164924
1650  Se autorização HTTP falhou.
1651
165225
1653  Se aria2 não pode passar arquivo bencoded file (normalmente arq.  ".torrent").
1654
165526
1656  Se arquivo ".torrent" estava corrompido ou inexistem informações que aria2
1657  necessita.
1658
165927
1660  Se URI Magnet URI está errada.
1661
166228
1663  Se opção está errada ou não é reconhecida ou argumento inválido de uma opção
1664  foi informado.
1665
166629
1667  Se o servidor remoto não pode manusear uma requisição devido a sobrecarga
1668  temporária ou manutenção.
1669
167030
1671  Se aria2 não pode passar uma requisição JSON-RPC.
1672
1673.. note::
1674
1675  Um erro ocorrido em um download completado não será reportado como um
1676  status de saida nem como código de retorno (exit status).
1677
1678.. index:: double: Variáveis; Ambiente
1679
1680VARIÁVEIS DE AMBIENTE
1681---------------------
1682aria2 reconhece as seguintes variáveis de ambiente.
1683
1684``http_proxy [http://][USUÁRIO:SENHA@]SERVIDOR[:PORTA]``
1685  Especifica o servidor para uso do HTTP.
1686  Sobrepõe o valor do http-proxy do arquivo de configuração.
1687  A opção linha de comando :option:`--http-proxy` sobrepõe este valor.
1688
1689``https_proxy [http://][USUÁRIO:SENHA@]SERVIDOR[:PORTA]``
1690  Especifica o servidor proxy para uso do HTTPS.
1691  Sobrepõe o valor do https-proxy do arquivo de configuração.
1692  A opção linha de comando :option:`--https-proxy` sobrepõe este valor.
1693
1694``ftp_proxy [http://][USUÁRIO:SENHA@]SERVIDOR[:PORTA]``
1695  Especifica o servidor proxy para uso do FTP.
1696  Sobrepõe o valor do http-proxy do arquivo de configuração.
1697  A opção linha de comando :option:`--ftp-proxy` sobrepõe este valor.
1698
1699``all_proxy [http://][USUÁRIO:SENHA@]SERVIDOR[:PORTA]``
1700  Especifica o servidor proxy para uso se nenhum protocolo-específico de proxy
1701  é informado.
1702  Sobrepõe o valor all-proxy do arquivo de configuração.
1703  A opção linha de comando :option:`--all-proxy` sobrepõe este valor.
1704
1705.. note::
1706
1707  Apesar de aria2 aceitar os esquemas ``ftp://`` e ``https://`` para proxy de
1708  URI, aria2 assume que ``http://`` é especificado e não troca o comportamento
1709  com base no esquema especificado.
1710
1711``no_proxy [DOMÍNIO,...]``
1712  Especifica nome de servidores, separados por vírgula, domínios e endereços
1713  de rede com ou sem blocos CIDR para os quais não será usado proxy.
1714  Sobrepõe o valor no-proxy do arquivo de configuração.
1715  A opção linha de comando :option:`--no-proxy` sobrepõe este valor.
1716
1717Arquivos de configuração
1718------------------------
1719
1720.. index:: triple:   aria2.conf; arquivo; configuração
1721
1722aria2.conf
1723~~~~~~~~~~
1724
1725Por padrão, aria2 utiliza ``$HOME/.aria2/aria2.conf`` como arquivo de
1726configuração. Pode ser especificado o caminho do arquivo usando-se a opção
1727:option:`--conf-path`.  Se não desejar usar a configuração de arquivo utilize
1728a opção :option:`--no-conf`.
1729
1730O arquivo de configuração é um arquivo texto e possui uma opção por linha.
1731Em cada linha, deve haver um par (nome-valor), no formato:
1732``NOME=VALOR``, onde nome é o nome longo da linha de comando sem o prefixo
1733``--``. Pode ser usada a mesma sintaxe da opção da linha de comando.
1734Linhas que começam com ``#`` são tratados como comentários::
1735
1736  # arquivo de simples configuração para aria2c
1737  listen-port=60000
1738  dht-listen-port=60000
1739  seed-ratio=1.0
1740  max-upload-limit=50K
1741  ftp-pasv=true
1742
1743.. note::
1744
1745  Informações confidenciais como usuário/senha podem ser incluídas no arquivo
1746  de configuração, mas recomenda-se trocar os bits de seu modo de acesso
1747  (por exemplo: ``chmod 600 aria2.conf``), dessa maneira nenhum outro usuário
1748  consegue ver o conteúdo desse arquivo de configuração.
1749
1750.. index:: triple:   dht.dat; arquivo; configuração
1751
1752dht.dat
1753~~~~~~~
1754
1755Por padrão, a tabela de rota do IPv4 DHT está em ``$HOME/.aria2/dht.dat`` e a
1756tabela de rota do IPv6 DHT está em ``$HOME/.aria2/dht6.dat``.
1757
1758.. index:: triple:   netrc; arquivo; configuração
1759
1760Netrc
1761~~~~~
1762
1763Por padrão, o suporte a Netrc está habilitado para HTTP, HTTPS e FTP.  Para
1764desabilitar o suporte a netrc especificar :option:`--no-netrc <-n>`.  Seu
1765arquivo .netrc precisa ter as permissões corretas (600).
1766
1767Se o nome do servidor inicia com ``.``, aria2 executa pesquisa domínio ao
1768invés de pesquisa exata. Isto é uma extensão de aria2. Exemplo de pesquisa
1769de domínio, imagine as seguinte entrada no arquivo .netrc::
1770
1771  machine .dobrasil.org login meuid password minhasenha
1772
1773
1774``aria2.dobrasil.org`` pesquisa domínio ``.dobrasil.org`` e usa ``meuid`` e
1775``minhasenha``.
1776
1777Mais exemplos de pesquisa domínio: ``nobrasil.net`` não executa pesquisa
1778domínio ``.nobrasil.net``. ``dobrasil.org`` não faz pesquisa domínio ``.dobrasil.org``
1779pois tem maior amplitude hierárquica por causa do ponto precedente ``.``.  Se
1780desejar utilizar ``dobrasil.org``, especificar ``dobrasil.org``.
1781
1782.. index:: triple:   aria2; arquivo; controle
1783
1784Arquivo de Controle
1785~~~~~~~~~~~~~~~~~~~
1786
1787aria2 utiliza um arquivo de controle para rastrear o progresso
1788de um download.  Este arquivo é gravado no mesmo diretório do
1789arquivo que está sendo baixado e possui o sufixo ``.aria2``.
1790Por exemplo,se está baixando arquivo.zip, então o arquivo de controle
1791será arquivo.zip.aria2.  (Existe apenas uma exceção para essa convenção
1792que é quando você está baixando um multi torrent, o arquivo de controle
1793estará no "diretório topo" do torrent com o sufixo ``.aria2``.  O nome do
1794"diretório topo" é o valor da chave "name" no diretório "info" do arquivo
1795torrent).
1796
1797Normalmente um arquivo controle é apagado quando o download se completa.  Se
1798aria2 detecta que o download não pode ser retomado (por exemplo, quando faz
1799download de um servidor HTTP que não suporta retomar o processamento de um
1800ponto mas sempre do início), o arquivo de controle não será criado.
1801
1802Se você perder o arquivo de controle, não será possivel retomar o download do
1803ponto onde estava. Mas se há um torrent ou metalink com checksum (verificação) do
1804arquivo, poderá ser retomado do último ponto especificando a opção -V na linha
1805de comando.
1806
1807.. index:: triple:   aria2; arquivo; entrada
1808
1809Arquivo de Entrada
1810~~~~~~~~~~~~~~~~~~
1811
1812O arquivo de entrada pode conter uma lista de URIs para que o aria2 efetua
1813download.  Podem ser especificados múltiplas URIs para cada simples entidade:
1814separar as entidades por um caracter TAB ou espaço.
1815
1816Cada linha é tratada como se fosse especificada através de um argumento da linha
1817de comando. Entretando estas linhas são afetadas pela opção
1818:option:`--force-sequential <-Z>` e pela opção :option:`--parameterized-uri <-P>`
1819
1820Quando as URIs do arquivo de entrada são diretamente lidas pelo aria2, as URIs
1821não precisam necessáriamente estarem delimitadas por apóstrofo (``'``) nem
1822aspas(``"``).
1823
1824Linhas que começam com ``#`` são tratadas como comentário e desprezadas.
1825
1826Adicionalmente, as seguintes opções podem ser especificadas após cada linha de
1827URI. Estas linhas opcionais precisam iniciar com um ou mais espaços.
1828
1829
1830.. hlist::
1831  :columns: 3
1832
1833  * :option:`all-proxy <--all-proxy>`
1834  * :option:`all-proxy-passwd <--all-proxy-passwd>`
1835  * :option:`all-proxy-user <--all-proxy-user>`
1836  * :option:`allow-overwrite <--allow-overwrite>`
1837  * :option:`allow-piece-length-change <--allow-piece-length-change>`
1838  * :option:`always-resume <--always-resume>`
1839  * :option:`async-dns <--async-dns>`
1840  * :option:`auto-file-renaming <--auto-file-renaming>`
1841  * :option:`bt-enable-lpd <--bt-enable-lpd>`
1842  * :option:`bt-exclude-tracker <--bt-exclude-tracker>`
1843  * :option:`bt-external-ip <--bt-external-ip>`
1844  * :option:`bt-hash-check-seed <--bt-hash-check-seed>`
1845  * :option:`bt-max-open-files <--bt-max-open-files>`
1846  * :option:`bt-max-peers <--bt-max-peers>`
1847  * :option:`bt-metadata-only <--bt-metadata-only>`
1848  * :option:`bt-min-crypto-level <--bt-min-crypto-level>`
1849  * :option:`bt-prioritize-piece <--bt-prioritize-piece>`
1850  * :option:`bt-remove-unselected-file <--bt-remove-unselected-file>`
1851  * :option:`bt-request-peer-speed-limit <--bt-request-peer-speed-limit>`
1852  * :option:`bt-require-crypto <--bt-require-crypto>`
1853  * :option:`bt-save-metadata <--bt-save-metadata>`
1854  * :option:`bt-seed-unverified <--bt-seed-unverified>`
1855  * :option:`bt-stop-timeout <--bt-stop-timeout>`
1856  * :option:`bt-tracker <--bt-tracker>`
1857  * :option:`bt-tracker-connect-timeout <--bt-tracker-connect-timeout>`
1858  * :option:`bt-tracker-interval <--bt-tracker-interval>`
1859  * :option:`bt-tracker-timeout <--bt-tracker-timeout>`
1860  * :option:`check-integrity <-V>`
1861  * :option:`checksum <--checksum>`
1862  * :option:`conditional-get <--conditional-get>`
1863  * :option:`connect-timeout <--connect-timeout>`
1864  * :option:`continue <-c>`
1865  * :option:`dir <-d>`
1866  * :option:`dry-run <--dry-run>`
1867  * :option:`enable-async-dns6 <--enable-async-dns6>`
1868  * :option:`enable-http-keep-alive <--enable-http-keep-alive>`
1869  * :option:`enable-http-pipelining <--enable-http-pipelining>`
1870  * :option:`enable-mmap <--enable-mmap>`
1871  * :option:`enable-peer-exchange <--enable-peer-exchange>`
1872  * :option:`file-allocation <--file-allocation>`
1873  * :option:`follow-metalink <--follow-metalink>`
1874  * :option:`follow-torrent <--follow-torrent>`
1875  * :option:`force-save <--force-save>`
1876  * :option:`ftp-passwd <--ftp-passwd>`
1877  * :option:`ftp-pasv <-p>`
1878  * :option:`ftp-proxy <--ftp-proxy>`
1879  * :option:`ftp-proxy-passwd <--ftp-proxy-passwd>`
1880  * :option:`ftp-proxy-user <--ftp-proxy-user>`
1881  * :option:`ftp-reuse-connection <--ftp-reuse-connection>`
1882  * :option:`ftp-type <--ftp-type>`
1883  * :option:`ftp-user <--ftp-user>`
1884  * :option:`hash-check-only <--hash-check-only>`
1885  * :option:`header <--header>`
1886  * :option:`http-accept-gzip <--http-accept-gzip>`
1887  * :option:`http-auth-challenge <--http-auth-challenge>`
1888  * :option:`http-no-cache <--http-no-cache>`
1889  * :option:`http-passwd <--http-passwd>`
1890  * :option:`http-proxy <--http-proxy>`
1891  * :option:`http-proxy-passwd <--http-proxy-passwd>`
1892  * :option:`http-proxy-user <--http-proxy-user>`
1893  * :option:`http-user <--http-user>`
1894  * :option:`https-proxy <--https-proxy>`
1895  * :option:`https-proxy-passwd <--https-proxy-passwd>`
1896  * :option:`https-proxy-user <--https-proxy-user>`
1897  * :option:`index-out <-O>`
1898  * :option:`lowest-speed-limit <--lowest-speed-limit>`
1899  * :option:`max-connection-per-server <-x>`
1900  * :option:`max-download-limit <--max-download-limit>`
1901  * :option:`max-file-not-found <--max-file-not-found>`
1902  * :option:`max-resume-failure-tries <--max-resume-failure-tries>`
1903  * :option:`max-tries <-m>`
1904  * :option:`max-upload-limit <-u>`
1905  * :option:`metalink-base-uri <--metalink-base-uri>`
1906  * :option:`metalink-enable-unique-protocol <--metalink-enable-unique-protocol>`
1907  * :option:`metalink-language <--metalink-language>`
1908  * :option:`metalink-location <--metalink-location>`
1909  * :option:`metalink-os <--metalink-os>`
1910  * :option:`metalink-preferred-protocol <--metalink-preferred-protocol>`
1911  * :option:`metalink-version <--metalink-version>`
1912  * :option:`min-split-size <-k>`
1913  * :option:`no-file-allocation-limit <--no-file-allocation-limit>`
1914  * :option:`no-netrc <-n>`
1915  * :option:`no-proxy <--no-proxy>`
1916  * :option:`out <-o>`
1917  * :option:`parameterized-uri <-P>`
1918  * :option:`pause <--pause>`
1919  * :option:`piece-length <--piece-length>`
1920  * :option:`proxy-method <--proxy-method>`
1921  * :option:`realtime-chunk-checksum <--realtime-chunk-checksum>`
1922  * :option:`referer <--referer>`
1923  * :option:`remote-time <-R>`
1924  * :option:`remove-control-file <--remove-control-file>`
1925  * :option:`retry-wait <--retry-wait>`
1926  * :option:`reuse-uri <--reuse-uri>`
1927  * :option:`rpc-save-upload-metadata <--rpc-save-upload-metadata>`
1928  * :option:`seed-ratio <--seed-ratio>`
1929  * :option:`seed-time <--seed-time>`
1930  * :option:`select-file <--select-file>`
1931  * :option:`split <-s>`
1932  * :option:`stream-piece-selector <--stream-piece-selector>`
1933  * :option:`timeout <-t>`
1934  * :option:`uri-selector <--uri-selector>`
1935  * :option:`use-head <--use-head>`
1936  * :option:`user-agent <-U>`
1937
1938Estas opções possuem exatamente o mesmo significado das opções existentes na
1939linha de comando, mas aplicam-se apenas a URI a que pertencem.
1940Por favor perceba que dentro de um arquivo, elas não terão o prefixo ``--``.
1941
1942Por exemplo, o conteúdo do arquivo de entrada uri.txt é::
1943
1944  http://servidor/arquivo.iso http://espelho/arquivo.iso
1945    dir=/imagens_iso
1946    out=arquivo.img
1947  http://fu/ba
1948
1949
1950Se aria2 é executado com as opções ``-i uri.txt -d /tmp``, então o
1951``arquivo.iso`` será salvo como ``/imagens_iso/arquivo.img`` e será baixado
1952dos servidores ``http://servidor/arquivo.iso`` e
1953``http://espelho/arquivo.iso``.
1954O arquivo ``ba`` e baixado de ``http://fu/ba`` e salvo como ``/tmp/ba``.
1955
1956Em alguns casos, o parâmetro :option:`out <-o>` não tem efeito.
1957Ver nota da opção :option:`--out <-o>` para entender as restrições.
1958
1959.. index:: triple: Servidor; performance; Perfil;
1960
1961Perfil Performance Servidor
1962~~~~~~~~~~~~~~~~~~~~~~~~~~~
1963
1964Esta seção descreve o formato do perfil de performance do servidor, composto
1965por um arquivo de texto plano com cada linha contendo um par ``NOME=VALOR``,
1966delimitados por virgula. Atualmente esta é a lista de nomes reconhecidos:
1967
1968``host``
1969  Nome do servidor. Requerido.
1970
1971``protocol``
1972  Protocolo para este perfil, como ftp, http, https. http é requerido.
1973
1974``dl_speed``
1975  Velocidade média de download observada no download prévio, em bytes por
1976  segundo.  Requerido.
1977
1978``sc_avg_speed``
1979  The average download speed observed in the previous download in
1980  bytes per sec. This value is only updated if the download is done in
1981  single connection environment and only used by
1982  AdaptiveURISelector. Optional.
1983
1984``mc_avg_speed``
1985  The average download speed observed in the previous download in
1986  bytes per sec. This value is only updated if the download is done in
1987  multi connection environment and only used by
1988  AdaptiveURISelector. Optional.
1989
1990``counter``
1991  How many times the server is used. Currently this value is only used
1992  by AdaptiveURISelector.  Optional.
1993
1994``last_updated``
1995  Last contact time in GMT with this server, specified in the seconds
1996  since the Epoch(00:00:00 on January 1, 1970, UTC). Required.
1997
1998``status``
1999  ERROR is set when server cannot be reached or out-of-service or
2000  timeout occurred. Otherwise, OK is set.
2001
2002Estes campos devem existir em uma linha. A ordem dos campos não importa.
2003Podem ser colocados pares; eles serão simplesmente ignorados.
2004
2005Um exemplo abaixo::
2006
2007  host=localhost, protocol=http, dl_speed=32000, last_updated=1222491640,
2008  status=OK
2009  host=localhost, protocol=ftp, dl_speed=0, last_updated=1222491632,
2010  status=ERROR
2011
2012
2013.. index:: double: interface; rpc;
2014
2015INTERFACE RPC
2016-------------
2017
2018aria2 provê o serviço JSON-RPC sobre HTTP e XML-RPC sobre HTTP e eles
2019basicamente possuem a mesma funcionalidade.  aria2 também provê JSON-RPC
2020sobre WebSocket que utiliza o mesmo formato, do método e assinatura e
2021de resposta do formato JSON-RPC sobre HTTP, mas adicionalmente possui
2022notificações iniciadas pelo servidor.
2023Ver detalhes na seção `JSON-RPC sobre WebSocket`_ .
2024
2025O caminho requisitado do interface JSON-RPC (sobre HTTP e sobre
2026WebSocket) é ``/jsonrpc``.  O caminho requisitado do interface  XML-RPC é
2027``/rpc``.
2028
2029A URI WebSocket para JSON-RPC sobre WebSocket é ``ws://HOST:PORT/jsonrpc``.
2030
2031A implementação JSON-RPC é baseada na especificação
2032``JSON-RPC 2.0 <http://jsonrpc.org/specification>`` e suporta
2033HTTP POST e GET (JSONP). Usando WebSocket como transporte, é uma extensão
2034original do aria2.
2035
2036A interface JSON-RPC não suporta notificação em HTTP, mas o servidor RPC irá
2037enviar a notificação no WebSocket. Não é suportado número de ponto flutuante
2038O codificação de página deve ser UTF-8.
2039
2040Quanto a seguinte documentação do JSON-RPC, entenda estrutura JSON como objeto.
2041
2042.. index::   single: terminologia
2043
2044Terminologia
2045~~~~~~~~~~~~
2046
2047GID
2048  GID(or gid) é a chave para gerenciar cada download. Cada download tem um
2049  único GID. Atualmente GID é armazenado em 64 bits como dado binário no
2050  aria2. Para acesso RPG, isso é representado em uma string hexadecimal
2051  de 16 caracteres (exemplo: ``2089b05ecca3d829``). Normalmente, aria2
2052  gera esse GID para cada download, mas o usuário pode especificar
2053  o GID manualmente usando a opção :option:`--gid <--gid>`. Quando
2054  consultando um download por GID, pode ser especificado o prefixo
2055  do GID como um prefixo único e exclusivo entre outros.
2056
2057.. index:: double: exemplos; métodos
2058
2059Métodos
2060~~~~~~~
2061
2062São descritos em torno de 35 exemplos, os quais serão numerados
2063utilizando código fonte com exemplos que usam a linguagem
2064Python versão 2.7.
2065
2066.. index::   triple:     exemplo; json-rpc; xml-rpc;
2067
2068.. function:: aria2.addUri(uris[, options[, position]])
2069
2070  This method adds new HTTP(S)/FTP/BitTorrent Magnet URI.  *uris* is of
2071  type array and its element is URI which is of type string.  For
2072  BitTorrent Magnet URI, *uris* must have only one element and it should
2073  be BitTorrent Magnet URI.  URIs in *uris* must point to the same file.
2074  If you mix other URIs which point to another file, aria2 does not
2075  complain but download may fail.  *options* is of type struct and its
2076  members are a pair of option name and value. See :ref:`rpc_options` below for
2077  more details.  If *position* is given as an integer starting from 0,
2078  the new download is inserted at *position* in the waiting queue. If
2079  *position* is not given or *position* is larger than the size of the
2080  queue, it is appended at the end of the queue.  This method returns
2081  GID of registered download.
2082
2083  **JSON-RPC EXEMPLO M010**
2084
2085  The following example adds ``http://example.org/file``::
2086
2087    >>> import urllib2, json
2088    >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
2089    ...                       'method':'aria2.addUri',
2090    ...                       'params':[['http://example.org/file']]})
2091    >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
2092    >>> c.read()
2093    '{"id":"qwer","jsonrpc":"2.0","result":"2089b05ecca3d829"}'
2094
2095  **XML-RPC EXEMPLO M020**
2096
2097  The following example adds ``http://example.org/file``::
2098
2099    >>> import xmlrpclib
2100    >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
2101    >>> s.aria2.addUri(['http://example.org/file'])
2102    '2089b05ecca3d829'
2103
2104  The following example adds 2 sources and some options::
2105
2106    >>> s.aria2.addUri(['http://example.org/file', 'http://mirror/file'],
2107                        dict(dir="/tmp"))
2108    'd2703803b52216d1'
2109
2110  The following example adds a download and insert it to the front of
2111  waiting downloads::
2112
2113    >>> s.aria2.addUri(['http://example.org/file'], {}, 0)
2114    'ca3d829cee549a4d'
2115
2116.. function:: aria2.addTorrent(torrent[, uris[, options[, position]]])
2117
2118  This method adds BitTorrent download by uploading ".torrent" file.
2119  If you want to add BitTorrent Magnet URI, use :func:`aria2.addUri`
2120  method instead.  *torrent* is of type base64 which contains
2121  Base64-encoded ".torrent" file.  *uris* is of type array and its
2122  element is URI which is of type string. *uris* is used for
2123  Web-seeding.  For single file torrents, URI can be a complete URI
2124  pointing to the resource or if URI ends with /, name in torrent file
2125  is added. For multi-file torrents, name and path in torrent are
2126  added to form a URI for each file.  *options* is of type struct and
2127  its members are a pair of option name and value. See
2128  :ref:`rpc_options` below for more details.  If *position* is given
2129  as an integer starting from 0, the new download is inserted at
2130  *position* in the waiting queue. If *position* is not given or
2131  *position* is larger than the size of the queue, it is appended at
2132  the end of the queue.  This method returns GID of registered
2133  download. If :option:`--rpc-save-upload-metadata` is ``true``, the
2134  uploaded data is saved as a file named hex string of SHA-1 hash of
2135  data plus ".torrent" in the directory specified by :option:`--dir
2136  <-d>` option.  The example of filename is
2137  ``0a3893293e27ac0490424c06de4d09242215f0a6.torrent``.  If same file
2138  already exists, it is overwritten.  If the file cannot be saved
2139  successfully or :option:`--rpc-save-upload-metadata` is ``false``,
2140  the downloads added by this method are not saved by
2141  :option:`--save-session`.
2142
2143  The following examples add local file ``file.torrent``.
2144
2145  **JSON-RPC EXEMPLO M030**
2146
2147  ::
2148
2149    >>> import urllib2, json, base64
2150    >>> torrent = base64.b64encode(open('file.torrent').read())
2151    >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'asdf',
2152    ...                       'method':'aria2.addTorrent', 'params':[torrent]})
2153    >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
2154    >>> c.read()
2155    '{"id":"asdf","jsonrpc":"2.0","result":"2089b05ecca3d829"}'
2156
2157  **XML-RPC EXEMPLO M040**
2158
2159  ::
2160
2161    >>> import xmlrpclib
2162    >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
2163    >>> s.aria2.addTorrent(xmlrpclib.Binary(open('file.torrent').read()))
2164    '2089b05ecca3d829'
2165
2166.. function:: aria2.addMetalink(metalink[, options[, position]])
2167
2168  This method adds Metalink download by uploading ".metalink" file.
2169  *metalink* is of type base64 which contains Base64-encoded
2170  ".metalink" file.  *options* is of type struct and its members are a
2171  pair of option name and value. See :ref:`rpc_options` below for more
2172  details.  If *position* is given as an integer starting from 0, the
2173  new download is inserted at *position* in the waiting queue. If
2174  *position* is not given or *position* is larger than the size of the
2175  queue, it is appended at the end of the queue.  This method returns
2176  array of GID of registered download.  If
2177  :option:`--rpc-save-upload-metadata` is ``true``, the uploaded data
2178  is saved as a file named hex string of SHA-1 hash of data plus
2179  ".metalink" in the directory specified by :option:`--dir <-d>`
2180  option.  The example of filename is
2181  ``0a3893293e27ac0490424c06de4d09242215f0a6.metalink``.  If same file
2182  already exists, it is overwritten.  If the file cannot be saved
2183  successfully or :option:`--rpc-save-upload-metadata` is ``false``,
2184  the downloads added by this method are not saved by
2185  :option:`--save-session`.
2186
2187  The following examples add local file file.meta4.
2188
2189  **JSON-RPC EXEMPLO M050**
2190
2191  ::
2192
2193    >>> import urllib2, json, base64
2194    >>> metalink = base64.b64encode(open('file.meta4').read())
2195    >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
2196    ...                       'method':'aria2.addMetalink',
2197    ...                       'params':[metalink]})
2198    >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
2199    >>> c.read()
2200    '{"id":"qwer","jsonrpc":"2.0","result":["2089b05ecca3d829"]}'
2201
2202  **XML-RPC EXEMPLO M060**
2203
2204  ::
2205
2206    >>> import xmlrpclib
2207    >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
2208    >>> s.aria2.addMetalink(xmlrpclib.Binary(open('file.meta4').read()))
2209    ['2089b05ecca3d829']
2210
2211.. function:: aria2.remove(gid)
2212
2213  This method removes the download denoted by *gid*. *gid* is of type
2214  string. If specified download is in progress, it is stopped at
2215  first. The status of removed download becomes ``removed``.  This method
2216  returns GID of removed download.
2217
2218  The following examples remove download GID#2089b05ecca3d829.
2219
2220  **JSON-RPC EXEMPLO M070**
2221
2222  ::
2223
2224    >>> import urllib2, json
2225    >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
2226    ...                       'method':'aria2.remove',
2227    ...                       'params':['2089b05ecca3d829']})
2228    >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
2229    >>> c.read()
2230    '{"id":"qwer","jsonrpc":"2.0","result":"2089b05ecca3d829"}'
2231
2232  **XML-RPC EXEMPLO M080**
2233
2234  ::
2235
2236    >>> import xmlrpclib
2237    >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
2238    >>> s.aria2.remove('2089b05ecca3d829')
2239    '2089b05ecca3d829'
2240
2241.. function:: aria2.forceRemove(gid)
2242
2243  This method removes the download denoted by *gid*.  This method
2244  behaves just like :func:`aria2.remove` except that this method removes
2245  download without any action which takes time such as contacting
2246  BitTorrent tracker.
2247
2248.. function:: aria2.pause(gid)
2249
2250  This method pauses the download denoted by *gid*. *gid* is of type
2251  string. The status of paused download becomes ``paused``.  If the
2252  download is active, the download is placed on the first position of
2253  waiting queue.  As long as the status is ``paused``, the download is not
2254  started.  To change status to ``waiting``, use :func:`aria2.unpause` method.
2255  This method returns GID of paused download.
2256
2257.. function:: aria2.pauseAll()
2258
2259  This method is equal to calling :func:`aria2.pause` for every active/waiting
2260  download. This methods returns ``OK`` for success.
2261
2262.. function:: aria2.forcePause(pid)
2263
2264  This method pauses the download denoted by *gid*.  This method
2265  behaves just like :func:`aria2.pause` except that this method pauses
2266  download without any action which takes time such as contacting
2267  BitTorrent tracker.
2268
2269.. function:: aria2.forcePauseAll()
2270
2271  This method is equal to calling :func:`aria2.forcePause` for every
2272  active/waiting download. This methods returns ``OK`` for success.
2273
2274.. function:: aria2.unpause(gid)
2275
2276  This method changes the status of the download denoted by *gid* from
2277  ``paused`` to ``waiting``. This makes the download eligible to restart.
2278  *gid* is of type string.  This method returns GID of unpaused
2279  download.
2280
2281.. function:: aria2.unpauseAll()
2282
2283  This method is equal to calling :func:`aria2.unpause` for every active/waiting
2284  download. This methods returns ``OK`` for success.
2285
2286.. function:: aria2.tellStatus(gid[, keys])
2287
2288  This method returns download progress of the download denoted by
2289  *gid*. *gid* is of type string. *keys* is array of string. If it is
2290  specified, the response contains only keys in *keys* array. If *keys*
2291  is empty or not specified, the response contains all keys.  This is
2292  useful when you just want specific keys and avoid unnecessary
2293  transfers. For example, ``aria2.tellStatus("2089b05ecca3d829", ["gid", "status"])``
2294  returns *gid* and 'status' key.  The response is of type struct and it
2295  contains following keys. The value type is string.
2296
2297  ``gid``
2298    GID of this download.
2299
2300  ``status``
2301    ``active`` for currently downloading/seeding entry. ``waiting`` for the
2302    entry in the queue; download is not started.  ``paused`` for the
2303    paused entry.  ``error`` for the stopped download because of
2304    error. ``complete`` for the stopped and completed download. ``removed``
2305    for the download removed by user.
2306
2307  ``totalLength``
2308    Total length of this download in bytes.
2309
2310  ``completedLength``
2311    Completed length of this download in bytes.
2312
2313  ``uploadLength``
2314    Uploaded length of this download in bytes.
2315
2316  ``bitfield``
2317    Hexadecimal representation of the download progress. The highest bit
2318    corresponds to piece index 0. The set bits indicate the piece is
2319    available and unset bits indicate the piece is missing. The spare
2320    bits at the end are set to zero.  When download has not started yet,
2321    this key will not be included in the response.
2322
2323  ``downloadSpeed``
2324    Download speed of this download measured in bytes/sec.
2325
2326  ``uploadSpeed``
2327    Upload speed of this download measured in bytes/sec.
2328
2329  ``infoHash``
2330    InfoHash. BitTorrent only.
2331
2332  ``numSeeders``
2333    The number of seeders the client has connected to. BitTorrent only.
2334
2335  ``pieceLength``
2336    Piece length in bytes.
2337
2338  ``numPieces``
2339    The number of pieces.
2340
2341  ``connections``
2342    The number of peers/servers the client has connected to.
2343
2344  ``errorCode``
2345    The last error code occurred in this download. The value is of type
2346    string. The error codes are defined in `CÓDIGO DE RETORNO ou SAÍDA`_
2347    section. This value is only available for stopped/completed downloads.
2348
2349  ``followedBy``
2350    List of GIDs which are generated by the consequence of this
2351    download. For example, when aria2 downloaded Metalink file, it
2352    generates downloads described in it(see :option:`--follow-metalink`
2353    option). This value is useful to track these auto generated
2354    downloads. If there is no such downloads, this key will not
2355    be included in the response.
2356
2357  ``belongsTo``
2358    GID of a parent download. Some downloads are a part of another
2359    download.  For example, if a file in Metalink has BitTorrent
2360    resource, the download of ".torrent" is a part of that file.  If this
2361    download has no parent, this key will not be included in the
2362    response.
2363
2364  ``dir``
2365    Directory to save files. This key is not available for stopped
2366    downloads.
2367
2368  ``files``
2369    Returns the list of files. The element of list is the same struct
2370    used in :func:`aria2.getFiles` method.
2371
2372  ``bittorrent``
2373    Struct which contains information retrieved from .torrent
2374    file. BitTorrent only. It contains following keys.
2375
2376    ``announceList``
2377      List of lists of announce URI. If ".torrent" file contains announce
2378      and no announce-list, announce is converted to announce-list
2379      format.
2380
2381    ``comment``
2382      The comment for the torrent. ``comment.utf-8`` is used if available.
2383
2384    ``creationDate``
2385      The creation time of the torrent. The value is an integer since
2386      the Epoch, measured in seconds.
2387
2388    ``mode``
2389      File mode of the torrent. The value is either ``single`` or ``multi``.
2390
2391    ``info``
2392      Struct which contains data from Info dictionary. It contains
2393      following keys.
2394
2395      ``name``
2396        name in info dictionary. ``name.utf-8`` is used if available.
2397
2398  **JSON-RPC EXEMPLO M090**
2399
2400  The following example gets information about download GID#2089b05ecca3d829::
2401
2402    >>> import urllib2, json
2403    >>> from pprint import pprint
2404    >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
2405    ...                       'method':'aria2.tellStatus',
2406    ...                       'params':['2089b05ecca3d829']})
2407    >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
2408    >>> pprint(json.loads(c.read()))
2409    {u'id': u'qwer',
2410     u'jsonrpc': u'2.0',
2411     u'result': {u'bitfield': u'0000000000',
2412                 u'completedLength': u'901120',
2413                 u'connections': u'1',
2414                 u'dir': u'/downloads',
2415                 u'downloadSpeed': u'15158',
2416                 u'files': [{u'index': u'1',
2417                             u'length': u'34896138',
2418                             u'completedLength': u'34896138',
2419                             u'path': u'/downloads/file',
2420                             u'selected': u'true',
2421                             u'uris': [{u'status': u'used',
2422                                        u'uri': u'http://example.org/file'}]}],
2423                 u'gid': u'2089b05ecca3d829',
2424                 u'numPieces': u'34',
2425                 u'pieceLength': u'1048576',
2426                 u'status': u'active',
2427                 u'totalLength': u'34896138',
2428                 u'uploadLength': u'0',
2429                 u'uploadSpeed': u'0'}}
2430
2431  The following example gets information specifying keys you are
2432  interested in::
2433
2434    >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
2435    ...                       'method':'aria2.tellStatus',
2436    ...                       'params':['2089b05ecca3d829',
2437    ...                                 ['gid',
2438    ...                                  'totalLength',
2439    ...                                  'completedLength']]})
2440    >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
2441    >>> pprint(json.loads(c.read()))
2442    {u'id': u'qwer',
2443     u'jsonrpc': u'2.0',
2444     u'result': {u'completedLength': u'5701632',
2445                 u'gid': u'2089b05ecca3d829',
2446                 u'totalLength': u'34896138'}}
2447
2448  **XML-RPC EXEMPLO M100**
2449
2450  The following example gets information about download GID#2089b05ecca3d829::
2451
2452    >>> import xmlrpclib
2453    >>> from pprint import pprint
2454    >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
2455    >>> r = s.aria2.tellStatus('2089b05ecca3d829')
2456    >>> pprint(r)
2457    {'bitfield': 'ffff80',
2458     'completedLength': '34896138',
2459     'connections': '0',
2460     'dir': '/downloads',
2461     'downloadSpeed': '0',
2462     'errorCode': '0',
2463     'files': [{'index': '1',
2464                'length': '34896138',
2465                'completedLength': '34896138',
2466                'path': '/downloads/file',
2467                'selected': 'true',
2468                'uris': [{'status': 'used',
2469                          'uri': 'http://example.org/file'}]}],
2470     'gid': '2089b05ecca3d829',
2471     'numPieces': '17',
2472     'pieceLength': '2097152',
2473     'status': 'complete',
2474     'totalLength': '34896138',
2475     'uploadLength': '0',
2476     'uploadSpeed': '0'}
2477
2478  The following example gets information specifying keys you are
2479  interested in::
2480
2481    >>> r = s.aria2.tellStatus('2089b05ecca3d829', ['gid', 'totalLength', 'completedLength'])
2482    >>> pprint(r)
2483    {'completedLength': '34896138', 'gid': '2089b05ecca3d829', 'totalLength': '34896138'}
2484
2485.. function:: aria2.getUris(gid)
2486
2487  This method returns URIs used in the download denoted by *gid*.  *gid*
2488  is of type string. The response is of type array and its element is of
2489  type struct and it contains following keys. The value type is string.
2490
2491  ``uri``
2492    URI
2493
2494  ``status``
2495    'used' if the URI is already used. 'waiting' if the URI is waiting
2496    in the queue.
2497
2498  **JSON-RPC EXEMPLO M110**
2499  ::
2500
2501    >>> import urllib2, json
2502    >>> from pprint import pprint
2503    >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
2504    ...                       'method':'aria2.getUris',
2505    ...                       'params':['2089b05ecca3d829']})
2506    >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
2507    >>> pprint(json.loads(c.read()))
2508    {u'id': u'qwer',
2509     u'jsonrpc': u'2.0',
2510     u'result': [{u'status': u'used',
2511                  u'uri': u'http://example.org/file'}]}
2512
2513  **XML-RPC EXEMPLO M120**
2514  ::
2515
2516    >>> import xmlrpclib
2517    >>> from pprint import pprint
2518    >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
2519    >>> r = s.aria2.getUris('2089b05ecca3d829')
2520    >>> pprint(r)
2521    [{'status': 'used', 'uri': 'http://example.org/file'}]
2522
2523.. function:: aria2.getFiles(gid)
2524
2525  This method returns file list of the download denoted by *gid*. *gid*
2526  is of type string. The response is of type array and its element is of
2527  type struct and it contains following keys. The value type is string.
2528
2529  ``index``
2530    Index of file. Starting with 1. This is the same order with the
2531    files in multi-file torrent.
2532
2533  ``path``
2534    File path.
2535
2536  ``length``
2537    File size in bytes.
2538
2539  ``completedLength``
2540    Completed length of this file in bytes.  Please note that it is
2541    possible that sum of completedLength is less than completedLength in
2542    :func:`aria2.tellStatus` method.
2543    This is because completedLength in
2544    :func:`aria2.getFiles`
2545    only calculates completed pieces. On the other hand, completedLength
2546    in
2547    :func:`aria2.tellStatus` takes into account
2548    of partially completed piece.
2549
2550  ``selected``
2551    ``true`` if this file is selected by :option:`--select-file` option. If
2552    :option:`--select-file` is not specified or this is single torrent or no
2553    torrent download, this value is always ``true``. Otherwise ``false``.
2554
2555  ``uris``
2556    Returns the list of URI for this file. The element of list is the
2557    same struct used in :func:`aria2.getUris` method.
2558
2559  **JSON-RPC EXEMPLO M130**
2560  ::
2561
2562    >>> import urllib2, json
2563    >>> from pprint import pprint
2564    >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
2565    ...                       'method':'aria2.getFiles',
2566    ...                       'params':['2089b05ecca3d829']})
2567    >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
2568    >>> pprint(json.loads(c.read()))
2569    {u'id': u'qwer',
2570     u'jsonrpc': u'2.0',
2571     u'result': [{u'index': u'1',
2572                  u'length': u'34896138',
2573                  u'completedLength': u'34896138',
2574                  u'path': u'/downloads/file',
2575                  u'selected': u'true',
2576                  u'uris': [{u'status': u'used',
2577                             u'uri': u'http://example.org/file'}]}]}
2578
2579  **XML-RPC EXEMPLO M140**
2580  ::
2581
2582    >>> import xmlrpclib
2583    >>> from pprint import pprint
2584    >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
2585    >>> r = s.aria2.getFiles('2089b05ecca3d829')
2586    >>> pprint(r)
2587    [{'index': '1',
2588      'length': '34896138',
2589      'completedLength': '34896138',
2590      'path': '/downloads/file',
2591      'selected': 'true',
2592      'uris': [{'status': 'used',
2593                'uri': 'http://example.org/file'}]}]
2594
2595.. function:: aria2.getPeers(gid)
2596
2597  This method returns peer list of the download denoted by *gid*. *gid*
2598  is of type string. This method is for BitTorrent only.  The response
2599  is of type array and its element is of type struct and it contains
2600  following keys. The value type is string.
2601
2602  ``peerId``
2603    Percent-encoded peer ID.
2604
2605  ``ip``
2606    IP address of the peer.
2607
2608  ``port``
2609    Port number of the peer.
2610
2611  ``bitfield``
2612    Hexadecimal representation of the download progress of the peer. The
2613    highest bit corresponds to piece index 0. The set bits indicate the
2614    piece is available and unset bits indicate the piece is missing. The
2615    spare bits at the end are set to zero.
2616
2617  ``amChoking``
2618    ``true`` if this client is choking the peer. Otherwise ``false``.
2619
2620  ``peerChoking``
2621    ``true`` if the peer is choking this client. Otherwise ``false``.
2622
2623  ``downloadSpeed``
2624    Download speed (byte/sec) that this client obtains from the peer.
2625
2626  ``uploadSpeed``
2627    Upload speed(byte/sec) that this client uploads to the peer.
2628
2629  ``seeder``
2630    ``true`` is this client is a seeder. Otherwise ``false``.
2631
2632  **JSON-RPC EXEMPLO M150**
2633  ::
2634
2635    >>> import urllib2, json
2636    >>> from pprint import pprint
2637    >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
2638    ...                       'method':'aria2.getPeers',
2639    ...                       'params':['2089b05ecca3d829']})
2640    >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
2641    >>> pprint(json.loads(c.read()))
2642    {u'id': u'qwer',
2643     u'jsonrpc': u'2.0',
2644     u'result': [{u'amChoking': u'true',
2645                  u'bitfield': u'ffffffffffffffffffffffffffffffffffffffff',
2646                  u'downloadSpeed': u'10602',
2647                  u'ip': u'10.0.0.9',
2648                  u'peerChoking': u'false',
2649                  u'peerId': u'aria2%2F1%2E10%2E5%2D%87%2A%EDz%2F%F7%E6',
2650                  u'port': u'6881',
2651                  u'seeder': u'true',
2652                  u'uploadSpeed': u'0'},
2653                 {u'amChoking': u'false',
2654                  u'bitfield': u'ffffeff0fffffffbfffffff9fffffcfff7f4ffff',
2655                  u'downloadSpeed': u'8654',
2656                  u'ip': u'10.0.0.30',
2657                  u'peerChoking': u'false',
2658                  u'peerId': u'bittorrent client758',
2659                  u'port': u'37842',
2660                  u'seeder': u'false',
2661                  u'uploadSpeed': u'6890'}]}
2662
2663  **XML-RPC EXEMPLO M160**
2664  ::
2665
2666    >>> import xmlrpclib
2667    >>> from pprint import pprint
2668    >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
2669    >>> r = s.aria2.getPeers('2089b05ecca3d829')
2670    >>> pprint(r)
2671    [{'amChoking': 'true',
2672      'bitfield': 'ffffffffffffffffffffffffffffffffffffffff',
2673      'downloadSpeed': '10602',
2674      'ip': '10.0.0.9',
2675      'peerChoking': 'false',
2676      'peerId': 'aria2%2F1%2E10%2E5%2D%87%2A%EDz%2F%F7%E6',
2677      'port': '6881',
2678      'seeder': 'true',
2679      'uploadSpeed': '0'},
2680     {'amChoking': 'false',
2681      'bitfield': 'ffffeff0fffffffbfffffff9fffffcfff7f4ffff',
2682      'downloadSpeed': '8654',
2683      'ip': '10.0.0.30',
2684      'peerChoking': 'false',
2685      'peerId': 'bittorrent client758',
2686      'port': '37842',
2687      'seeder': 'false,
2688      'uploadSpeed': '6890'}]
2689
2690.. function:: aria2.getServers(gid)
2691
2692  This method returns currently connected HTTP, HTTPS, FTP servers of the
2693  download denoted by *gid*. *gid* is of type string. The response
2694  is of type array and its element is of type struct and it contains
2695  following keys. The value type is string.
2696
2697  ``index``
2698    Index of file. Starting with 1. This is the same order with the
2699    files in multi-file torrent.
2700
2701  ``servers``
2702    The list of struct which contains following keys.
2703
2704    ``uri``
2705      URI originally added.
2706
2707    ``currentUri``
2708      This is the URI currently used for downloading. If redirection is
2709      involved, currentUri and uri may differ.
2710
2711    ``downloadSpeed``
2712      Download speed (byte/sec)
2713
2714  **JSON-RPC EXEMPLO M170**
2715  ::
2716
2717    >>> import urllib2, json
2718    >>> from pprint import pprint
2719    >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
2720    ...                       'method':'aria2.getServers',
2721    ...                       'params':['2089b05ecca3d829']})
2722    >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
2723    >>> pprint(json.loads(c.read()))
2724    {u'id': u'qwer',
2725     u'jsonrpc': u'2.0',
2726     u'result': [{u'index': u'1',
2727                  u'servers': [{u'currentUri': u'http://example.org/file',
2728                                u'downloadSpeed': u'10467',
2729                                u'uri': u'http://example.org/file'}]}]}
2730
2731  **XML-RPC EXEMPLO M180**
2732  ::
2733
2734    >>> import xmlrpclib
2735    >>> from pprint import pprint
2736    >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
2737    >>> r = s.aria2.getServers('2089b05ecca3d829')
2738    >>> pprint(r)
2739    [{'index': '1',
2740      'servers': [{'currentUri': 'http://example.org/dl/file',
2741                   'downloadSpeed': '20285',
2742                   'uri': 'http://example.org/file'}]}]
2743
2744.. function:: aria2.tellActive([keys])
2745
2746  This method returns the list of active downloads.  The response is of
2747  type array and its element is the same struct returned by
2748  :func:`aria2.tellStatus` method. For *keys* parameter, please refer to
2749  :func:`aria2.tellStatus` method.
2750
2751.. function:: aria2.tellWaiting(offset, num, [keys])
2752
2753  This method returns the list of waiting download, including paused
2754  downloads. *offset* is of type integer and specifies the offset from
2755  the download waiting at the front. *num* is of type integer and
2756  specifies the number of downloads to be returned.  For *keys*
2757  parameter, please refer to :func:`aria2.tellStatus` method.
2758
2759  If *offset* is a positive integer, this method returns downloads in the
2760  range of [*offset*, *offset* + *num*).
2761
2762  *offset* can be a negative integer. *offset* == -1 points last
2763  download in the waiting queue and *offset* == -2 points the download
2764  before the last download, and so on. The downloads in the response are
2765  in reversed order.
2766
2767  For example, imagine that three downloads "A","B" and "C" are waiting
2768  in this order. ``aria2.tellWaiting(0, 1)`` returns
2769  ``["A"]``. ``aria2.tellWaiting(1, 2)`` returns ``["B", "C"]``.
2770  ``aria2.tellWaiting(-1, 2)`` returns ``["C", "B"]``.
2771
2772  The response is of type array and its element is the same struct
2773  returned by :func:`aria2.tellStatus` method.
2774
2775.. function:: aria2.tellStopped(offset, num, [keys])
2776
2777  This method returns the list of stopped download.  *offset* is of type
2778  integer and specifies the offset from the oldest download. *num* is of
2779  type integer and specifies the number of downloads to be returned.
2780  For *keys* parameter, please refer to :func:`aria2.tellStatus` method.
2781
2782  *offset* and *num* have the same semantics as :func:`aria2.tellWaiting`
2783  method.
2784
2785  The response is of type array and its element is the same struct
2786  returned by :func:`aria2.tellStatus` method.
2787
2788.. function:: aria2.changePosition(gid, pos, how)
2789
2790  This method changes the position of the download denoted by
2791  *gid*. *pos* is of type integer. *how* is of type string. If *how* is
2792  ``POS_SET``, it moves the download to a position relative to the
2793  beginning of the queue.  If *how* is ``POS_CUR``, it moves the download
2794  to a position relative to the current position. If *how* is ``POS_END``,
2795  it moves the download to a position relative to the end of the
2796  queue. If the destination position is less than 0 or beyond the end of
2797  the queue, it moves the download to the beginning or the end of the
2798  queue respectively. The response is of type integer and it is the
2799  destination position.
2800
2801  For example, if GID#2089b05ecca3d829 is placed in position 3,
2802  ``aria2.changePosition('2089b05ecca3d829', -1, 'POS_CUR')`` will
2803  change its position to 2. Additional
2804  ``aria2.changePosition('2089b05ecca3d829', 0, 'POS_SET')`` will
2805  change its position to 0(the beginning of the queue).
2806
2807  The following examples move the download GID#2089b05ecca3d829 to the
2808  front of the waiting queue.
2809
2810  **JSON-RPC EXEMPLO M190**
2811
2812  ::
2813
2814    >>> import urllib2, json
2815    >>> from pprint import pprint
2816    >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
2817    ...                       'method':'aria2.changePosition',
2818    ...                       'params':['2089b05ecca3d829', 0, 'POS_SET']})
2819    >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
2820    >>> pprint(json.loads(c.read()))
2821    {u'id': u'qwer', u'jsonrpc': u'2.0', u'result': 0}
2822
2823  **XML-RPC EXEMPLO M200**
2824
2825  ::
2826
2827    >>> import xmlrpclib
2828    >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
2829    >>> s.aria2.changePosition('2089b05ecca3d829', 0, 'POS_SET')
2830    0
2831
2832.. index::   triple:     exemplo; json-rpc; xml-rpc;
2833             double:     python;  proxy-server;
2834
2835.. function:: aria2.changeUri(gid, fileIndex, delUris, addUris[, position])
2836
2837  This method removes URIs in *delUris* from and appends URIs in
2838  *addUris* to download denoted by *gid*. *delUris* and *addUris* are
2839  list of string. A download can contain multiple files and URIs are
2840  attached to each file.  *fileIndex* is used to select which file to
2841  remove/attach given URIs. *fileIndex* is 1-based. *position* is used
2842  to specify where URIs are inserted in the existing waiting URI
2843  list. *position* is 0-based. When *position* is omitted, URIs are
2844  appended to the back of the list.  This method first execute removal
2845  and then addition. *position* is the position after URIs are removed,
2846  not the position when this method is called.  When removing URI, if
2847  same URIs exist in download, only one of them is removed for each URI
2848  in *delUris*. In other words, there are three URIs
2849  ``http://example.org/aria2`` and you want remove them all, you have to
2850  specify (at least) 3 ``http://example.org/aria2`` in *delUris*.  This
2851  method returns a list which contains 2 integers. The first integer is
2852  the number of URIs deleted. The second integer is the number of URIs
2853  added.
2854
2855  The following examples add 1 URI ``http://example.org/file`` to the
2856  file whose index is ``1`` and belongs to the download
2857  GID#2089b05ecca3d829.
2858
2859  **JSON-RPC EXEMPLO M210**
2860
2861  ::
2862
2863    >>> import urllib2, json
2864    >>> from pprint import pprint
2865    >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
2866    ...                       'method':'aria2.changeUri',
2867    ...                       'params':['2089b05ecca3d829', 1, [],
2868                                        ['http://example.org/file']]})
2869    >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
2870    >>> pprint(json.loads(c.read()))
2871    {u'id': u'qwer', u'jsonrpc': u'2.0', u'result': [0, 1]}
2872
2873  **XML-RPC EXEMPLO M220**
2874
2875  ::
2876
2877    >>> import xmlrpclib
2878    >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
2879    >>> s.aria2.changeUri('2089b05ecca3d829', 1, [],
2880                          ['http://example.org/file'])
2881    [0, 1]
2882
2883.. function:: aria2.getOption(gid)
2884
2885  This method returns options of the download denoted by *gid*.  The
2886  response is of type struct. Its key is the name of option.  The value
2887  type is string. Note that this method does not return options which
2888  have no default value and have not been set by the command-line
2889  options, configuration files or RPC methods.
2890
2891  The following examples get options of the download
2892  GID#2089b05ecca3d829.
2893
2894  **JSON-RPC EXEMPLO M230**
2895
2896  ::
2897
2898    >>> import urllib2, json
2899    >>> from pprint import pprint
2900    >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
2901    ...                       'method':'aria2.getOption',
2902    ...                       'params':['2089b05ecca3d829']})
2903    >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
2904    >>> pprint(json.loads(c.read()))
2905    {u'id': u'qwer',
2906     u'jsonrpc': u'2.0',
2907     u'result': {u'allow-overwrite': u'false',
2908                 u'allow-piece-length-change': u'false',
2909                 u'always-resume': u'true',
2910                 u'async-dns': u'true',
2911     ...
2912
2913  **XML-RPC EXEMPLO M240**
2914
2915  ::
2916
2917    >>> import xmlrpclib
2918    >>> from pprint import pprint
2919    >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
2920    >>> r = s.aria2.getOption('2089b05ecca3d829')
2921    >>> pprint(r)
2922    {'allow-overwrite': 'false',
2923     'allow-piece-length-change': 'false',
2924     'always-resume': 'true',
2925     'async-dns': 'true',
2926     ....
2927
2928.. function:: aria2.changeOption(gid, options)
2929
2930  This method changes options of the download denoted by *gid*
2931  dynamically.  *gid* is of type string.  *options* is of type struct.
2932  The following options are available for active downloads:
2933
2934  * :option:`bt-max-peers <--bt-max-peers>`
2935  * :option:`bt-request-peer-speed-limit <--bt-request-peer-speed-limit>`
2936  * :option:`bt-remove-unselected-file <--bt-remove-unselected-file>`
2937  * :option:`force-save <--force-save>`
2938  * :option:`max-download-limit <--max-download-limit>`
2939  * :option:`max-upload-limit <-u>`
2940
2941  For waiting or paused downloads, in addition to the above options,
2942  options listed in `Arquivo de Entrada`_ subsection are available,
2943  except for following options:
2944  :option:`dry-run <--dry-run>`,
2945  :option:`metalink-base-uri <--metalink-base-uri>`,
2946  :option:`parameterized-uri <-P>`,
2947  :option:`pause <--pause>`,
2948  :option:`piece-length <--piece-length>` and
2949  :option:`rpc-save-upload-metadata <--rpc-save-upload-metadata>` option.
2950  This method returns ``OK`` for success.
2951
2952  The following examples set :option:`max-download-limit
2953  <--max-download-limit>` option to ``20K`` for the download
2954  GID#2089b05ecca3d829.
2955
2956  **JSON-RPC EXEMPLO M250**
2957
2958  ::
2959
2960    >>> import urllib2, json
2961    >>> from pprint import pprint
2962    >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
2963    ...                       'method':'aria2.changeOption',
2964    ...                       'params':['2089b05ecca3d829',
2965    ...                                 {'max-download-limit':'10K'}]})
2966    >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
2967    >>> pprint(json.loads(c.read()))
2968    {u'id': u'qwer', u'jsonrpc': u'2.0', u'result': u'OK'}
2969
2970  **XML-RPC EXEMPLO M260**
2971
2972  ::
2973
2974    >>> import xmlrpclib
2975    >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
2976    >>> s.aria2.changeOption('2089b05ecca3d829', {'max-download-limit':'20K'})
2977    'OK'
2978
2979.. function:: aria2.getGlobalOption()
2980
2981  This method returns global options.  The response is of type
2982  struct. Its key is the name of option.  The value type is string.
2983  Note that this method does not return options which have no default
2984  value and have not been set by the command-line options, configuration
2985  files or RPC methods. Because global options are used as a template
2986  for the options of newly added download, the response contains keys
2987  returned by :func:`aria2.getOption` method.
2988
2989.. function:: aria2.changeGlobalOption(options)
2990
2991  This method changes global options dynamically.  *options* is of type
2992  struct.
2993  The following options are available:
2994
2995  * :option:`download-result <--download-result>`
2996  * :option:`log <-l>`
2997  * :option:`log-level <--log-level>`
2998  * :option:`max-concurrent-downloads <-j>`
2999  * :option:`max-download-result <--max-download-result>`
3000  * :option:`max-overall-download-limit <--max-overall-download-limit>`
3001  * :option:`max-overall-upload-limit <--max-overall-upload-limit>`
3002  * :option:`save-cookies <--save-cookies>`
3003  * :option:`save-session <--save-session>`
3004  * :option:`server-stat-of <--server-stat-of>`
3005
3006  In addition to them, options listed in `Arquivo de Entrada`_ subsection
3007  are available, except for following options:
3008  :option:`checksum <--checksum>`,
3009  :option:`index-out <-O>`,
3010  :option:`out <-o>`,
3011  :option:`pause <--pause>` and
3012  :option:`select-file <--select-file>`.
3013
3014  Using :option:`log <-l>` option, you can dynamically start logging or
3015  change log file. To stop logging, give empty string("") as a parameter
3016  value. Note that log file is always opened in append mode. This method
3017  returns ``OK`` for success.
3018
3019.. function:: aria2.getGlobalStat()
3020
3021  This method returns global statistics such as overall download and
3022  upload speed. The response is of type struct and contains following
3023  keys. The value type is string.
3024
3025  ``downloadSpeed``
3026    Overall download speed (byte/sec).
3027
3028  ``uploadSpeed``
3029    Overall upload speed(byte/sec).
3030
3031  ``numActive``
3032    The number of active downloads.
3033
3034  ``numWaiting``
3035    The number of waiting downloads.
3036
3037  ``numStopped``
3038    The number of stopped downloads.
3039
3040  **JSON-RPC EXEMPLO M270**
3041  ::
3042
3043    >>> import urllib2, json
3044    >>> from pprint import pprint
3045    >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
3046    ...                       'method':'aria2.getGlobalStat'})
3047    >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
3048    >>> pprint(json.loads(c.read()))
3049    {u'id': u'qwer',
3050     u'jsonrpc': u'2.0',
3051     u'result': {u'downloadSpeed': u'21846',
3052                 u'numActive': u'2',
3053                 u'numStopped': u'0',
3054                 u'numWaiting': u'0',
3055                 u'uploadSpeed': u'0'}}
3056
3057  **XML-RPC EXEMPLO M280**
3058  ::
3059
3060    >>> import xmlrpclib
3061    >>> from pprint import pprint
3062    >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
3063    >>> r = s.aria2.getGlobalStat()
3064    >>> pprint(r)
3065    {'downloadSpeed': '23136',
3066     'numActive': '2',
3067     'numStopped': '0',
3068     'numWaiting': '0',
3069     'uploadSpeed': '0'}
3070
3071.. function:: aria2.purgeDownloadResult()
3072
3073  This method purges completed/error/removed downloads to free memory.
3074  This method returns ``OK``.
3075
3076.. function:: aria2.removeDownloadResult(gid)
3077
3078  This method removes completed/error/removed download denoted by *gid*
3079  from memory. This method returns ``OK`` for success.
3080
3081  The following examples remove the download result of the download
3082  GID#2089b05ecca3d829.
3083
3084  **JSON-RPC EXEMPLO M290**
3085
3086  ::
3087
3088    >>> import urllib2, json
3089    >>> from pprint import pprint
3090    >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
3091    ...                       'method':'aria2.removeDownloadResult',
3092    ...                       'params':['2089b05ecca3d829']})
3093    >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
3094    >>> pprint(json.loads(c.read()))
3095    {u'id': u'qwer', u'jsonrpc': u'2.0', u'result': u'OK'}
3096
3097  **XML-RPC EXEMPLO M300**
3098
3099  ::
3100
3101    >>> import xmlrpclib
3102    >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
3103    >>> s.aria2.removeDownloadResult('2089b05ecca3d829')
3104    'OK'
3105
3106.. function:: aria2.getVersion()
3107
3108  This method returns version of the program and the list of enabled
3109  features. The response is of type struct and contains following keys.
3110
3111  ``version``
3112    Version number of the program in string.
3113
3114  ``enabledFeatures``
3115    List of enabled features. Each feature name is of type string.
3116
3117  **JSON-RPC EXEMPLO M310**
3118  ::
3119
3120    >>> import urllib2, json
3121    >>> from pprint import pprint
3122    >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
3123    ...                       'method':'aria2.getVersion'})
3124    >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
3125    >>> pprint(json.loads(c.read()))
3126    {u'id': u'qwer',
3127     u'jsonrpc': u'2.0',
3128     u'result': {u'enabledFeatures': [u'Async DNS',
3129                                      u'BitTorrent',
3130                                      u'Firefox3 Cookie',
3131                                      u'GZip',
3132                                      u'HTTPS',
3133                                      u'Message Digest',
3134                                      u'Metalink',
3135                                      u'XML-RPC'],
3136                 u'version': u'1.11.0'}}
3137
3138  **XML-RPC EXEMPLO M320**
3139  ::
3140
3141    >>> import xmlrpclib
3142    >>> from pprint import pprint
3143    >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
3144    >>> r = s.aria2.getVersion()
3145    >>> pprint(r)
3146    {'enabledFeatures': ['Async DNS',
3147                         'BitTorrent',
3148                         'Firefox3 Cookie',
3149                         'GZip',
3150                         'HTTPS',
3151                         'Message Digest',
3152                         'Metalink',
3153                         'XML-RPC'],
3154     'version': '1.11.0'}
3155
3156.. function:: aria2.getSessionInfo()
3157
3158  This method returns session information.
3159  The response is of type struct and contains following key.
3160
3161  ``sessionId``
3162    Session ID, which is generated each time when aria2 is invoked.
3163
3164  **JSON-RPC EXEMPLO M330**
3165  ::
3166
3167    >>> import urllib2, json
3168    >>> from pprint import pprint
3169    >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
3170    ...                       'method':'aria2.getSessionInfo'})
3171    >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
3172    >>> pprint(json.loads(c.read()))
3173    {u'id': u'qwer',
3174     u'jsonrpc': u'2.0',
3175     u'result': {u'sessionId': u'cd6a3bc6a1de28eb5bfa181e5f6b916d44af31a9'}}
3176
3177  **XML-RPC EXEMPLO M340**
3178  ::
3179
3180    >>> import xmlrpclib
3181    >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
3182    >>> s.aria2.getSessionInfo()
3183    {'sessionId': 'cd6a3bc6a1de28eb5bfa181e5f6b916d44af31a9'}
3184
3185.. function:: aria2.shutdown()
3186
3187  This method shutdowns aria2.  This method returns ``OK``.
3188
3189.. function:: aria2.forceShutdown()
3190
3191  This method shutdowns :func:`aria2. This method behaves like  aria2.shutdown`
3192  except that any actions which takes time such as contacting BitTorrent
3193  tracker are skipped. This method returns ``OK``.
3194
3195.. function:: system.multicall(methods)
3196
3197  This methods encapsulates multiple method calls in a single request.
3198  *methods* is of type array and its element is struct.  The struct
3199  contains two keys: ``methodName`` and ``params``.  ``methodName`` is the
3200  method name to call and ``params`` is array containing parameters to the
3201  method.  This method returns array of responses.  The element of array
3202  will either be a one-item array containing the return value of each
3203  method call or struct of fault element if an encapsulated method call
3204  fails.
3205
3206  In the following examples, we add 2 downloads. First one is
3207  ``http://example.org/file`` and second one is ``file.torrent``.
3208
3209  **JSON-RPC EXEMPLO M350**
3210  ::
3211
3212    >>> import urllib2, json, base64
3213    >>> from pprint import pprint
3214    >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
3215    ...                       'method':'system.multicall',
3216    ...                       'params':[[{'methodName':'aria2.addUri',
3217    ...                                   'params':[['http://example.org']]},
3218    ...                                  {'methodName':'aria2.addTorrent',
3219    ...                                   'params':[base64.b64encode(open('file.torrent').read())]}]]})
3220    >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
3221    >>> pprint(json.loads(c.read()))
3222    {u'id': u'qwer', u'jsonrpc': u'2.0', u'result': [[u'2089b05ecca3d829'], [u'd2703803b52216d1']]}
3223
3224  JSON-RPC also supports Batch request described in JSON-RPC 2.0 Specification::
3225
3226    >>> jsonreq = json.dumps([{'jsonrpc':'2.0', 'id':'qwer',
3227    ...                        'method':'aria2.addUri',
3228    ...                        'params':[['http://example.org']]},
3229    ...                       {'jsonrpc':'2.0', 'id':'asdf',
3230    ...                        'method':'aria2.addTorrent',
3231    ...                        'params':[base64.b64encode(open('file.torrent').read())]}])
3232    >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
3233    >>> pprint(json.loads(c.read()))
3234    [{u'id': u'qwer', u'jsonrpc': u'2.0', u'result': u'2089b05ecca3d829'},
3235     {u'id': u'asdf', u'jsonrpc': u'2.0', u'result': u'd2703803b52216d1'}]
3236
3237  **XML-RPC EXEMPLO M360**
3238  ::
3239
3240    >>> import xmlrpclib
3241    >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
3242    >>> mc = xmlrpclib.MultiCall(s)
3243    >>> mc.aria2.addUri(['http://example.org/file'])
3244    >>> mc.aria2.addTorrent(xmlrpclib.Binary(open('file.torrent').read()))
3245    >>> r = mc()
3246    >>> tuple(r)
3247    ('2089b05ecca3d829', 'd2703803b52216d1')
3248
3249Tratamento de Erros
3250~~~~~~~~~~~~~~~~~~~
3251
3252Usando JSON-RPC, aria2 retorna objeto JSON que contém código de erro
3253no código e a mensagem de erro na mensagem.
3254
3255Usando XML-RPC, aria2 retorna código de falha (faultCode=1) e a mensagem
3256de erro em (faultString).
3257
3258.. _rpc_options:
3259
3260Opções
3261~~~~~~
3262
3263Same options for :option:`--input-file <-i>` list are available.
3264Ver subseção `Arquivo de Entrada`_ para lista completa de opções.
3265
3266In the option struct, name element is option name(without preceding
3267``--``) and value element is argument as string.
3268
3269EXEMPLO JSON-RPC M370
3270^^^^^^^^^^^^^^^^^^^^^
3271::
3272
3273  {'split':'1', 'http-proxy':'http://proxy/'}
3274
3275
3276EXEMPLO XML-RPC M380
3277^^^^^^^^^^^^^^^^^^^^
3278.. code-block:: xml
3279
3280  <struct>
3281    <member>
3282      <name>split</name>
3283      <value><string>1</string></value>
3284    </member>
3285    <member>
3286      <name>http-proxy</name>
3287      <value><string>http://proxy/</string></value>
3288    </member>
3289  </struct>
3290
3291
3292:option:`header <--header>` and :option:`index-out <-O>`
3293option are allowed multiple times in
3294command-line. Since name should be unique in struct(many XML-RPC
3295library implementation uses hash or dict for struct), single string is
3296not enough. To overcome this situation, they can take array as value
3297as well as string.
3298
3299EXEMPLO JSON-RPC M390
3300^^^^^^^^^^^^^^^^^^^^^
3301::
3302
3303  {'header':['Accept-Language: ja', 'Accept-Charset: utf-8']}
3304
3305
3306EXEMPLO XML-RPC M400
3307^^^^^^^^^^^^^^^^^^^^
3308.. code-block:: xml
3309
3310  <struct>
3311    <member>
3312      <name>header</name>
3313      <value>
3314        <array>
3315          <data>
3316            <value><string>Accept-Language: ja</string></value>
3317            <value><string>Accept-Charset: utf-8</string></value>
3318          </data>
3319        </array>
3320      </value>
3321    </member>
3322  </struct>
3323
3324
3325Following example adds a download with 2 options: dir and header.
3326header option has 2 values, so it uses a list::
3327
3328  >>> import xmlrpclib
3329  >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
3330  >>> opts = dict(dir='/tmp',
3331  ...             header=['Accept-Language: ja',
3332  ...                     'Accept-Charset: utf-8'])
3333  >>> s.aria2.addUri(['http://example.org/file'], opts)
3334  '1'
3335
3336
3337JSON-RPC usando HTTP GET
3338~~~~~~~~~~~~~~~~~~~~~~~~
3339
3340The JSON-RPC interface also supports request via HTTP GET.
3341The encoding scheme in GET parameters is based on JSON-RPC over HTTP
3342Specification [2008-1-15(RC1)]. The encoding of GET parameters are follows::
3343
3344  /jsonrpc?method=METHOD_NAME&id=ID&params=BASE64_ENCODED_PARAMS
3345
3346
3347The ``method`` and ``id`` are always treated as JSON string and their
3348encoding must be UTF-8.
3349
3350For example, The encoded string of
3351``aria2.tellStatus('2089b05ecca3d829')`` with ``id='foo'`` looks like
3352this::
3353
3354  /jsonrpc?method=aria2.tellStatus&id=foo&params=WyIyMDg5YjA1ZWNjYTNkODI5Il0%3D
3355
3356
3357The ``params`` parameter is Base64-encoded JSON array which usually
3358appears in ``params`` attribute in JSON-RPC request object.  In the
3359above example, the params is ``["2089b05ecca3d829"]``, therefore::
3360
3361  ["2089b05ecca3d829"] --(Base64)--> WyIyMDg5YjA1ZWNjYTNkODI5Il0=
3362               --(Percent Encode)--> WyIyMDg5YjA1ZWNjYTNkODI5Il0%3D
3363
3364
3365The JSON-RPC interface supports JSONP. You can specify the callback
3366function in ``jsoncallback`` parameter::
3367
3368  /jsonrpc?method=aria2.tellStatus&id=foo&params=WyIyMDg5YjA1ZWNjYTNkODI5Il0%3D&jsoncallback=cb
3369
3370For Batch request, ``method`` and ``id`` parameter must not be specified.
3371Whole request must be specified in ``params`` parameter. For example,
3372Batch request::
3373
3374  [{'jsonrpc':'2.0', 'id':'qwer', 'method':'aria2.getVersion'},
3375   {'jsonrpc':'2.0', 'id':'asdf', 'method':'aria2.tellActive'}]
3376
3377
3378will be encoded like this::
3379
3380  /jsonrpc?params=W3sianNvbnJwYyI6ICIyLjAiLCAiaWQiOiAicXdlciIsICJtZXRob2QiOiAiYXJpYTIuZ2V0VmVyc2lvbiJ9LCB7Impzb25ycGMiOiAiMi4wIiwgImlkIjogImFzZGYiLCAibWV0aG9kIjogImFyaWEyLnRlbGxBY3RpdmUifV0%3D
3381
3382.. index:: double: json; websocket;
3383
3384JSON-RPC sobre WebSocket
3385~~~~~~~~~~~~~~~~~~~~~~~~
3386
3387JSON-RPC sobre WebSocket utiliza o mesmo método de assinatura e resposta
3388do formato JSON-RPC sobre HTTP. O WebSocket suportado é da versão 13
3389o qual é detalhado na :rfc:`6455`.
3390
3391Para enviar uma requisição RPC para um servidor RPC, enviar strings serializadas
3392JSON num frame Text. A resposta do servidor RPC será entregue também em um frame
3393Text.
3394
3395O servidor RPC ira enviar a notificação ao cliente. A notificação é
3396unidirecional, portanto o cliente que receber a notificação não pode
3397responde-la. Esse método de assinatura de notificação é muito usual mas
3398não provê uma identificação de chave. Os valores associados pelos parâmetros
3399chave são os dados que a notificação porta. O formato desses valores
3400variam dependendo do método de notificação. Os seguintes métodos de notificação
3401são definidos:
3402
3403
3404.. function:: aria2.onDownloadStart(event)
3405
3406
3407  Essa notificação será enviada quando e se o download for iniciado.
3408  *event* é o tipo de estrutura e pode conter as seguintes chaves:
3409  O formato do valor é string.
3410
3411  ``gid``
3412    GID do download.
3413
3414
3415.. function:: aria2.onDownloadPause(event)
3416
3417
3418  Esta notificação será enviada se o download for pausado.  *event*
3419  tem a mesma estrutura do argumento *event* do método da função
3420  :func:`aria2.onDownloadStart`.
3421
3422
3423.. function:: aria2.onDownloadStop(event)
3424
3425
3426  Essa notificação será enviada se o download for interrompido pelo usuário.
3427  *event* tem a mesma estrutura do argumento *event* do método da função
3428  :func:`aria2.onDownloadStart`.
3429
3430
3431.. function:: aria2.onDownloadComplete(event)
3432
3433
3434  Esta notificação será enviada quando o download for completado.  Para
3435  downloads BitTorrent, esta notificação será enviada quando for completado e
3436  o (seed) terminar. O *event* tem a mesma estrutura do *event* do método da
3437  função :func:`aria2.onDownloadStart`.
3438
3439
3440.. function:: aria2.onDownloadError(event)
3441
3442
3443  Esta notificação será enviada se o download for interrompido por causa de
3444  um erro.
3445  O *event* tem a mesma estrutura do *event* do método da função
3446  :func:`aria2.onDownloadStart`.
3447
3448
3449.. function:: aria2.onBtDownloadComplete(event)
3450
3451
3452  Esta notificação será enviada se o download for completado para o
3453  BitTorrent (mas o seeding pode não ter sido concluído).  O *event* tem a
3454  mesma estrutura do *event* do método da função :func:`aria2.onDownloadStart`.
3455
3456Exemplo Cliente XML-RPC Ruby
3457~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3458
3459O seguinte script Ruby script adiciona ``http://localhost/aria2.tar.bz2`` em
3460aria2c no servidor em localhost com a opção :option:`--dir=/downloads <-d>` e
3461imprime a resposta do processamento:
3462
3463.. code-block:: ruby
3464
3465  #!/usr/bin/env ruby
3466
3467  require 'xmlrpc/client'
3468  require 'pp'
3469
3470  client=XMLRPC::Client.new2("http://localhost:6800/rpc")
3471
3472  options={ "dir" => "/downloads" }
3473  result=client.call("aria2.addUri", [ "http://localhost/aria2.tar.bz2" ], options)
3474
3475  pp result
3476
3477
3478Se você usa Python, pode usar xmlrpclib (em Python3.x, use xmlrpc.client) para
3479interagir com aria2::
3480
3481  import xmlrpclib
3482  from pprint import pprint
3483
3484  s = xmlrpclib.ServerProxy("http://localhost:6800/rpc")
3485  r = s.aria2.addUri(["http://localhost/aria2.tar.bz2"], {"dir":"/downloads"})
3486  pprint(r)
3487
3488.. index:: double: mensagens; console;
3489
3490DIVERSOS
3491--------
3492
3493Mensagens na Console
3494~~~~~~~~~~~~~~~~~~~~
3495
3496Enquanto executa o download de arquivos, aria2 imprime mensagens na console
3497para mostrar o progresso dos downloads. Um exemplo abaixo::
3498
3499    [#1 SIZE:400.0KiB/33.2MiB(1%) CN:1 SPD:115.7KiBs ETA:4m51s]
3500
3501Entenda o que estes números e strings significam.
3502
3503``#N``
3504  N significa GID, o qual é um ID único para cada download.
3505
3506``SIZE``
3507  Tamanho Total e Tamanho em bytes. Se a :option:`--select-file` é usada,
3508  será exibida a somatória do tamanho do arquivo.
3509
3510``SEEDING``
3511  Taxa compartilhamento ratio. O cliente está funcionando. Após término do
3512  download do BitTorrent, ``SIZE`` será substituído por ``SEEDING``.
3513
3514``CN``
3515  Número de conexões que o cliente estabeleceu.
3516
3517``SEED``
3518  O número de seeders ao qual o cliente está conectado.
3519
3520``SPD``
3521  Velocidade do download.
3522
3523``UP``
3524  Velocidade e número de bytes transmitidos upload.
3525
3526``ETA``
3527  Tempo previsto para conclusão.
3528
3529``TOTAL SPD``
3530  A soma das velocidades de download para todos downloads paralelos.
3531
3532Quando aria2 está alocando o espaço para arquivo ou validando o checksum,
3533adicionalmente exibirá o progresso:
3534
3535FileAlloc
3536  GID, tamanho alocado e total em bytes.
3537
3538Checksum
3539  GID, tamanho validado e total em bytes.
3540
3541EXEMPLOS DOWNLOAD HTTP / FTP
3542----------------------------
3543
3544Download Segmentado HTTP/FTP
3545~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3546Download de arquivo
3547^^^^^^^^^^^^^^^^^^^
3548.. code-block:: console
3549
3550  $ aria2c "http://servidor/arquivo.zip"
3551
3552
3553.. note::
3554
3555  Para parar o download, pressione :kbd:`Ctrl-C`. Posteriormente pode ser
3556  retomado o mesmo download no mesmo diretório. Podem ser modificadas as URIs
3557  pois elas apontam para o mesmo arquivo.
3558
3559Download de arquivo de 2 servidores HTTP diferentes
3560^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3561.. code-block:: console
3562
3563  $ aria2c "http://servidor/arquivo.zip" "http://espelhobrasil/arquivo.zip"
3564
3565
3566Download de arquivo do mesmo servidor HTTP usando 2 conexões
3567^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3568.. code-block:: console
3569
3570  $ aria2c -x2 -k1M "http://servidorbrasil/arquivo.zip"
3571
3572
3573Download de arquivo de servidor HTTP e FTP
3574^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3575.. code-block:: console
3576
3577  $ aria2c "http://svrbrasil/arquivo.zip" "ftp://servebr/arquivo.zip"
3578
3579
3580Download arquivos especificados num arquivo txt concomitantemente
3581^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3582.. code-block:: console
3583
3584  $ aria2c -i arquivo.txt -j2
3585
3586.. note::
3587
3588  -j especifica número de downloads paralelos.
3589
3590Usando proxy
3591^^^^^^^^^^^^
3592Para HTTP:
3593
3594.. code-block:: console
3595
3596  $ aria2c --http-proxy="http://svrproxy:8080" "http://servidor/arquivo"
3597
3598
3599.. code-block:: console
3600
3601  $ aria2c --http-proxy="http://svrproxy:8080"
3602  --no-proxy="localhost,127.0.0.1,192.168.0.0/16" "http://servidor/arquivo"
3603
3604  a máscara de rede /16 quer dizer que para toda a rede 192.168 também não
3605  será usado o servidor proxy
3606
3607Para FTP:
3608
3609.. code-block:: console
3610
3611  $ aria2c --ftp-proxy="http://svrproxy:8080" "ftp://servidor/arquivo"
3612
3613
3614.. note::
3615
3616  Ver :option:`--http-proxy`, :option:`--https-proxy`, :option:`--ftp-proxy`,
3617  :option:`--all-proxy` e :option:`--no-proxy` para detalhes.  Proxy pode ser
3618  especificado nas variáveis de ambiente. Ver seção `VARIÁVEIS DE AMBIENTE`_ .
3619
3620Proxy com autenticação / autorização
3621^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3622.. code-block:: console
3623
3624  $ aria2c --http-proxy="http://usuário:senha@svrproxy:8080"
3625  "http://servidor/arquivo"
3626
3627
3628.. code-block:: console
3629
3630  $ aria2c --http-proxy="http://svrproxy:8080"
3631  --http-proxy-user="usuário" --http-proxy-passwd="senha"
3632  "http://servidor/arquivo"
3633
3634
3635Download Metalink
3636~~~~~~~~~~~~~~~~~
3637Download arquivos com Metalink remoto
3638^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3639.. code-block:: console
3640
3641  $ aria2c --follow-metalink=mem "http://servidor/arquivo.metalink"
3642
3643
3644Download arquivos com Metalink local
3645^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3646.. code-block:: console
3647
3648  $ aria2c -p --lowest-speed-limit=4000 arquivo.metalink
3649
3650.. note::
3651
3652  Para parar o download, pressione :kbd:`Ctrl-C`.
3653  A transferência pode ser retomada executando aria2c com o mesmo argumento
3654  no mesmo diretório
3655
3656Download diversos arquivos Metalink local
3657^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3658.. code-block:: console
3659
3660  $ aria2c -j2 arquivo1.metalink arquivo2.metalink
3661
3662
3663Download só arquivos selecionados usando index
3664^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3665.. code-block:: console
3666
3667  $ aria2c --select-file=1-4,8 arquivo.metalink
3668
3669.. note::
3670
3671  O index é exibido na console usando opção -S.
3672
3673Download um arquivo usando Metalink local com preferência do usuário
3674^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3675.. code-block:: console
3676
3677  $ aria2c --metalink-location=pt,us --metalink-version=1.1 --metalink-language=pt-BR arquivo.metalink
3678
3679
3680Download BitTorrent
3681~~~~~~~~~~~~~~~~~~~
3682Download arquivos de BitTorrent remotos
3683^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3684.. code-block:: console
3685
3686  $ aria2c --follow-torrent=mem "http://servidortorrent/arquivo.torrent"
3687
3688
3689Download usando arquivo torrent local
3690^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3691.. code-block:: console
3692
3693  $ aria2c --max-upload-limit=40K arquivo.torrent
3694
3695.. note::
3696
3697  --max-upload-limit especifica taxa máxima de transmissão (upload).
3698
3699.. note::
3700
3701  Para parar o download, pressione :kbd:`Ctrl-C`. A transferência pode ser retomada
3702  ao executar aria2c com os mesmos argumentos no mesmo diretório.
3703
3704Download usando URI BitTorrent Magnet
3705^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3706.. code-block:: console
3707
3708  $ aria2c "magnet:?xt=urn:btih:248D0A1CD08284299DE78D5C1ED359BB46717D8C&dn=aria2"
3709
3710
3711.. note::
3712
3713  Lembre-se inserir delimitadores na URI BitTorrent Magnet, pois ela inclui ``&``
3714  que tem significado de parâmetro. Utilizar apóstrofo(``'``) ou aspas(``"``).
3715
3716Download 2 torrents
3717^^^^^^^^^^^^^^^^^^^
3718.. code-block:: console
3719
3720  $ aria2c -j2 arquivo1.torrent arquivo2.torrent
3721
3722
3723Download um arquivo usando torrent e servidor HTTP/FTP
3724^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3725.. code-block:: console
3726
3727  $ aria2c -T arqfile.torrent "http://serv1/arqfile" "ftp://svr2/arqfile"
3728
3729.. note::
3730
3731  Download de arquivos múltiplos torrent com HTTP e FTP não é suportado.
3732
3733Download arquivos selecionados usando index(chamado "download seletivo")
3734^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3735.. code-block:: console
3736
3737  $ aria2c --select-file=1-4,8 arquivo.torrent
3738
3739.. note::
3740
3741  O index é exibido na console usando-se a opção -S.
3742
3743Especificar arquivo saída
3744^^^^^^^^^^^^^^^^^^^^^^^^^
3745
3746Para especificar arquivo de saída em Downloads de BitTorrent, faz-se necessário
3747conhecer o index do arquivo no torrent usando a opção :option:`--show-files <-S>`.
3748Por exemplo, a saída exibirá algo como::
3749
3750  idx|path/length
3751  ===+======================
3752    1|dist/base-2.6.18.iso
3753     |99.9MiB
3754  ---+----------------------
3755    2|dist/driver-2.6.18.iso
3756     |169.0MiB
3757  ---+----------------------
3758
3759
3760Para salvar 'dist/base-2.6.18.iso' em '/tmp/meudir/base.iso' e
3761'dist/driver-2.6.18.iso' em '/tmp/dir/driver.iso', use o seguinte comando:
3762
3763.. code-block:: console
3764
3765  $ aria2c --dir=/tmp --index-out=1=meudir/base.iso --index-out=2=dir/driver.iso arquivo.torrent
3766
3767
3768Modificar porta escuta para peer de entrada
3769^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3770.. code-block:: console
3771
3772  $ aria2c --listen-port=7000-7001,8000 arquivo.torrent
3773
3774.. note::
3775
3776  Já que aria2 não configura o firewall ou porta de roteamento para portas
3777  de encaminhamento, isto deve ser explicitado manualmente por você.
3778
3779Especificar condição para para o programa torrent após término do download
3780^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3781.. code-block:: console
3782
3783  $ aria2c --seed-time=120 --seed-ratio=1.0 arquivo.torrent
3784
3785
3786.. note::
3787
3788  No exemplo acima, o programa termina após transcorrer 120 minutos após
3789  término do download ou taxa chegar a 1.0.
3790
3791Controlar velocidade upload Torrent
3792^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3793.. code-block:: console
3794
3795  $ aria2c --max-upload-limit=100K arquivo.torrent
3796
3797
3798Habilitar IPv4 DHT
3799^^^^^^^^^^^^^^^^^^
3800.. code-block:: console
3801
3802  $ aria2c --enable-dht --dht-listen-port=6881 arquivo.torrent
3803
3804.. note::
3805
3806  DHT utiliza a porta udp, como o aria2 não configura firewall nem porta de roteamento
3807  ou forwarding, por favor executar estas configurações manualmente.
3808
3809Habilitar IPv6 DHT
3810^^^^^^^^^^^^^^^^^^
3811.. code-block:: console
3812
3813  $ aria2c --enable-dht6 --dht-listen-port=6881 --dht-listen-addr6=YOUR_GLOBAL_UNICAST_IPV6_ADDR --enable-async-dns6
3814
3815.. note::
3816
3817  Se aria2c não foi compilado com c-ares, a opção :option:`--enable-async-dns6`
3818  não é necessária. aria2 compartilha a mesma porta ente IPv4 e IPv6 DHT.
3819
3820Adicionar e remover rastreador URI
3821^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3822
3823Remover todos os rastreadores (tracker) das URIs descritas no arquivo.torrent
3824utilize ``http://tracker1/announce`` e ``http://tracker2/announce``
3825
3826.. code-block:: console
3827
3828  $ aria2c --bt-exclude-tracker="*" --bt-tracker="http://tracker1/announce,http://tracker2/announce" file.torrent
3829
3830
3831Funcionalidades avançadas HTTP
3832~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3833Carregar cookies
3834^^^^^^^^^^^^^^^^
3835.. code-block:: console
3836
3837  $ aria2c --load-cookies=cookies.txt "http://servidor/arquivo.zip"
3838
3839.. note::
3840
3841  Podem ser utilizados sem nenhuma modificação coookies dos navegadores:
3842  Firefox / Mozilla / Chromium.
3843
3844Continuar download iniciado por navegadores ou outros programas
3845^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3846  Quando desejar continuar ou retomar um download cujo processamento foi
3847  interrompido, seja em navegador ou qualquer outro programa utilize
3848  o aria2c para retomar este download do ponto onde parou.
3849
3850.. code-block:: console
3851
3852  $ aria2c -c -s2 "http://servidor/arquivodedownloadparcial.zip"
3853
3854
3855Autenticação certificado para Cliente SSL/TLS
3856^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3857.. code-block:: console
3858
3859  $ aria2c --certificate=/path/para/mycert.pem --private-key=/path/para/mykey.pem https://servidor/arquivo
3860
3861.. note::
3862
3863  O arquivo especificado na opção :option:`--private-key` não pode estar
3864  criptografado.  O comportamento do processo fica indefinido quando o
3865  arquivo estiver criptografado.
3866
3867Verificar peer em SSL/TLS usando certificados CA
3868^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3869.. code-block:: console
3870
3871  $ aria2c --ca-certificate=/path/para/ca-certificates.crt
3872  --check-certificate https://servidor/arquivo
3873
3874
3875Funcionalidades avançadas adicionais
3876~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3877
3878Controlar velocidade de download
3879^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3880
3881Quando for necessário o controle da utilização da banda disponível, pode ser
3882utilizado a opção abaixo. Atenção o sufixo K ou M deve ser em letra maiúscula.
3883
3884.. code-block:: console
3885
3886  $ aria2c --max-download-limit=100K arquivo.metalink
3887
3888
3889Reparar um download danificado
3890^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3891.. code-block:: console
3892
3893  $ aria2c -V arquivo.metalink
3894
3895.. note::
3896
3897  Reparar downloads danificados pode ser mais eficiente usando
3898  BitTorrent ou Metalink com a opção verificação (checksums).
3899
3900Desconectar conexão se a velocidade download for menor que um valor
3901^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3902.. code-block:: console
3903
3904  $ aria2c --lowest-speed-limit=10K file.metalink
3905
3906
3907Suporte a URI parametrizada
3908^^^^^^^^^^^^^^^^^^^^^^^^^^^
3909A URI pode ser especificada como partes de um conjunto:
3910
3911.. code-block:: console
3912
3913  $ aria2c -P "http://{svr1,svr2,svr3}/arquivo.iso"
3914
3915
3916Também podem ser especificados sequencias de intervalos:
3917
3918.. code-block:: console
3919
3920  $ aria2c -Z -P "http://servidor/imagem[000-100].png"
3921
3922
3923.. note::
3924
3925  -Z opção requerida para que todas URIs não apontem para o mesmo arquivo,
3926  como declarado no código acima.
3927
3928Especificar incrementos para contador:
3929
3930.. code-block:: console
3931
3932  $ aria2c -Z -P "http://servidor/imagem[A-Z:2].png"
3933
3934
3935Verificar validação checksum
3936^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3937.. code-block:: console
3938
3939  $ aria2c --checksum=sha-1=0192ba11326fe2298c8cb4de616f4d4140213837
3940  http://dobrasil.org/arquivo
3941
3942
3943Download Paralelo de uma quantidade arbitrária de URI, Metalink ou Torrent
3944^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3945.. code-block:: console
3946
3947  $ aria2c -j3 -Z "http://servidor/arquivo1" arquivo2.torrent arq3.metalink
3948
3949
3950BitTorrent Criptografado
3951^^^^^^^^^^^^^^^^^^^^^^^^
3952Criptografar todo conjunto usando ARC4:
3953
3954.. code-block:: console
3955
3956  $ aria2c --bt-min-crypto-level=arc4 --bt-require-crypto=true arquivo.torrent
3957
3958
3959Ver Também
3960----------
3961
3962Site do Projeto aria2: https://aria2.github.io/
3963
3964Site do Projeto Metalink: http://www.metalinker.org/
3965
3966Descrição do Formato Download Metalink: :rfc:`5854`
3967
3968COPYRIGHT
3969---------
3970
3971Copyright (C) 2006, 2014 Tatsuhiro Tsujikawa
3972Tradução para Português do Brasil 2013, Gilberto dos Santos Alves
3973utilizando editor kate e gedit no Debian squeeze 6.0.6 novembro de 2012
3974revisado em março de 2013 usando editor kate e gedit no ubuntu 12.04 LTS
3975
3976Esse programa é software livre; pode ser redistribuido e/ou modificado
3977sob os termos da Licença GNU General Public License como publicada por
3978Free Software Foundation www.fsf.org; versão 2 da Licença, ou qualquer
3979versão mais recente, qualquer que seja sua escolha.
3980
3981Este programa é distribuído na intenção de ser útil, mas SEM NENHUMA GARANTIA;
3982sem qualquer garantia implícita de ser COMERCIALIZÁVEL ou para PROPÓSITO
3983ESPECÍFICO. Consulte a Linceça GNU Genérica para mais detalhes.
3984
3985Você precisa receber uma cópia da Licença Pública GNU Genérica junto com
3986este programa; caso não tenha, escrevá para Free Software Foundation, Inc.,
398751 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
3988
3989Adicionalmente, como uma exceção especial, os detentores do direito autoral
3990autorizam a permissão para compilar programas que possuem ligação com
3991parte do código com a biblioteca OpenSSL sob certas condições como descritas
3992em cada arquivo fonte e autorizam a distribuição das das combinações das
3993ligações incluindo ambas.
3994Devem ser obedecidos todos os detalhes da Licença Pública GNU Genérica
3995em relação a OpenSSL.  Caso haja modificação nos arquivos com esta exceção
3996deverá ser extendida esta exceção para as versões modificadas dos arquivos, mas
3997isto não é obrigatório.  Se não houver esta intenção exclua esta declaração
3998de exceção da sua versão.  Caso sejam excluídas as declarações de todos
3999os arquivos fontes, exclua também esta declaração daqui.
4000
4001Anotação sobre divergência entre Manual e o aria2:
4002
4003Esta página de manual pode não necessariamente conter a última informação.
4004Caso haja discrepância entre alguma informação do manual e o aria2, por
4005favor refira-se a versão em inglês resultante do comando man aria2c
4006