aria2c.rst 134 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020
  1. aria2c(1)
  2. =========
  3. Linha de COMANDO
  4. ----------------
  5. **aria2c** [<OPÇÕES>] [<URI>|<MAGNET>|<ARQUIVO_TORRENT>|<ARQUIVO_METALINK>] ...
  6. DESCRIÇÃO
  7. ---------
  8. Observação: Para executar o aria2 em um terminal ou prompt do dos utilize
  9. o comando aria2c
  10. aria2 é um utilitário para download de arquivos. Os protocolos suportados são
  11. HTTP, HTTPS, FTP, BitTorrent e Metalink. aria2 pode efetuar download de arquivos
  12. a partir de múltiplas fontes e protocolos e tenta utilizar a máxima capacidade
  13. de banda. Há suporte para download de arquivos que tem origem em HTTP, HTTPS,
  14. FTP, BitTorrent e Metalink enquanto que os dados baixados podem ser
  15. compartilhados pelo BitTorrent. Usando conferência / aferição (checksum) nos
  16. Metalinks aria2 automaticamente valida o conteúdo dos dados enquanto faz
  17. o download do arquivo como BitTorrent.
  18. OPÇÕES para Uso no aria2
  19. ------------------------
  20. Básicas
  21. ~~~~~~~
  22. .. option:: -d, --dir=<DIR>
  23. O diretório onde será armazenado o arquivo baixado.
  24. .. option:: -i, --input-file=<ARQUIVO>
  25. Executa download da(s) URI encontradas no ARQUIVO. Podem ser especificados
  26. múltiplos URI para uma simples entidade: separe URI na mesma linha com
  27. um caracter TAB (tabulação).
  28. Quando desejar ler a entrada padrão (stdin) especificar ``-`` (hífen).
  29. Adicionalmente, diversas opções podem ser especificadas após cada linha de URI.
  30. Esta(s) linha(s) opcional(s) deve(m) começar(em) com um ou mais espaços em
  31. branco e possuir(em) apenas uma opção em cada linha.
  32. Ver subseção `Arquivo de Entrada`_ para mais detalhes.
  33. Ver também opção :option:`--deferred-input`.
  34. .. option:: -l, --log=<LOG>
  35. O nome do arquivo de log. Se ``-`` for especificado (entrada padrão), log é
  36. gravado em stdout (saída padrão). Se uma string vazia("") é especificada, log
  37. não será gravado em arquivo.
  38. .. option:: -j, --max-concurrent-downloads=<N>
  39. Configura o número máximo de downloads paralelos para cada URI (HTTP,
  40. HTTPS, FTP), Torrent e Metalink. Ver também opção :option:`--split <-s>`.
  41. Padrão: ``5``
  42. .. option:: -V, --check-integrity[=true|false]
  43. Verifica a integridade do arquivo validando pedaços hashes ou um hash do
  44. arquivo inteiro. Essa opção tem efeito só em downloads BitTorrent, Metalink
  45. com checksums ou HTTP, HTTPS e FTP com a opção :option:`--checksum`. Se pedaços
  46. de hashes são providos, essa opção pode detectar porções danificadas de um
  47. arquivo e efetuar novamente o download desses pedaços. Se especificar hash
  48. do arquivo inteiro, a verificação do hash ocorrerá só ao final do download,
  49. validação que leva em conta o tamanho do arquivo, e o download reinicirá a
  50. partir do início. Se houver especificação de ambos métodos de hash será
  51. utilizado o hash de pedações.
  52. Padrão:
  53. ``false``
  54. .. option:: -c, --continue[=true|false]
  55. Continua o download a partir de um download parcial, anteriormente
  56. interrompido. Use esta opção para retormar um download iniciado a partir
  57. de um browser (navegador) ou outro programa que faz baixa de arquivos
  58. sequencialmente desde o início.
  59. Atualmente esta opção só é aplicavel a download de HTTP, HTTPS e FTP.
  60. .. option:: -h, --help[=<TÓPICO>|<PALAVRA-CHAVE>]
  61. As mensagens de Ajuda são classificadas em tópicos. Um tópico inicia com
  62. ``#``. Por exemplo, digitar ``--help=#http`` para obter o uso das opções
  63. do tópico ``#http``. Se digitar um termo que não é tópico, haverá exibição
  64. das opções que incluem o termo informado.
  65. Valores disponíveis para tópicos podem ser: ``#basic``, ``#advanced``,
  66. ``#http``, ``#https``, ``#ftp``,
  67. ``#metalink``, ``#bittorrent``, ``#cookie``, ``#hook``, ``#file``, ``#rpc``,
  68. ``#checksum``, ``#experimental``, ``#deprecated``, ``#help``, ``#all``
  69. Padrão: ``#basic``
  70. HTTP/FTP
  71. ~~~~~~~~
  72. .. option:: --all-proxy=<PROXY>
  73. Usar este servidor proxy para todos protocolos. Para limpar proxy
  74. previamente definido, use "". Esta configuração pode ser sobreposta através
  75. da especificação de um servidor proxy para um determinado protocolo usando
  76. opções :option:`--http-proxy`, :option:`--https-proxy` e :option:`--ftp-proxy`.
  77. Isto afeta todas as URIs.
  78. O formato da opção PROXY é ``[http://][USUÁRIO:SENHA@]SERVIDOR[:PORTA]``.
  79. Ver também seção `VARIÁVEIS DE AMBIENTE`_ section.
  80. .. note::
  81. Se usuário e senha são embutidos na URI do proxy eles também podem ser
  82. especificados através das opções
  83. *--{http,https,ftp,all}-proxy-{usuário,senha}*,
  84. aqueles que aparecerem por último assumem a precedência. Por exemplo,
  85. quando temos ``http-proxy-user=meunome``, ``http-proxy-passwd=minhasenha``
  86. em aria2.conf e especificamos ``--http-proxy="http://svrproxy"`` na
  87. linha de comando, então obtemos como proxy HTTP ``http://svrproxy``
  88. com o usuário ``meunome`` e senha ``minhasenha``.
  89. Outro exemplo: quando especificamos na linha de comando
  90. ``--http-proxy="http://usuário:senha@svrproxy" --http-proxy-user="meunome"
  91. --http-proxy-passwd="minhasenha"``, então obtemos proxy HTTP
  92. ``http://svrproxy`` com usuário ``meunome`` e senha ``minhasenha``.
  93. Mais um exemplo: se especificamos na linha de comando
  94. ``--http-proxy-user="meunome" --http-proxy-passwd="minhasenha"
  95. --http-proxy="http://utilizador:acesso@svrproxy"``, então obtemos o proxy HTTP
  96. ``http://svrproxy`` com o usuário ``utilizador`` e a senha ``acesso``.
  97. .. option:: --all-proxy-passwd=<SENHA>
  98. Define senha para a opção :option:`--all-proxy`.
  99. .. option:: --all-proxy-user=<USUÁRIO>
  100. Define usuário para opção :option:`--all-proxy`.
  101. .. option:: --checksum=<TIPO>=<ALGORITMO>
  102. Define verificação (checksum). TIPO é o tipo de algoritmo(hash). Os tipos de
  103. algoritmos estão listados em ``Algoritmos de Hash`` e podem ser obtidos
  104. através do do comando ``aria2c -v``. DIGEST é o código hexadecimal. Por
  105. examplo, definindo sha-1 o resultado parece com:
  106. ``sha-1=0192ba11326fe2298c8cb4de616f4d4140213838`` Essa opção aplica-se
  107. apenas para downloads HTTP, HTTPS e FTP.
  108. .. option:: --connect-timeout=<SEGUNDOS>
  109. Define o tempo de espera em segundos para estabelecer a conexão com o servidor
  110. proxy. Após o estabelecimento da conexão, esta opção não tem mais efeito, mas
  111. a opção :option:`--timeout <-t>` será utilizada.
  112. Padrão: ``60``
  113. .. option:: --dry-run[=true|false]
  114. Se ``true`` é informado, aria2 apenas verifica se o arquivo remoto está
  115. disponível para download dos dados. Esta opção tem efeito em downloads de
  116. servidores HTTP, HTTPS e FTP. Downloads BitTorrent serão cancelados se for
  117. especificado ``true``.
  118. Padrão: ``false``
  119. .. option:: --lowest-speed-limit=<VELOCIDADE>
  120. Fecha a conexão se a velocidade de download é menor ou igual ao valor
  121. especificado, bytes por segundo.
  122. ``0`` significa que aria2 não levará em conta limite de velocidade mínima.
  123. Pode ser anexado ``K`` ou ``M`` (1K = 1024, 1M = 1024K).
  124. Esta opção não abrange downloads do tipo BitTorrent.
  125. Padrão: ``0``
  126. .. option:: -x, --max-connection-per-server=<NÚMERO>
  127. O número máximo de conexões para um servidor em cada download.
  128. Padrão: ``1``
  129. .. option:: --max-file-not-found=<NÚMERO>
  130. Se aria2 recebe çódigo de retorno "arquivo não encontrado" de um servidor
  131. remoto de HTTP / FTP um NÚMERO de vezes sem obter nenhum byte, então o
  132. download é forçado a falhar.
  133. Especificar ``0`` para desabilitar esta opção. Esta opção só é válida
  134. para servidores HTTP / FTP.
  135. Padrão: ``0``
  136. .. option:: -m, --max-tries=<NÚMERO>
  137. Define o número de tentativas. ``0`` significa ilimitadas.
  138. See also :option:`--retry-wait`.
  139. Padrão: ``5``
  140. .. option:: -k, --min-split-size=<TAMANHO>
  141. aria2 não divide menos que 2 * TAMANHO o intervalo de bytes. Por exemplo,
  142. considere download de um arquivo de 20MiB. Se o TAMANHO é 10M, aria2 pode
  143. dividir o arquivo em 2 intervalos de [0-10MiB) e [10MiB-20MiB) e executar o
  144. download usando 2 fontes (logicamente se a opção :option:`--split <-s>` >= 2).
  145. Se o TAMANHO é 15M, desde que 2 * 15M > 20Mib, aria2 não dividirá o arquivo e
  146. fará o download de 1 fonte. Pde ser anexado ``K`` ou ``M``
  147. (1K = 1024, 1M = 1024K).
  148. Valores Possíveis: ``1M`` -``1024M``
  149. Padrão: ``20M``
  150. .. option:: -n, --no-netrc[=true|false]
  151. Desabilita suporte netrc.
  152. Padrão: Suporte a netrc é habilitado por padrão.
  153. .. note::
  154. arquivo netrc é lido somente no início se a opção :option:`--no-netrc <-n>` é
  155. ``false``.
  156. Portanto se a opção :option:`--no-netrc <-n>` é ``true`` no início, não haverá
  157. netrc disponível durante toda a sessão, mesmo que seja utilizada a opção
  158. :func:`aria2.changeGlobalOption` para executar a opção :option:
  159. `--no-netrc=false <-n>`.
  160. .
  161. .. option:: --no-proxy=<DOMÍNIOS>
  162. Especifica nomes de servidores, domínios e endereços de redes com ou sem blocos
  163. CIDR para os quais não serão utilizados proxy.
  164. .. note::
  165. Para endereço de rede com blocos CIDR, ambos endereços IPv4 ou IPv6 funcionam.
  166. Implementação atual, não resolve nome host em URI para comparar com endereço
  167. especificado na opção :option:`--no-proxy`. Portanto só será efetiva se a URI
  168. possuir números de endereço IP.
  169. .. option:: -o, --out=<ARQUIVO>
  170. O nome do arquivo baixado. Quando a opção :option:`--force-sequential <-Z>` é
  171. utilizada esta opção será ignorada.
  172. .. note::
  173. Em um download Metalink ou BitTorrent não poderá ser especificado o nome
  174. do arquivo. O nome do arquivo especificado aqui é usado quando através
  175. da linha de comando é informada para o aria2 sem a utilização da opção
  176. :option:`--input-file <-i>`, :option:`--force-sequential <-Z>`.
  177. Por exemplo:
  178. .. code-block:: console
  179. $ aria2c -o meuarquivo.zip "http://server1/arquivo.zip" "http://server2/arquivo.zip"
  180. .. option:: --proxy-method=<MÉTODO>
  181. Define o método utilizado para requisições de proxy. MÉTODO é ``get`` ou
  182. ``tunnel``. Downloads HTTPS sempre utiliza ``tunnel``, independentemente
  183. desta opção.
  184. Padrão: ``get``
  185. .. option:: -R, --remote-time[=true|false]
  186. Recuperar timestamp do arquivo remoto a partir do servidor remoto HTTP / FTP
  187. e se disponível, aplicá-lo ao arquivo local.
  188. Padrão: ``false``
  189. .. option:: --reuse-uri[=true|false]
  190. Reutilizar uma URI já utilizada. Se não habilitada as URIs já utilizadas serão
  191. abandonadas.
  192. Padrão: ``true``
  193. .. option:: --retry-wait=<SEGUNDOS>
  194. Define quantos segundos haverá entre as tentativas. Com SEGUNDOS > 0, aria2 irá
  195. tentará fazer o download quando o servidor HTTP retornar código resposta 503.
  196. Padrão: ``0``
  197. .. option:: --server-stat-of=<ARQUIVO>
  198. Define o nome do arquivo no qual será salvo o perfil de performance de um
  199. ou mais servidores acessados.
  200. Para carregar dados já salvos utilizar opção :option:`--server-stat-if`.
  201. Ver subseção `Perfil Performance Servidor`_ abaixo,
  202. para o formato do arquivo.
  203. .. option:: --server-stat-if=<ARQUIVO>
  204. Specify the filename to load performance profile of the servers. The
  205. loaded data will be used in some URI selector such as ``feedback``.
  206. See also :option:`--uri-selector` option. See
  207. `Perfil Performance Servidor`_
  208. subsection below for file format.
  209. .. option:: --server-stat-timeout=<SEGUNDOS>
  210. Specifies timeout in seconds to invalidate performance profile of
  211. the servers since the last contact to them.
  212. Padrão: ``86400`` (24hours)
  213. .. option:: -s, --split=<N>
  214. Download a file using N connections. If more than N URIs are given,
  215. first N URIs are used and remaining URIs are used for backup. If
  216. less than N URIs are given, those URIs are used more than once so
  217. that N connections total are made simultaneously. The number of
  218. connections to the same host is restricted by
  219. :option:`--max-connection-per-server <-x>` option.
  220. See also :option:`--min-split-size <-k>` option.
  221. Padrão: ``5``
  222. .. note::
  223. Some Metalinks regulate the number of servers to connect. aria2
  224. strictly respects them. This means that if Metalink defines the
  225. maxconnections attribute lower than N, then aria2 uses the
  226. value of maxconnections attribute instead of N.
  227. .. option:: --stream-piece-selector=<SELECTOR>
  228. Specify piece selection algorithm used in HTTP e FTP download. Piece
  229. means fixed length segment which is downloaded in parallel in
  230. segmented download. If ``default`` is given, aria2 selects piece so
  231. that it reduces the number of establishing connection. This is
  232. reasonable default behaviour because establishing connection is an
  233. expensive operation. If ``inorder`` is given, aria2 selects piece
  234. which has minimum index. Index=0 means first of the file. This will
  235. be useful to view movie while downloading it.
  236. :option:`--enable-http-pipelining` option may
  237. be useful to reduce reconnection overhead. Please note that aria2
  238. honors
  239. :option:`--min-split-size <-k>` option,
  240. so it will be necessary to specify a reasonable value to
  241. :option:`--min-split-size <-k>` option.
  242. If ``geom`` is given, at the beginning aria2 selects piece which has
  243. minimum index like ``inorder``, but it exponentially increasingly
  244. keeps space from previously selected piece. This will reduce the
  245. number of establishing connection and at the same time it will
  246. download the beginning part of the file first. This will be useful
  247. to view movie while downloading it.
  248. Padrão: ``default``
  249. .. option:: -t, --timeout=<SEGUNDOS>
  250. Set timeout in seconds.
  251. Padrão: ``60``
  252. .. option:: --uri-selector=<SELECTOR>
  253. Specify URI selection algorithm. The possible values are ``inorder``,
  254. ``feedback`` and ``adaptive``. If ``inorder`` is given, URI is tried in
  255. the order appeared in the URI list. If ``feedback`` is given, aria2
  256. uses download speed observed in the previous downloads and choose
  257. fastest server in the URI list. This also effectively skips dead
  258. mirrors. The observed download speed is a part of performance
  259. profile of servers mentioned in :option:`--server-stat-of` and
  260. :option:`--server-stat-if` options. If ``adaptive`` is given, selects one of
  261. the best mirrors for the first and reserved connections. For
  262. supplementary ones, it returns mirrors which has not been tested
  263. yet, and if each of them has already been tested, returns mirrors
  264. which has to be tested again. Otherwise, it doesn't select anymore
  265. mirrors. Like ``feedback``, it uses a performance profile of servers.
  266. Padrão: ``feedback``
  267. Específicas de HTTP
  268. ~~~~~~~~~~~~~~~~~~~
  269. .. option:: --ca-certificate=<ARQUIVO>
  270. Utilizar o certificado do ARQUIVO FILE para verificar os Servidores.
  271. O certificado precisa estar no formato PEM e pode conter múltiplos
  272. certificados CA.
  273. Utilizar a opção :option:`--check-certificate` para habilitar a verificação.
  274. .. note::
  275. Se aria2 foi compilado com OpenSSL ou versão mais recente de GnuTLS a qual
  276. tem a função ``gnutls_certificate_set_x509_system_trust()`` e a biblioteca
  277. foi adequadamente configurada para localizar o certificado CA existente
  278. aria2 irá carregar automaticamente estes certificados no início.
  279. .. option:: --certificate=<ARQUIVO>
  280. Usar arquivo com certificado cliente.
  281. O certificado deve estar no formato PEM.
  282. Pode ser usada a opção :option:`--private-key` para especificar uma chave
  283. particular.
  284. .. option:: --check-certificate[=true|false]
  285. Verifica o se o peer esta usando o certificado especificado na opção
  286. :option:`--ca-certificate`.
  287. Padrão: ``true``
  288. .. option:: --http-accept-gzip[=true|false]
  289. Envia cabeçalho requisição ``Accept: deflate, gzip`` e faz (inflate) se
  290. o servidor remoto responder com ``Content-Encoding: gzip`` ou
  291. ``Content-Encoding: deflate``. Padrão: ``false``
  292. .. note::
  293. Alguns servidores respondem com ``Content-Encoding: gzip`` para arquivos
  294. que são gzip. aria2 faz inflate destes por causa do cabeçalho de resposta.
  295. .. option:: --http-auth-challenge[=true|false]
  296. Envia cabeçalho de autorização HTTP só quando requisitado pelo servidor.
  297. Se ``false`` é habilitado, então o cabeçalho de autorização sempre será
  298. enviado ao servidor. Há uma exceção: se o nome do usuário de senha são
  299. embutidas na URI, o cabeçalho de autorização sempre será enviado ao servidor
  300. independente desta opção. Padrão: ``false``
  301. .. option:: --http-no-cache[=true|false]
  302. Envia Cache-Control: no-cache e Pragma: cabeçalho no-cache para evitar
  303. conteúdo do cache. Se ``false`` é fornecido, esses cabeçalhos não serão
  304. enviados e poderá ser adicionado o cabeçalho de Cache-Control com a diretiva
  305. desejada usando a opção :option:`--header`. Padrão: ``true``
  306. .. option:: --http-user=<USUÁRIO>
  307. Define usuário HTTP. Isto afeta todas as URIs.
  308. .. option:: --http-passwd=<PASSWD>
  309. Define senha HTTP. Isto afeta todas as URIs.
  310. .. option:: --http-proxy=<PROXY>
  311. Usar este servidor proxy para HTTP. Para limpar o proxy anteriormente
  312. definido use "". Ver também opção :option:`--all-proxy`. Isto afeta todas
  313. URIs. O formato de PROXY é ``[http://][USUÁRIO:SENHA@]SERVIDOR[:PORTA]``
  314. .. option:: --http-proxy-passwd=<SENHA>
  315. Define a senha para opção :option:`--http-proxy`.
  316. .. option:: --http-proxy-user=<USUÁRIO>
  317. Define o usuário para a opção :option:`--http-proxy`.
  318. .. option:: --https-proxy=<PROXY>
  319. Usar este servidor proxy para HTTPS. Para limpar o proxy anteriormente,
  320. use "". Ver também opção :option:`--all-proxy`. Isto afeta todas URIs. O
  321. formato de PROXY é ``[https://][USUÁRIO:SENHA@]SERVIDOR[:PORTA]``
  322. .. option:: --https-proxy-passwd=<PASSWD>
  323. Set password for :option:`--https-proxy` option.
  324. .. option:: --https-proxy-user=<USUÁRIO>
  325. Set user for :option:`--https-proxy` option.
  326. .. option:: --private-key=<ARQUIVO>
  327. Use the private key in FILE.
  328. The private key must be decrypted and in PEM format.
  329. The behavior when encrypted one is given is undefined.
  330. See also :option:`--certificate` option.
  331. .. option:: --referer=<REFERER>
  332. Set Referer. This affects all URIs.
  333. .. option:: --enable-http-keep-alive[=true|false]
  334. Enable HTTP/1.1 persistent connection.
  335. Padrão: ``true``
  336. .. option:: --enable-http-pipelining[=true|false]
  337. Habilita pipelining para HTTP/1.1.
  338. Padrão: ``false``
  339. .. note::
  340. Da perspectiva de performance, não há vantagem em habilitar esta opção.
  341. .. option:: --header=<HEADER>
  342. Append HEADER to HTTP request header.
  343. You can use this option repeatedly to specify more than one header:
  344. .. code-block:: console
  345. $ aria2c --header="X-A: b78" --header="X-B: 9J1" "http://host/file"
  346. .. option:: --load-cookies=<ARQUIVO>
  347. Load Cookies from FILE using the Firefox3 format (SQLite3),
  348. Chromium/Google Chrome (SQLite3) and the
  349. Mozilla/Firefox(1.x/2.x)/Netscape format.
  350. .. note::
  351. If aria2 is built without libsqlite3, then it doesn't support Firefox3
  352. and Chromium/Google Chrome cookie format.
  353. .. option:: --save-cookies=<ARQUIVO>
  354. Save Cookies to FILE in Mozilla/Firefox(1.x/2.x)/ Netscape
  355. format. If FILE already exists, it is overwritten. Session Cookies
  356. are also saved and their expiry values are treated as 0. Possible
  357. Values: ``/path/to/file``
  358. .. option:: --use-head[=true|false]
  359. Use HEAD method for the first request to the HTTP server.
  360. Padrão: ``false``
  361. .. option:: -U, --user-agent=<AGENTE_USUÁRIO>
  362. Set user agent for HTTP, HTTPS, downloads.
  363. Padrão: ``aria2/$VERSION``, $VERSION is replaced by package version.
  364. Específicas de FTP
  365. ~~~~~~~~~~~~~~~~~~
  366. .. option:: --ftp-user=<USUÁRIO>
  367. Definir o usuário FTP. Isto afeta todas as URIs.
  368. Padrão: ``anonymous``
  369. .. option:: --ftp-passwd=<SENHA_FTP>
  370. Definir senha FTP. Isto afeta todas as URIs.
  371. Se o nome existe, mas a senha esta ausente, para login em uma URI, aria2
  372. tenta obter a senha usando o arquivo .netrc, caso exista senha declarada no
  373. .netrc. Se não existir será utilizada a senha declarada nesta opção.
  374. Padrão: ``ARIA2USER@``
  375. .. option:: -p, --ftp-pasv[=true|false]
  376. Use the passive mode in FTP.
  377. If ``false`` is given, the active mode will be used.
  378. Padrão: ``true``
  379. .. option:: --ftp-proxy=<PROXY>
  380. Use this proxy server for FTP. To erase previously defined proxy,
  381. use "". See also :option:`--all-proxy` option. This affects all URIs. The
  382. format of PROXY is ``[http://][USER:PASSWORD@]HOST[:PORT]``
  383. .. option:: --ftp-proxy-passwd=<PASSWD>
  384. Set password for :option:`--ftp-proxy` option.
  385. .. option:: --ftp-proxy-user=<USUÁRIO>
  386. Set user for :option:`--ftp-proxy` option.
  387. .. option:: --ftp-type=<TYPE>
  388. Set FTP transfer type. TYPE is either ``binary`` or ``ascii``.
  389. Padrão: ``binary``
  390. .. option:: --ftp-reuse-connection[=true|false]
  391. Reuse connection in FTP.
  392. Padrão: ``true``
  393. Comuns de BitTorrent / Metalink
  394. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  395. .. option:: --select-file=<INDEX>...
  396. Set file to download by specifying its index.
  397. You can find the file index using the :option:`--show-files <-S>` option.
  398. Multiple indexes can be specified by using ``,``, for example: ``3,6``.
  399. You can also use ``-`` to specify a range: ``1-5``.
  400. ``,`` and ``-`` can be used together: ``1-5,8,9``.
  401. When used with the -M option, index may vary depending on the query
  402. (see *--metalink-\** options).
  403. .. note::
  404. In multi file torrent, the adjacent files specified by this option may
  405. also be downloaded. This is by design, not a bug.
  406. A single piece may include several files or part of files, and aria2
  407. writes the piece to the appropriate files.
  408. .. option:: -S, --show-files[=true|false]
  409. Print file listing of ".torrent", ".meta4" and ".metalink" file and exit.
  410. In case of ".torrent" file, additional information
  411. (infohash, piece length, etc) is also printed.
  412. Específicas de BitTorrent
  413. ~~~~~~~~~~~~~~~~~~~~~~~~~
  414. .. option:: --bt-enable-lpd[=true|false]
  415. Enable Local Peer Discovery. If a private flag is set in a torrent,
  416. aria2 doesn't use this feature for that download even if ``true`` is
  417. given. Padrão: ``false``
  418. .. option:: --bt-exclude-tracker=<URI>[,...]
  419. Comma separated list of BitTorrent tracker's announce URI to
  420. remove. You can use special value ``*`` which matches all URIs, thus
  421. removes all announce URIs. When specifying ``*`` in shell
  422. command-line, don't forget to escape or quote it. See also
  423. :option:`--bt-tracker` option.
  424. .. option:: --bt-external-ip=<IPADDRESS>
  425. Specify the external IP address to report to a BitTorrent
  426. tracker. Although this function is named ``external``, it can accept
  427. any kind of IP addresses. IPADDRESS must be a numeric IP address.
  428. .. option:: --bt-hash-check-seed[=true|false]
  429. If ``true`` is given, after hash check using :option:`--check-integrity <-V>`
  430. option and file is complete, continue to seed file. If you want to check file
  431. and download it only when it is damaged or incomplete, set this
  432. option to ``false``. This option has effect only on BitTorrent download.
  433. Padrão: ``true``
  434. .. option:: --bt-lpd-interface=<INTERFACE>
  435. Use given interface for Local Peer Discovery. If this option is not
  436. specified, the default interface is chosen. You can specify
  437. interface name and IP address. Possible Values: interface, IP
  438. addres
  439. .. option:: --bt-max-open-files=<NÚMERO>
  440. Specify maximum number of files to open in each BitTorrent download.
  441. Padrão: ``100``
  442. .. option:: --bt-max-peers=<NÚMERO>
  443. Specify the maximum number of peers per torrent. ``0`` means
  444. unlimited. See also :option:`--bt-request-peer-speed-limit` option.
  445. Padrão: ``55``
  446. .. option:: --bt-metadata-only[=true|false]
  447. Download metadata only. The file(s) described in metadata will not
  448. be downloaded. This option has effect only when BitTorrent Magnet
  449. URI is used. See also :option:`--bt-save-metadata` option. Padrão: ``false``
  450. .. option:: --bt-min-crypto-level=plain|arc4
  451. Set minimum level of encryption method.
  452. If several encryption methods are provided by a peer, aria2 chooses the lowest
  453. one which satisfies the given level.
  454. Padrão: ``plain``
  455. .. option:: --bt-prioritize-piece=head[=<TAMANHO>],tail[=<TAMANHO>]
  456. Try to download first and last pieces of each file first. This is
  457. useful for previewing files. The argument can contain 2 keywords:
  458. ``head`` and ``tail``. To include both keywords, they must be separated
  459. by comma. These keywords can take one parameter, SIZE. For example,
  460. if ``head=<TAMANHO>`` is specified, pieces in the range of first SIZE bytes
  461. of each file get higher priority. ``tail=<TAMANHO>`` means the range of
  462. last SIZE bytes of each file. SIZE can include ``K`` or ``M`` (1K = 1024,
  463. 1M = 1024K). If SIZE is omitted, SIZE=1M is used.
  464. .. option:: --bt-remove-unselected-file[=true|false]
  465. Removes the unselected files when download is completed in
  466. BitTorrent. To select files, use
  467. :option:`--select-file` option. If it is
  468. not used, all files are assumed to be selected. Please use this
  469. option with care because it will actually remove files from your
  470. disk.
  471. Padrão: ``false``
  472. .. option:: --bt-require-crypto[=true|false]
  473. If true is given, aria2 doesn't accept and establish connection with legacy
  474. BitTorrent handshake(\19BitTorrent protocol).
  475. Thus aria2 always uses Obfuscation handshake.
  476. Padrão: ``false``
  477. .. option:: --bt-request-peer-speed-limit=<SPEED>
  478. If the whole download speed of every torrent is lower than SPEED,
  479. aria2 temporarily increases the number of peers to try for more
  480. download speed. Configuring this option with your preferred download
  481. speed can increase your download speed in some cases.
  482. You can append ``K`` or ``M`` (1K = 1024, 1M = 1024K).
  483. Padrão: ``50K``
  484. .. option:: --bt-save-metadata[=true|false]
  485. Save metadata as ".torrent" file. This option has effect only when
  486. BitTorrent Magnet URI is used. The filename is hex encoded info
  487. hash with suffix ".torrent". The directory to be saved is the same
  488. directory where download file is saved. If the same file already
  489. exists, metadata is not saved. See also :option:`--bt-metadata-only`
  490. option. Padrão: ``false``
  491. .. option:: --bt-seed-unverified[=true|false]
  492. Seed previously downloaded files without verifying piece hashes.
  493. Padrão: ``false``
  494. .. option:: --bt-stop-timeout=<SEGUNDOS>
  495. Stop BitTorrent download if download speed is 0 in consecutive SEC
  496. seconds. If ``0`` is given, this feature is disabled. Padrão: ``0``
  497. .. option:: --bt-tracker=<URI>[,...]
  498. Comma separated list of additional BitTorrent tracker's announce
  499. URI. These URIs are not affected by :option:`--bt-exclude-tracker` option
  500. because they are added after URIs in :option:`--bt-exclude-tracker` option are
  501. removed.
  502. .. option:: --bt-tracker-connect-timeout=<SEGUNDOS>
  503. Set the connect timeout in seconds to establish connection to
  504. tracker. After the connection is established, this option makes no
  505. effect and :option:`--bt-tracker-timeout` option is used instead. Padrão:
  506. ``60``
  507. .. option:: --bt-tracker-interval=<SEGUNDOS>
  508. Set the interval in seconds between tracker requests. This
  509. completely overrides interval value and aria2 just uses this value
  510. and ignores the min interval and interval value in the response of
  511. tracker. If ``0`` is set, aria2 determines interval based on the
  512. response of tracker and the download progress. Padrão: ``0``
  513. .. option:: --bt-tracker-timeout=<SEGUNDOS>
  514. Set timeout in seconds. Padrão: ``60``
  515. .. option:: --dht-entry-point=<HOST>:<PORT>
  516. Set host and port as an entry point to IPv4 DHT network.
  517. .. option:: --dht-entry-point6=<HOST>:<PORT>
  518. Set host and port as an entry point to IPv6 DHT network.
  519. .. option:: --dht-file-path=<PATH>
  520. Change the IPv4 DHT routing table file to PATH.
  521. Padrão: ``$HOME/.aria2/dht.dat``
  522. .. option:: --dht-file-path6=<PATH>
  523. Change the IPv6 DHT routing table file to PATH.
  524. Padrão: ``$HOME/.aria2/dht6.dat``
  525. .. option:: --dht-listen-addr6=<ADDR>
  526. Specify address to bind socket for IPv6 DHT. It should be a global
  527. unicast IPv6 address of the host.
  528. .. option:: --dht-listen-port=<PORT>...
  529. Set UDP listening port for both IPv4 and IPv6 DHT.
  530. Multiple ports can be specified by using ``,``, for example: ``6881,6885``.
  531. You can also use ``-`` to specify a range: ``6881-6999``. ``,`` and ``-``
  532. can be used together.
  533. Padrão: ``6881-6999``
  534. .. note::
  535. Make sure that the specified ports are open for incoming UDP traffic.
  536. .. option:: --dht-message-timeout=<SEGUNDOS>
  537. Set timeout in seconds. Padrão: ``10``
  538. .. option:: --enable-dht[=true|false]
  539. Enable IPv4 DHT functionality. If a private flag is set in a
  540. torrent, aria2 doesn't use DHT for that download even if ``true`` is
  541. given. Padrão: ``true``
  542. .. option:: --enable-dht6[=true|false]
  543. Enable IPv6 DHT functionality. If a private flag is set in a
  544. torrent, aria2 doesn't use DHT for that download even if ``true`` is
  545. given. Use :option:`--dht-listen-port` option to specify port number to
  546. listen on. See also :option:`--dht-listen-addr6` option.
  547. .. option:: --enable-peer-exchange[=true|false]
  548. Enable Peer Exchange extension. If a private flag is set in a torrent, this
  549. feature is disabled for that download even if ``true`` is given.
  550. Padrão: ``true``
  551. .. option:: --follow-torrent=true|false|mem
  552. If ``true`` or ``mem`` is specified, when a file whose suffix is ``.torrent`` or content
  553. type is ``application/x-bittorrent`` is downloaded, aria2 parses it as a torrent
  554. file and downloads files mentioned in it.
  555. If ``mem`` is specified, a torrent file is not written to the disk, but is just
  556. kept in memory.
  557. If ``false`` is specified, the action mentioned above is not taken.
  558. Padrão: ``true``
  559. .. option:: -O, --index-out=<INDEX>=<PATH>
  560. Set file path for file with index=INDEX. You can find the file index
  561. using the :option:`--show-files <-S>` option. PATH is a relative path to the
  562. path specified in :option:`--dir <-d>` option. You can use this option multiple
  563. times. Using this option, you can specify the output filenames of
  564. BitTorrent downloads.
  565. .. option:: --listen-port=<PORT>...
  566. Set TCP port number for BitTorrent downloads.
  567. Multiple ports can be specified by using ``,``, for example: ``6881,6885``.
  568. You can also use ``-`` to specify a range: ``6881-6999``.
  569. ``,`` and ``-`` can be used together: ``6881-6889,6999``.
  570. Padrão: ``6881-6999``
  571. .. note::
  572. Make sure that the specified ports are open for incoming TCP traffic.
  573. .. option:: --max-overall-upload-limit=<SPEED>
  574. Set max overall upload speed in bytes/sec. ``0`` means unrestricted.
  575. You can append ``K`` or ``M`` (1K = 1024, 1M = 1024K).
  576. Para limitar a velocidade de upload por torrent, usar opção
  577. :option:`--max-upload-limit <-u>`.
  578. Padrão: ``0``
  579. .. option:: -u, --max-upload-limit=<SPEED>
  580. Set max upload speed per each torrent in bytes/sec.
  581. ``0`` means unrestricted.
  582. You can append ``K`` or ``M`` (1K = 1024, 1M = 1024K).
  583. To limit the overall upload speed, use :option:`--max-overall-upload-limit` option.
  584. Padrão: ``0``
  585. .. option:: --peer-id-prefix=<PEER_ID_PREFIX>
  586. Specify the prefix of peer ID. The peer ID in
  587. BitTorrent is 20 byte length. If more than 20
  588. bytes are specified, only first 20 bytes are
  589. used. If less than 20 bytes are specified, random
  590. byte data are added to make its length 20 bytes.
  591. Padrão: ``aria2/$VERSION-``, $VERSION is replaced by package version.
  592. .. option:: --seed-ratio=<RATIO>
  593. Specify share ratio. Seed completed torrents until share ratio reaches
  594. RATIO.
  595. You are strongly encouraged to specify equals or more than ``1.0`` here.
  596. Specify ``0.0`` if you intend to do seeding regardless of share ratio.
  597. If :option:`--seed-time` option is specified along with this option,
  598. seeding ends when at least one of the conditions is satisfied.
  599. Padrão: ``1.0``
  600. .. option:: --seed-time=<MINUTES>
  601. Specify seeding time in minutes. Also see the :option:`--seed-ratio` option.
  602. .. note::
  603. Specifying :option:`--seed-time=0 <--seed-time>` disables seeding
  604. after download completed.
  605. .. option:: -T, --torrent-file=<TORRENT_FILE>
  606. The path to the ".torrent" file. You are not required to use this
  607. option because you can specify ".torrent" files without :option:`--torrent-file <-T>`.
  608. Específicas de Metalink
  609. ~~~~~~~~~~~~~~~~~~~~~~~
  610. .. option:: --follow-metalink=true|false|mem
  611. If ``true`` or ``mem`` is specified, when a file whose suffix is ``.meta4`` or ``.metalink`` or content
  612. type of ``application/metalink4+xml`` or ``application/metalink+xml`` is downloaded, aria2 parses it as a metalink
  613. file and downloads files mentioned in it.
  614. If ``mem`` is specified, a metalink file is not written to the disk, but is just
  615. kept in memory.
  616. If ``false`` is specified, the action mentioned above is not taken.
  617. Padrão: ``true``
  618. .. option:: --metalink-base-uri=<URI>
  619. Specify base URI to resolve relative URI in metalink:url and
  620. metalink:metaurl element in a metalink file stored in local disk. If
  621. URI points to a directory, URI must end with ``/``.
  622. .. option:: -M, --metalink-file=<METALINK_FILE>
  623. The file path to ".meta4" and ".metalink" file. Reads input from stdin when ``-`` is
  624. specified. You are not required to use this option because you can
  625. specify ".metalink" files without :option:`--metalink-file <-M>`.
  626. .. option:: --metalink-language=<LANGUAGE>
  627. The language of the file to download.
  628. .. option:: --metalink-location=<LOCATION>[,...]
  629. The location of the preferred server.
  630. A comma-delimited list of locations is acceptable, for example, ``jp,us``.
  631. .. option:: --metalink-os=<OS>
  632. The operating system of the file to download.
  633. .. option:: --metalink-version=<VERSION>
  634. The version of the file to download.
  635. .. option:: --metalink-preferred-protocol=<PROTO>
  636. Specify preferred protocol.
  637. The possible values are ``http``, ``https``, ``ftp`` and ``none``.
  638. Specify ``none`` to disable this feature.
  639. Padrão: ``none``
  640. .. option:: --metalink-enable-unique-protocol[=true|false]
  641. If ``true`` is given and several protocols are available for a mirror in a
  642. metalink file, aria2 uses one of them.
  643. Use :option:`--metalink-preferred-protocol` option to specify the preference of
  644. protocol.
  645. Padrão: ``true``
  646. De RPC
  647. ~~~~~~
  648. .. option:: --enable-rpc[=true|false]
  649. Enable JSON-RPC/XML-RPC server. It is strongly recommended to set username
  650. and password using :option:`--rpc-user` and :option:`--rpc-passwd`
  651. option. See also :option:`--rpc-listen-port` option. Padrão: ``false``
  652. .. option:: --pause[=true|false]
  653. Pause download after added. This option is effective only when
  654. :option:`--enable-rpc=true <--enable-rpc>` is given.
  655. Padrão: ``false``
  656. .. option:: --rpc-allow-origin-all[=true|false]
  657. Add Access-Control-Allow-Origin header field with value ``*`` to the
  658. RPC response.
  659. Padrão: ``false``
  660. .. option:: --rpc-listen-all[=true|false]
  661. Listen incoming JSON-RPC/XML-RPC requests on all network interfaces. If false
  662. is given, listen only on local loopback interface. Padrão: ``false``
  663. .. option:: --rpc-listen-port=<PORT>
  664. Specify a port number for JSON-RPC/XML-RPC server to listen to. Possible
  665. Values: ``1024`` -``65535`` Padrão: ``6800``
  666. .. option:: --rpc-max-request-size=<TAMANHO>
  667. Set max size of JSON-RPC/XML-RPC request. If aria2 detects the request is
  668. more than SIZE bytes, it drops connection. Padrão: ``2M``
  669. .. option:: --rpc-passwd=<PASSWD>
  670. Set JSON-RPC/XML-RPC password.
  671. .. option:: --rpc-user=<USUÁRIO>
  672. Set JSON-RPC/XML-RPC user.
  673. Avançadas
  674. ~~~~~~~~~
  675. .. option:: --allow-overwrite[=true|false]
  676. Restart download from scratch if the corresponding control file
  677. doesn't exist. See also :option:`--auto-file-renaming` option. Padrão:
  678. ``false``
  679. .. option:: --allow-piece-length-change[=true|false]
  680. If false is given, aria2 aborts download when a piece length is different
  681. from one in a control file.
  682. If true is given, you can proceed but some download progress will be lost.
  683. Padrão: ``false``
  684. .. option:: --always-resume[=true|false]
  685. Always resume download. If ``true`` is given, aria2 always tries to
  686. resume download and if resume is not possible, aborts download. If
  687. ``false`` is given, when all given URIs do not support resume or aria2
  688. encounters ``N`` URIs which does not support resume (``N`` is the value
  689. specified using :option:`--max-resume-failure-tries` option), aria2
  690. downloads file from scratch. See :option:`--max-resume-failure-tries`
  691. option. Padrão: ``true``
  692. .. option:: --async-dns[=true|false]
  693. Enable asynchronous DNS.
  694. Padrão: ``true``
  695. .. option:: --async-dns-server=<IPADDRESS>[,...]
  696. Comma separated list of DNS server address used in asynchronous DNS
  697. resolver. Usually asynchronous DNS resolver reads DNS server
  698. addresses from ``/etc/resolv.conf``. When this option is used, it uses
  699. DNS servers specified in this option instead of ones in
  700. ``/etc/resolv.conf``. You can specify both IPv4 and IPv6 address. This
  701. option is useful when the system does not have ``/etc/resolv.conf`` and
  702. user does not have the permission to create it.
  703. .. option:: --auto-file-renaming[=true|false]
  704. Rename file name if the same file already exists.
  705. This option works only in HTTP, HTTPS e FTP download.
  706. The new file name has a dot and a number(1..9999) appended.
  707. Padrão: ``true``
  708. .. option:: --auto-save-interval=<SEGUNDOS>
  709. Save a control file(\*.aria2) every SEC seconds.
  710. If ``0`` is given, a control file is not saved during download. aria2 saves a
  711. control file when it stops regardless of the value.
  712. The possible values are between ``0`` to ``600``.
  713. Padrão: ``60``
  714. .. option:: --conditional-get[=true|false]
  715. Download file only when the local file is older than remote
  716. file. This function only works with HTTP, HTTPS, downloads only. It does
  717. not work if file size is specified in Metalink. It also ignores
  718. Content-Disposition header. If a control file exists, this option
  719. will be ignored. This function uses If-Modified-Since header to get
  720. only newer file conditionally. When getting modification time of
  721. local file, it uses user supplied filename(see :option:`--out <-o>` option) or
  722. filename part in URI if :option:`--out <-o>` is not specified.
  723. To overwrite existing file, :option:`--allow-overwrite` is required.
  724. Padrão: ``false``
  725. .. option:: --conf-path=<PATH>
  726. Change the configuration file path to PATH.
  727. Padrão: ``$HOME/.aria2/aria2.conf``
  728. .. option:: -D, --daemon[=true|false]
  729. Run as daemon. The current working directory will be changed to ``/``
  730. and standard input, standard output and standard error will be
  731. redirected to ``/dev/null``. Padrão: ``false``
  732. .. option:: --deferred-input[=true|false]
  733. If ``true`` is given, aria2 does not read all URIs and options from file
  734. specified by :option:`--input-file <-i>` option at startup,
  735. but it reads one by one when it
  736. needs later. This may reduce memory usage if input file contains a
  737. lot of URIs to download. If ``false`` is given, aria2 reads all URIs
  738. and options at startup.
  739. Padrão: ``false``
  740. .. option:: --disable-ipv6[=true|false]
  741. Disable IPv6. This is useful if you have to use broken DNS and want
  742. to avoid terribly slow AAAA record lookup. Padrão: ``false``
  743. .. option:: --download-result=<OPT>
  744. This option changes the way ``Download Results`` is formatted. If OPT
  745. is ``default``, print GID, status, average download speed and
  746. path/URI. If multiple files are involved, path/URI of first
  747. requested file is printed and remaining ones are omitted. If OPT is
  748. ``full``, print GID, status, average download speed, percentage of
  749. progress and path/URI. The percentage of progress and path/URI are
  750. printed for each requested file in each row.
  751. Padrão: ``default``
  752. .. option:: --enable-async-dns6[=true|false]
  753. Enable IPv6 name resolution in asynchronous DNS resolver. This
  754. option will be ignored when :option:`--async-dns=false. <--async-dns>`
  755. Padrão: ``false``
  756. .. option:: --enable-mmap[=true|false]
  757. Map files into memory. This option may not work if the file space
  758. is not pre-allocated. See :option:`--file-allocation`.
  759. Padrão: ``false``
  760. .. option:: --event-poll=<POLL>
  761. Specify the method for polling events. The possible values are
  762. ``epoll``, ``kqueue``, ``port``, ``poll`` and ``select``. For each ``epoll``,
  763. ``kqueue``, ``port`` and ``poll``, it is available if system supports it.
  764. ``epoll`` is available on recent Linux. ``kqueue`` is available on
  765. various \*BSD systems including Mac OS X. ``port`` is available on Open
  766. Solaris. The default value may vary depending on the system you use.
  767. .. option:: --file-allocation=<METHOD>
  768. Specify file allocation method.
  769. ``none`` doesn't pre-allocate file space. ``prealloc`` pre-allocates file space
  770. before download begins. This may take some time depending on the size of the
  771. file.
  772. If you are using newer file systems such as ext4
  773. (with extents support), btrfs, xfs or NTFS(MinGW build only), ``falloc`` is
  774. your best choice. It allocates large(few GiB)
  775. files almost instantly. Don't use ``falloc`` with
  776. legacy file systems such as ext3 and FAT32 because it takes
  777. almost same time as ``prealloc`` and it blocks aria2
  778. entirely until allocation finishes. ``falloc`` may
  779. not be available if your system doesn't have
  780. :manpage:`posix_fallocate(3)` function.
  781. ``trunc`` uses :manpage:`ftruncate(2)` system call or
  782. platform-specific counterpart to truncate a file to a specified
  783. length.
  784. Possible Values: ``none``, ``prealloc``, ``trunc``, ``falloc``
  785. Padrão: ``prealloc``
  786. .. option:: --hash-check-only[=true|false]
  787. If ``true`` is given, after hash check using
  788. :option:`--check-integrity <-V>` option,
  789. abort download whether or not download is complete.
  790. Padrão: ``false``
  791. .. option:: --human-readable[=true|false]
  792. Print sizes and speed in human readable format (e.g., 1.2Ki, 3.4Mi)
  793. in the console readout. Padrão: ``true``
  794. .. option:: --interface=<INTERFACE>
  795. Bind sockets to given interface. You can specify interface name, IP
  796. address and hostname.
  797. Possible Values: interface, IP address, hostname
  798. .. note::
  799. If an interface has multiple addresses, it is highly recommended to
  800. specify IP address explicitly. See also :option:`--disable-ipv6`. If your
  801. system doesn't have :manpage:`getifaddrs(3)`, this option doesn't accept interface
  802. name.
  803. .. option:: --max-download-result=<NÚMERO>
  804. Set maximum number of download result kept in memory. The download
  805. results are completed/error/removed downloads. The download results
  806. are stored in FIFO queue and it can store at most NUM download
  807. results. When queue is full and new download result is created,
  808. oldest download result is removed from the front of the queue and
  809. new one is pushed to the back. Setting big number in this option may
  810. result high memory consumption after thousands of
  811. downloads. Specifying 0 means no download result is kept. Padrão:
  812. ``1000``
  813. .. option:: --max-resume-failure-tries=<N>
  814. When used with :option:`--always-resume=false, <--always-resume>` aria2 downloads file from
  815. scratch when aria2 detects N number of URIs that does not support
  816. resume. If N is ``0``, aria2 downloads file from scratch when all
  817. given URIs do not support resume. See :option:`--always-resume` option.
  818. Padrão: ``0``
  819. .. option:: --log-level=<LEVEL>
  820. Set log level to output.
  821. LEVEL is either ``debug``, ``info``, ``notice``, ``warn`` or ``error``.
  822. Padrão: ``debug``
  823. .. option:: --on-bt-download-complete=<COMMAND>
  824. For BitTorrent, a command specified in :option:`--on-download-complete` is
  825. called after download completed and seeding is over. On the other
  826. hand, this option set the command to be executed after download
  827. completed but before seeding.
  828. See `Interação com Eventos (Hook)`_ for more details about COMMAND.
  829. Possible Values: ``/path/to/command``
  830. .. option:: --on-download-complete=<COMMAND>
  831. Set the command to be executed after download completed. See
  832. See `Interação com Eventos (Hook)`_ for more details about COMMAND.
  833. See also :option:`--on-download-stop` option.
  834. Possible Values: ``/path/to/command``
  835. .. option:: --on-download-error=<COMMAND>
  836. Set the command to be executed after download aborted due to error.
  837. See `Interação com Eventos (Hook)`_ for more details about COMMAND.
  838. See also :option:`--on-download-stop` option. Possible Values:
  839. ``/path/to/command``
  840. .. option:: --on-download-pause=<COMMAND>
  841. Set the command to be executed after download was paused.
  842. See `Interação com Eventos (Hook)`_ for more details about COMMAND.
  843. Possible Values: ``/path/to/command``
  844. .. option:: --on-download-start=<COMMAND>
  845. Set the command to be executed after download got started.
  846. See `Interação com Eventos (Hook)`_ for more details about COMMAND.
  847. Possible Values: ``/path/to/command``
  848. .. option:: --on-download-stop=<COMMAND>
  849. Set the command to be executed after download stopped. You can override
  850. the command to be executed for particular download result using
  851. :option:`--on-download-complete` and :option:`--on-download-error`. If they are
  852. specified, command specified in this option is not executed.
  853. See `Interação com Eventos (Hook)`_ for more details about COMMAND.
  854. Possible Values: ``/path/to/command``
  855. .. option:: --piece-length=<LENGTH>
  856. Set a piece length for HTTP e FTP downloads. This is the boundary when
  857. aria2 splits a file. All splits occur at multiple of this
  858. length. This option will be ignored in BitTorrent downloads. It
  859. will be also ignored if Metalink file contains piece hashes.
  860. Padrão: ``1M``
  861. .. note::
  862. The possible usecase of :option:`--piece-length`
  863. option is change the request range in one HTTP pipelined request.
  864. To enable HTTP pipelining use
  865. :option:`--enable-http-pipelining`.
  866. .. option:: --show-console-readout[=true|false]
  867. Show console readout. Padrão: ``true``
  868. .. option:: --summary-interval=<SEGUNDOS>
  869. Set interval in seconds to output download progress summary.
  870. Setting ``0`` suppresses the output.
  871. Padrão: ``60``
  872. .. note::
  873. In multi file torrent downloads, the files adjacent forward to the specified files
  874. are also allocated if they share the same piece.
  875. .. option:: -Z, --force-sequential[=true|false]
  876. Fetch URIs in the command-line sequentially and download each URI in a
  877. separate session, like the usual command-line download utilities.
  878. Padrão: ``false``
  879. .. option:: --max-overall-download-limit=<SPEED>
  880. Set max overall download speed in bytes/sec. ``0`` means
  881. unrestricted. You can append ``K`` or ``M`` (1K = 1024, 1M = 1024K). To
  882. limit the download speed per download, use :option:`--max-download-limit`
  883. option. Padrão: ``0``
  884. .. option:: --max-download-limit=<SPEED>
  885. Set max download speed per each download in bytes/sec. ``0`` means
  886. unrestricted. You can append ``K`` or ``M`` (1K = 1024, 1M = 1024K). To
  887. limit the overall download speed, use :option:`--max-overall-download-limit`
  888. option. Padrão: ``0``
  889. .. option:: --no-conf[=true|false]
  890. Disable loading aria2.conf file.
  891. .. option:: --no-file-allocation-limit=<TAMANHO>
  892. No file allocation is made for files whose size is smaller than SIZE.
  893. You can append ``K`` or ``M`` (1K = 1024, 1M = 1024K).
  894. Padrão: ``5M``
  895. .. option:: -P, --parameterized-uri[=true|false]
  896. Enable parameterized URI support.
  897. You can specify set of parts: ``http://{sv1,sv2,sv3}/foo.iso``.
  898. Also you can specify numeric sequences with step counter:
  899. ``http://host/image[000-100:2].img``.
  900. A step counter can be omitted.
  901. If all URIs do not point to the same file, such as the second example above,
  902. -Z option is required.
  903. Padrão: ``false``
  904. .. option:: -q, --quiet[=true|false]
  905. Make aria2 quiet (no console output).
  906. Padrão: ``false``
  907. .. option:: --realtime-chunk-checksum[=true|false]
  908. Validate chunk of data by calculating checksum while downloading a file if
  909. chunk checksums are provided.
  910. Padrão: ``true``
  911. .. option:: --remove-control-file[=true|false]
  912. Remove control file before download. Using with
  913. :option:`--allow-overwrite=true, <--allow-overwrite>` download always starts from
  914. scratch. This will be useful for users behind proxy server which
  915. disables resume.
  916. .. option:: --save-session=<ARQUIVO>
  917. Save error/unfinished downloads to FILE on exit. You can pass this
  918. output file to aria2c with :option:`--input-file <-i>` option on restart. Please note that
  919. downloads added by :func:`aria2.addTorrent` and
  920. :func:`aria2.addMetalink`
  921. RPC method and whose metadata could not be saved as a file are not saved.
  922. Downloads removed using
  923. :func:`aria2.remove` and
  924. :func:`aria2.forceRemove`
  925. will not be saved.
  926. .. option:: --stop=<SEGUNDOS>
  927. Stop application after SEC seconds has passed.
  928. If ``0`` is given, this feature is disabled.
  929. Padrão: ``0``
  930. .. option:: --stop-with-process=<PID>
  931. Stop application when process PID is not running. This is useful if
  932. aria2 process is forked from a parent process. The parent process
  933. can fork aria2 with its own pid and when parent process exits for
  934. some reason, aria2 can detect it and shutdown itself.
  935. .. option:: --truncate-console-readout[=true|false]
  936. Truncate console readout to fit in a single line.
  937. Padrão: ``true``
  938. .. option:: -v, --version
  939. Print the version number, copyright and the configuration information and
  940. exit.
  941. Argumento(s) Opcional(is)
  942. ~~~~~~~~~~~~~~~~~~~~~~~~~
  943. The options that have its argument surrounded by square brackets([])
  944. take an optional argument. Usually omiting the argument is evaluated to ``true``.
  945. If you use short form of these options(such as ``-V``) and give
  946. an argument, then the option name and its argument should be concatenated(e.g.
  947. ``-Vfalse``). If any spaces are inserted between the option name and the argument,
  948. the argument will be treated as URI and usually this is not what you expect.
  949. URI, MAGNET, TORRENT_FILE, METALINK_FILE
  950. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  951. Pode-se especificar múltiplas URIs em uma linha de comando. A menos que seja
  952. especificada a opção :option:`--force-sequential <-Z>`, todas as URIs devem
  953. apontar para o mesmo arquivo que será baixado ou o download falhará.
  954. Pode-se especificar um número arbitrátio de URIs de BitTorrent Magnet URI.
  955. Nove que eles sempre serão tratados como downloads separados.
  956. São suportados Hash de Info de 40 characters e Hast de Info Base32 de 32
  957. characters. Múltiplos parâmetros ``tr`` são suportados. Devido a URI
  958. BitTorrent Magnet poder conter o caracter ``&``, é altamente recomendável
  959. delimitar a URI com apóstrofo single(``'``) ou aspas double(``"``).
  960. É altamente recomendável habilitar DHT especialmente quando ``tr`` o parâmetro
  961. estiver ausente. Ver http://www.bittorrent.org/beps/bep_0009.html
  962. para maiores detalhes sobre URI BitTorrent Magnet.
  963. Pode-se também especificar um número arbitrário de arquivos torrent e
  964. Documentos Metalink armazenados em um dispositivo local. Note que sempre serão
  965. tratados como download distintos. Tanto Metalink4 quanto Metalink da versão 3
  966. são suportados.
  967. Pode-se especificar arquivo torrent usando a opção -T e URI. Fazendo isso
  968. o download será baixado do servidor swarm e HTTP, HTTPS e FTP ao mesmo tempo,
  969. enquanto os dados do HTTP, HTTPS e FTP serão uploaded para o swarm torrent.
  970. Para torrent de um arquivo a URI deve ser completa e apontar inclusive o
  971. recurso ou se a URI terminar com / o nome do torrent será adicionado. Para
  972. múltiplos torrents, name e caminho serão adicionados para formar a URI, para
  973. cada um dos arquivos.
  974. .. note::
  975. Certifique-se que a URI seja delimitada por apóstrofo single(``'``) ou
  976. aspas double(``"``) se a URI contiver ``&`` ou qualquer outro caracter que
  977. tenha significado especial para o shell.
  978. Continuar Download Interrompido
  979. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  980. Normalmente pode-se retomar uma transferência apenas executando-se o comando
  981. aria2c URI, caso a transferência anterior estava sendo feita pelo aria2.
  982. Caso a transferência anterior estava sendo feita por um navegador ou wget de
  983. maneira sequencial, então utilize a opção :option:`--continue <-c>` para
  984. retomar do ponto onde foi interrompida a transferência.
  985. Interação com Eventos (Hook)
  986. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  987. aria2 possui opções para especificar comando arbitrário após um evento
  988. específico ocorrer. Atualmente as seguintes opções estão disponíveis:
  989. :option:`--on-bt-download-complete`,
  990. :option:`--on-download-pause`,
  991. :option:`--on-download-complete`.
  992. :option:`--on-download-start`,
  993. :option:`--on-download-error`,
  994. :option:`--on-download-stop`.
  995. aria2 passa 3 argumentos para um comando especificado quando este comando for
  996. executado. Estes argumentos são: GID, o número de arquivos e o caminho dos
  997. arquivos. Para downloads HTTP, HTTPS e FTP normalmente o número de arquivos é 1.
  998. BitTorrent podem conter múltiplos arquivos. Se o número de arquivos é maior
  999. que 1, o caminho do arquivo é o primeiro. Em outras palavras, este é o valor
  1000. da chave path da primeira estrutura se aquela chave for verdadeira como
  1001. resposta do método da função :func:`aria2.getFiles` RPC .
  1002. Se for necessário todos os caminhos dos arquivos, considere usar o método
  1003. JSON-RPC/XML-RPC. Lembre-se que o caminho do arquivo pode ser modificado
  1004. durante o download no HTTP por causa do redirecionamento ou Disposição do
  1005. Conteúdo do Cabeçalho.
  1006. Observemos um exemplo de como são passados argumentos para um comando:
  1007. .. code-block:: console
  1008. $ cat hook.sh
  1009. #!/bin/sh
  1010. echo "chamado com [$1] [$2] [$3]"
  1011. $ aria2c --on-download-complete hook.sh http://dobrasil.org/arquivo.iso
  1012. chamado com [1] [1] [/caminho/para/arquivo.iso]
  1013. CÓDIGO DE RETORNO
  1014. -----------------
  1015. Como aria2 pode manipular múltiplos downloads concomitantemente, podem ser
  1016. encontrados vários erros durante uma sessão. aria2 retorna os códigos de
  1017. retorno ou saída com base no último erro encontrado.
  1018. 0
  1019. Se todos os downloads terminam com sucesso.
  1020. 1
  1021. Erro desconhecido ocorreu.
  1022. 2
  1023. Tempo transcorrido (time out).
  1024. 3
  1025. Recurso não encontrado.
  1026. 4
  1027. Se aria2 tentou um número especificado de vezes e obteve "recurso não encontrado".
  1028. Ver opção :option:`--max-file-not-found`.
  1029. 5
  1030. Se download interrompido porque a velocidade de download é muito baixa.
  1031. Ver opção :option:`--lowest-speed-limit`
  1032. 6
  1033. Erro na rede (network).
  1034. 7
  1035. Se existem downloads não concluidos. Esse erro é reportado somente se
  1036. todos os downloads foram concluídos com sucesso mas existe uma fila quando
  1037. aria2 foi interrompido por quando foi pressionado :kbd:`Ctrl-C` pelo usuário
  1038. ou enviado o sinal TERM ou INT.
  1039. 8
  1040. Se o servidor remoto não suporta retomar um download que deve ser completado.
  1041. 9
  1042. Não há espaço em disco suficiente para os downloads.
  1043. 10
  1044. Se o tamanho do pedaço (piece) foi diferente do arquivo de controle .aria2.
  1045. Ver opção :option:`--allow-piece-length-change`.
  1046. 11
  1047. Se aria2 estava fazendo o download do mesmo arquivo no momento.
  1048. 12
  1049. If aria2 estava fazendo o download do mesmo, hash do torrent, no momento.
  1050. 13
  1051. Se o arquivo já existe. Ver opção :option:`--allow-overwrite`.
  1052. 14
  1053. Se renomer o arquivo falhou. Ver opção :option:`--auto-file-renaming`.
  1054. 15
  1055. Se aria2 não pode abrir o arquivo existente.
  1056. 16
  1057. Se aria2 não pode criar novo arquivo ou truncar um arquivo já existente.
  1058. 17
  1059. Se ocorreu erro de I/O no arquivo.
  1060. 18
  1061. Se aria2 não pode criar diretório.
  1062. 19
  1063. Se resolução de nomes falhou.
  1064. 20
  1065. Se aria2 não pode passar documento Metalink.
  1066. 21
  1067. Se comando FTP falhou.
  1068. 22
  1069. Se cabeçalho de resposta HTTP está errado ou inesperado.
  1070. 23
  1071. Se muitos redirecionamentos ocorreram.
  1072. 24
  1073. Se autorização HTTP falhou.
  1074. 25
  1075. Se aria2 não pode passar arquivo bencoded file (normalmente arq. ".torrent").
  1076. 26
  1077. Se arquivo ".torrent" estava corrompido ou inexistem informações que aria2
  1078. necessita.
  1079. 27
  1080. Se URI Magnet URI está errada.
  1081. 28
  1082. Se opção está errada ou não é reconhecida ou argumento inválido de uma opção
  1083. foi informado.
  1084. 29
  1085. Se o servidor remoto não pode manusear uma requisição devido a sobrecarga
  1086. temporária ou manutenção.
  1087. 30
  1088. Se aria2 não pode passar uma requisição JSON-RPC.
  1089. .. note::
  1090. Um erro ocorrido em um download completado não será reportado como um
  1091. status de saida (exit status).
  1092. VARIÁVEIS DE AMBIENTE
  1093. ---------------------
  1094. aria2 reconhece as seguintes variáveis de ambiente.
  1095. ``http_proxy [http://][USUÁRIO:SENHA@]SERVIDOR[:PORTA]``
  1096. Especifica o servidor para uso do HTTP.
  1097. Sobrepõe o valor do http-proxy do arquivo de configuração.
  1098. A opção linha de comando :option:`--http-proxy` sobrepõe este valor.
  1099. ``https_proxy [http://][USUÁRIO:SENHA@]SERVIDOR[:PORTA]``
  1100. Especifica o servidor proxy para uso do HTTPS.
  1101. Sobrepõe o valor do https-proxy do arquivo de configuração.
  1102. A opção linha de comando :option:`--https-proxy` sobrepõe este valor.
  1103. ``ftp_proxy [http://][USUÁRIO:SENHA@]SERVIDOR[:PORTA]``
  1104. Especifica o servidor proxy para uso do FTP.
  1105. Sobrepõe o valor do http-proxy do arquivo de configuração.
  1106. A opção linha de comando :option:`--ftp-proxy` sobrepõe este valor.
  1107. ``all_proxy [http://][USUÁRIO:SENHA@]SERVIDOR[:PORTA]``
  1108. Especifica o servidor proxy para uso se nenhum protocolo-específico de proxy
  1109. é informado.
  1110. Sobrepõe o valor all-proxy do arquivo de configuração.
  1111. A opção linha de comando :option:`--all-proxy` sobrepõe este valor.
  1112. .. note::
  1113. Apesar de aria2 aceitar os esquemas ``ftp://`` e ``https://`` para proxy de
  1114. URI, aria2 assume que ``http://`` é especificado e não troca o comportamento
  1115. com base no esquema especificado.
  1116. ``no_proxy [DOMÍNIO,...]``
  1117. Especifica nome de servidores, separados por vírgula, domínios e endereços
  1118. de rede com ou sem blocos CIDR para os quais não será usado proxy.
  1119. Sobrepõe o valor no-proxy do arquivo de configuração.
  1120. A opção linha de comando :option:`--no-proxy` sobrepõe este valor.
  1121. ARQUIVOS
  1122. --------
  1123. aria2.conf
  1124. ~~~~~~~~~~
  1125. Por padrão, aria2 utiliza ``$HOME/.aria2/aria2.conf`` como arquivo de
  1126. configuração. Pode ser especificado o caminho do arquivo usando-se a opção
  1127. :option:`--conf-path`. Se não desejar usar a configuração de arquivo utilize
  1128. a opção :option:`--no-conf`.
  1129. O arquivo de configuração é um arquivo texto e possui uma opção por linha.
  1130. Em cada linha, deve haver um par (nome-valor), no formato:
  1131. ``NOME=VALOR``, onde nome é o nome longo da linha de comando sem o prefixo
  1132. ``--``. Pode ser usada a mesma sintaxe da opção da linha de comando.
  1133. Linhas que começam com ``#`` são tratados como comentários::
  1134. # arquivo de simples configuração para aria2c
  1135. listen-port=60000
  1136. dht-listen-port=60000
  1137. seed-ratio=1.0
  1138. max-upload-limit=50K
  1139. ftp-pasv=true
  1140. .. note::
  1141. Informações confidenciais como usuário/senha podem ser incluídas no arquivo
  1142. de configuração, mas recomenda-se trocar os bits de seu modo de acesso
  1143. (por exemplo: ``chmod 600 aria2.conf``), dessa maneira nenhum outro usuário
  1144. consegue ver o conteúdo desse arquivo de configuração.
  1145. dht.dat
  1146. ~~~~~~~~
  1147. Por padrão, a tabela de rota do IPv4 DHT está em ``$HOME/.aria2/dht.dat`` e a
  1148. tabela de rota do IPv6 DHT existe está em ``$HOME/.aria2/dht6.dat``.
  1149. Netrc
  1150. ~~~~~
  1151. Por padrão, o suporte a Netrc está habilitado para HTTP, HTTPS e FTP. Para
  1152. desabilitar o suporte a netrc especificar :option:`--no-netrc <-n>`. Seu
  1153. arquivo .netrc precisa ter as permissões corretas (600).
  1154. Se o nome do servidor inicia com ``.``, aria2 executa pesquisa domínio ao
  1155. invés de pesquisa exata. Isto é uma extensão de aria2. Exemplo de pesquisa
  1156. de domínio, imagine as seguinte entrada no arquivo .netrc::
  1157. machine .dobrasil.org login meuid password minhasenha
  1158. ``aria2.dobrasil.org`` pesquisa domínio ``.dobrasil.org`` e usa ``meuid`` e
  1159. ``minhasenha``.
  1160. Mais exemplos de pesquisa domínio: ``nobrasil.net`` não executa pesquisa
  1161. domínio ``.nobrasil.net``. ``dobrasil.org`` não faz pesquisa domínio ``.dobrasil.org``
  1162. pois tem maior amplitude hierárquica por causa do ponto precedente ``.``. Se
  1163. desejar utilizar ``dobrasil.org``, especificar ``dobrasil.org``.
  1164. Arquivo de Controle
  1165. ~~~~~~~~~~~~~~~~~~~
  1166. aria2 utiliza um arquivo de controle para rastrear o progresso
  1167. de um download. Este arquivo é gravado no mesmo diretório do
  1168. arquivo que está sendo baixado e possui o sufixo ``.aria2``.
  1169. Por exemplo,se está baixando arquivo.zip, então o arquivo de controle
  1170. será arquivo.zip.aria2. (Existe apenas uma exceção para essa convenção
  1171. que é quando você está baixando um multi torrent, o arquivo de controle
  1172. estará no "diretório topo" do torrent com o sufixo ``.aria2``. O nome do
  1173. "diretório topo" é o valor da chave "name" no diretório "info" do arquivo
  1174. torrent).
  1175. Normalmente um arquivo controle é apagado quando o download se completa. Se
  1176. aria2 detecta que o download não pode ser retomado (por exemplo, quando faz
  1177. download de um servidor HTTP que não suporta retomar o processamento de um
  1178. ponto mas sempre do início), o arquivo de controle não será criado.
  1179. Se você perder o arquivo de controle, não será possivel retomar o download do
  1180. ponto onde estava. Mas se há um torrent ou metalink com checksum (verificação) do
  1181. arquivo, poderá ser retomado do último ponto especificando a opção -V na linha
  1182. de comando.
  1183. Arquivo de Entrada
  1184. ~~~~~~~~~~~~~~~~~~
  1185. O arquivo de entrada pode conter uma lista de URIs para que o aria2 efetua
  1186. download. Podem ser especificados múltiplas URIs para cada simples entidade:
  1187. separar as entidades por um caracter TAB ou espaço.
  1188. Cada linha é tratada como se fosse especificada através de um argumento da linha
  1189. de comando. Entretando estas linhas são afetadas pela opção
  1190. :option:`--force-sequential <-Z>` e pela opção :option:`--parameterized-uri <-P>`
  1191. Quando as URIs do arquivo de entrada são diretamente lidas pelo aria2, as URIs
  1192. não precisam necessáriamente estarem delimitadas por apóstrofo (``'``) nem
  1193. aspas(``"``).
  1194. Linhas que começam com ``#`` são tratadas como comentário e desprezadas.
  1195. Adicionalmente, as seguintes opções podem ser especificadas após cada linha de
  1196. URI. Estas linhas opcionais precisam iniciar com um ou mais espaços.
  1197. .. hlist::
  1198. :columns: 3
  1199. * :option:`all-proxy <--all-proxy>`
  1200. * :option:`all-proxy-passwd <--all-proxy-passwd>`
  1201. * :option:`all-proxy-user <--all-proxy-user>`
  1202. * :option:`allow-overwrite <--allow-overwrite>`
  1203. * :option:`allow-piece-length-change <--allow-piece-length-change>`
  1204. * :option:`always-resume <--always-resume>`
  1205. * :option:`async-dns <--async-dns>`
  1206. * :option:`auto-file-renaming <--auto-file-renaming>`
  1207. * :option:`bt-enable-lpd <--bt-enable-lpd>`
  1208. * :option:`bt-exclude-tracker <--bt-exclude-tracker>`
  1209. * :option:`bt-external-ip <--bt-external-ip>`
  1210. * :option:`bt-hash-check-seed <--bt-hash-check-seed>`
  1211. * :option:`bt-max-open-files <--bt-max-open-files>`
  1212. * :option:`bt-max-peers <--bt-max-peers>`
  1213. * :option:`bt-metadata-only <--bt-metadata-only>`
  1214. * :option:`bt-min-crypto-level <--bt-min-crypto-level>`
  1215. * :option:`bt-prioritize-piece <--bt-prioritize-piece>`
  1216. * :option:`bt-remove-unselected-file <--bt-remove-unselected-file>`
  1217. * :option:`bt-request-peer-speed-limit <--bt-request-peer-speed-limit>`
  1218. * :option:`bt-require-crypto <--bt-require-crypto>`
  1219. * :option:`bt-save-metadata <--bt-save-metadata>`
  1220. * :option:`bt-seed-unverified <--bt-seed-unverified>`
  1221. * :option:`bt-stop-timeout <--bt-stop-timeout>`
  1222. * :option:`bt-tracker <--bt-tracker>`
  1223. * :option:`bt-tracker-connect-timeout <--bt-tracker-connect-timeout>`
  1224. * :option:`bt-tracker-interval <--bt-tracker-interval>`
  1225. * :option:`bt-tracker-timeout <--bt-tracker-timeout>`
  1226. * :option:`check-integrity <-V>`
  1227. * :option:`checksum <--checksum>`
  1228. * :option:`conditional-get <--conditional-get>`
  1229. * :option:`connect-timeout <--connect-timeout>`
  1230. * :option:`continue <-c>`
  1231. * :option:`dir <-d>`
  1232. * :option:`dry-run <--dry-run>`
  1233. * :option:`enable-async-dns6 <--enable-async-dns6>`
  1234. * :option:`enable-http-keep-alive <--enable-http-keep-alive>`
  1235. * :option:`enable-http-pipelining <--enable-http-pipelining>`
  1236. * :option:`enable-mmap <--enable-mmap>`
  1237. * :option:`enable-peer-exchange <--enable-peer-exchange>`
  1238. * :option:`file-allocation <--file-allocation>`
  1239. * :option:`follow-metalink <--follow-metalink>`
  1240. * :option:`follow-torrent <--follow-torrent>`
  1241. * :option:`ftp-passwd <--ftp-passwd>`
  1242. * :option:`ftp-pasv <-p>`
  1243. * :option:`ftp-proxy <--ftp-proxy>`
  1244. * :option:`ftp-proxy-passwd <--ftp-proxy-passwd>`
  1245. * :option:`ftp-proxy-user <--ftp-proxy-user>`
  1246. * :option:`ftp-reuse-connection <--ftp-reuse-connection>`
  1247. * :option:`ftp-type <--ftp-type>`
  1248. * :option:`ftp-user <--ftp-user>`
  1249. * :option:`hash-check-only <--hash-check-only>`
  1250. * :option:`header <--header>`
  1251. * :option:`http-accept-gzip <--http-accept-gzip>`
  1252. * :option:`http-auth-challenge <--http-auth-challenge>`
  1253. * :option:`http-no-cache <--http-no-cache>`
  1254. * :option:`http-passwd <--http-passwd>`
  1255. * :option:`http-proxy <--http-proxy>`
  1256. * :option:`http-proxy-passwd <--http-proxy-passwd>`
  1257. * :option:`http-proxy-user <--http-proxy-user>`
  1258. * :option:`http-user <--http-user>`
  1259. * :option:`https-proxy <--https-proxy>`
  1260. * :option:`https-proxy-passwd <--https-proxy-passwd>`
  1261. * :option:`https-proxy-user <--https-proxy-user>`
  1262. * :option:`index-out <-O>`
  1263. * :option:`lowest-speed-limit <--lowest-speed-limit>`
  1264. * :option:`max-connection-per-server <-x>`
  1265. * :option:`max-download-limit <--max-download-limit>`
  1266. * :option:`max-file-not-found <--max-file-not-found>`
  1267. * :option:`max-resume-failure-tries <--max-resume-failure-tries>`
  1268. * :option:`max-tries <-m>`
  1269. * :option:`max-upload-limit <-u>`
  1270. * :option:`metalink-base-uri <--metalink-base-uri>`
  1271. * :option:`metalink-enable-unique-protocol <--metalink-enable-unique-protocol>`
  1272. * :option:`metalink-language <--metalink-language>`
  1273. * :option:`metalink-location <--metalink-location>`
  1274. * :option:`metalink-os <--metalink-os>`
  1275. * :option:`metalink-preferred-protocol <--metalink-preferred-protocol>`
  1276. * :option:`metalink-version <--metalink-version>`
  1277. * :option:`min-split-size <-k>`
  1278. * :option:`no-file-allocation-limit <--no-file-allocation-limit>`
  1279. * :option:`no-netrc <-n>`
  1280. * :option:`no-proxy <--no-proxy>`
  1281. * :option:`out <-o>`
  1282. * :option:`parameterized-uri <-P>`
  1283. * :option:`pause <--pause>`
  1284. * :option:`piece-length <--piece-length>`
  1285. * :option:`proxy-method <--proxy-method>`
  1286. * :option:`realtime-chunk-checksum <--realtime-chunk-checksum>`
  1287. * :option:`referer <--referer>`
  1288. * :option:`remote-time <-R>`
  1289. * :option:`remove-control-file <--remove-control-file>`
  1290. * :option:`retry-wait <--retry-wait>`
  1291. * :option:`reuse-uri <--reuse-uri>`
  1292. * :option:`seed-ratio <--seed-ratio>`
  1293. * :option:`seed-time <--seed-time>`
  1294. * :option:`select-file <--select-file>`
  1295. * :option:`split <-s>`
  1296. * :option:`stream-piece-selector <--stream-piece-selector>`
  1297. * :option:`timeout <-t>`
  1298. * :option:`uri-selector <--uri-selector>`
  1299. * :option:`use-head <--use-head>`
  1300. * :option:`user-agent <-U>`
  1301. Estas opções possuem exatamente o mesmo significado das opções existentes na
  1302. linha de comando, mas aplicam-se apenas a URI a que pertencem.
  1303. Por favor perceba que dentro de um arquivo, elas não terão o prefixo ``--``.
  1304. Por exemplo, o conteúdo do arquivo uri.txt é::
  1305. http://servidor/arquivo.iso http://espelho/arquivo.iso
  1306. dir=/imagens_iso
  1307. out=arquivo.img
  1308. http://fu/ba
  1309. Se aria2 é executado com as opções ``-i uri.txt -d /tmp``, então
  1310. ``arquivo.iso`` será salvo como ``/imagens_iso/arquivo.img`` e será baixado
  1311. de \http://servidor/arquivo.iso e \http://espelho/arquivo.iso. O arquivo
  1312. ``ba`` e baixado de \http://fu/ba e salvo como ``/tmp/ba``.
  1313. Em alguns casos, o parâmetro :option:`out <-o>` não tem efeito.
  1314. Ver nota da opção :option:`--out <-o>` para entender as restrições.
  1315. Perfil Performance Servidor
  1316. ~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1317. Esta seção descreve o formato do perfil de performance do servidor, composto
  1318. por um arquivo de texto plano com cada linha contendo um par ``NOME=VALOR``,
  1319. delimitados por virgula. Atualmente esta é a lista de nomes reconhecidos:
  1320. ``host``
  1321. Nome do servidor. Requerido.
  1322. ``protocol``
  1323. Protocolo para este perfil, como ftp, http, https. http é requerido.
  1324. ``dl_speed``
  1325. Velocidade média de download observada no download prévio, em bytes por
  1326. segundo. Requerido.
  1327. ``sc_avg_speed``
  1328. The average download speed observed in the previous download in
  1329. bytes per sec. This value is only updated if the download is done in
  1330. single connection environment and only used by
  1331. AdaptiveURISelector. Optional.
  1332. ``mc_avg_speed``
  1333. The average download speed observed in the previous download in
  1334. bytes per sec. This value is only updated if the download is done in
  1335. multi connection environment and only used by
  1336. AdaptiveURISelector. Optional.
  1337. ``counter``
  1338. How many times the server is used. Currently this value is only used
  1339. by AdaptiveURISelector. Optional.
  1340. ``last_updated``
  1341. Last contact time in GMT with this server, specified in the seconds
  1342. since the Epoch(00:00:00 on January 1, 1970, UTC). Required.
  1343. ``status``
  1344. ERROR is set when server cannot be reached or out-of-service or
  1345. timeout occurred. Otherwise, OK is set.
  1346. Those fields must exist in one line. The order of the fields is not
  1347. significant. You can put pairs other than the above; they are simply
  1348. ignored.
  1349. An example follows::
  1350. host=localhost, protocol=http, dl_speed=32000, last_updated=1222491640, status=OK
  1351. host=localhost, protocol=ftp, dl_speed=0, last_updated=1222491632, status=ERROR
  1352. INTERFACE RPC
  1353. -------------
  1354. aria2 provê o serviço JSON-RPC sobre HTTP e XML-RPC sobre HTTP e eles
  1355. basicamente possuem a mesma funcionalidade. aria2 também provê JSON-RPC
  1356. sobre WebSocket o qual utiliza o mesmo formato do método e assinatura e
  1357. resposta do formato JSON-RPC sobre HTTP, mas adicionalmente possui notificações
  1358. iniciadas pelo servidor. Ver detalhes na seção `JSON-RPC sobre WebSocket`_ .
  1359. O caminho requisitado do interface JSON-RPC (para ambos sobre HTTP e sobre
  1360. WebSocket) é ``/jsonrpc``. O caminho requisitado do interface XML-RPC é
  1361. ``/rpc``.
  1362. A URI WebSocket para JSON-RPC sobre WebSocket é ``ws://HOST:PORT/jsonrpc``.
  1363. A implementação JSON-RPC é baseada na especificação
  1364. JSON-RPC 2.0 <http://jsonrpc.org/specification>, e suporta
  1365. HTTP POST e GET (JSONP). Usando WebSocket como transporte é uma extensão
  1366. original do aria2.
  1367. A interface JSON-RPC não suporta notificação em HTTP, mas o servidor RPC irá
  1368. RPC enviar a notificação no WebSocket. Não é suportado número ponto flutuante
  1369. O codificação de página deve ser UTF-8.
  1370. Quanto a seguinte documentação do JSON-RPC, entenda estrutura JSON como objeto.
  1371. Terminologia
  1372. ~~~~~~~~~~~~
  1373. GID
  1374. GID(or gid) é a chave para gerenciar cada download. Cada download tem um
  1375. único GID. Atualmente GID é um inteiro, mas não trate como inteiro pois
  1376. isto pode ser modificado em versões futuras.
  1377. Note que o GID é uma sessão local e o GID não será persistido quando o
  1378. aria2 for encerrado.
  1379. Métodos
  1380. ~~~~~~~
  1381. São descritos em torno de 20 exemplos utilizando código fonte
  1382. com exemplos que usam interpretador Python2.7.
  1383. .. function:: aria2.addUri(uris[, options[, position]])
  1384. Esse método adiciona nova URI HTTP, HTTPS, FTP, BitTorrent Magnet. *uris* é
  1385. do tipo array e seus elementos são URI que são do tipo string. Para
  1386. BitTorrent Magnet URI, *uris* precisa ter só um elemente e deve ser
  1387. BitTorrent Magnet URI. URIs em *uris* precisam apontar para o mesmo arquivo.
  1388. If you mix other URIs which point to another file, aria2 does not
  1389. complain but download may fail. *options* is of type struct and its
  1390. members are a pair of option name and value. See :ref:`rpc_options` below for
  1391. more details. If *position* is given as an integer starting from 0,
  1392. the new download is inserted at *position* in the waiting queue. If
  1393. *position* is not given or *position* is larger than the size of the
  1394. queue, it is appended at the end of the queue. This method returns
  1395. GID of registered download.
  1396. **Exemplo 0 JSON-RPC**
  1397. The following example adds \http://example.org/file to aria2::
  1398. >>> import urllib2, json
  1399. >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
  1400. ... 'method':'aria2.addUri',
  1401. ... 'params':[['http://example.org/file']]})
  1402. >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
  1403. >>> c.read()
  1404. '{"id":"qwer","jsonrpc":"2.0","result":"1"}'
  1405. **Exemplo 0 XML-RPC**
  1406. The following example adds \http://example.org/file to aria2::
  1407. >>> import xmlrpclib
  1408. >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
  1409. >>> s.aria2.addUri(['http://example.org/file'])
  1410. '1'
  1411. The following example adds 2 sources and some options::
  1412. >>> s.aria2.addUri(['http://example.org/file', 'http://mirror/file'],
  1413. dict(dir="/tmp"))
  1414. '2'
  1415. The following example adds a download and insert it to the front of
  1416. waiting downloads::
  1417. >>> s.aria2.addUri(['http://example.org/file'], {}, 0)
  1418. '3'
  1419. .. function:: aria2.addTorrent(torrent[, uris[, options[, position]]])
  1420. This method adds BitTorrent download by uploading ".torrent" file. If
  1421. you want to add BitTorrent Magnet URI, use :func:`aria2.addUri` method
  1422. instead. *torrent* is of type base64 which contains Base64-encoded
  1423. ".torrent" file. *uris* is of type array and its element is URI which
  1424. is of type string. *uris* is used for Web-seeding. For single file
  1425. torrents, URI can be a complete URI pointing to the resource or if URI
  1426. ends with /, name in torrent file is added. For multi-file torrents,
  1427. name and path in torrent are added to form a URI for each file.
  1428. *options* is of type struct and its members are a pair of option name
  1429. and value. See :ref:`rpc_options` below for more details. If *position* is
  1430. given as an integer starting from 0, the new download is inserted at
  1431. *position* in the waiting queue. If *position* is not given or
  1432. *position* is larger than the size of the queue, it is appended at the
  1433. end of the queue. This method returns GID of registered download.
  1434. The uploaded data is saved as a file named hex string of SHA-1 hash of data
  1435. plus ".torrent" in the directory specified by :option:`--dir <-d>`
  1436. option.
  1437. The example of filename is 0a3893293e27ac0490424c06de4d09242215f0a6.torrent.
  1438. If same file already exists, it is overwritten.
  1439. If the file cannot be saved successfully,
  1440. the downloads added by this method are not saved by
  1441. :option:`--save-session`.
  1442. **Exemplo 1 JSON-RPC**
  1443. The following example adds local file file.torrent to aria2::
  1444. >>> import urllib2, json, base64
  1445. >>> torrent = base64.b64encode(open('file.torrent').read())
  1446. >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'asdf',
  1447. ... 'method':'aria2.addTorrent', 'params':[torrent]})
  1448. >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
  1449. >>> c.read()
  1450. '{"id":"asdf","jsonrpc":"2.0","result":"6"}'
  1451. **Exemplo 1 XML-RPC**
  1452. The following example adds local file file.torrent to aria2::
  1453. >>> import xmlrpclib
  1454. >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
  1455. >>> s.aria2.addTorrent(xmlrpclib.Binary(open('file.torrent').read()))
  1456. '6'
  1457. .. function:: aria2.addMetalink(metalink[, options[, position]])
  1458. This method adds Metalink download by uploading ".metalink" file.
  1459. *metalink* is of type base64 which contains Base64-encoded ".metalink"
  1460. file. *options* is of type struct and its members are a pair of
  1461. option name and value. See :ref:`rpc_options` below for more details. If
  1462. *position* is given as an integer starting from 0, the new download is
  1463. inserted at *position* in the waiting queue. If *position* is not
  1464. given or *position* is larger than the size of the queue, it is
  1465. appended at the end of the queue. This method returns array of GID of
  1466. registered download.
  1467. The uploaded data is saved as a file named hex string of SHA-1 hash of data
  1468. plus ".metalink" in the directory specified by :option:`--dir <-d>`
  1469. option.
  1470. The example of filename is 0a3893293e27ac0490424c06de4d09242215f0a6.metalink.
  1471. If same file already exists, it is overwritten.
  1472. If the file cannot be saved successfully,
  1473. the downloads added by this method are not saved by
  1474. :option:`--save-session`.
  1475. **Exemplo 2 JSON-RPC**
  1476. The following example adds local file file.meta4 to aria2::
  1477. >>> import urllib2, json, base64
  1478. >>> metalink = base64.b64encode(open('file.meta4').read())
  1479. >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
  1480. ... 'method':'aria2.addMetalink', 'params':[metalink]})
  1481. >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
  1482. >>> c.read()
  1483. '{"id":"qwer","jsonrpc":"2.0","result":["8"]}'
  1484. **Exemplo 2 XML-RPC**
  1485. The following example adds local file file.meta4 to aria2::
  1486. >>> import xmlrpclib
  1487. >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
  1488. >>> s.aria2.addMetalink(xmlrpclib.Binary(open('file.meta4').read()))
  1489. ['8']
  1490. .. function:: aria2.remove(gid)
  1491. This method removes the download denoted by *gid*. *gid* is of type
  1492. string. If specified download is in progress, it is stopped at
  1493. first. The status of removed download becomes ``"removed"``. This method
  1494. returns GID of removed download.
  1495. **Exemplo 3 JSON-RPC**
  1496. The following example removes download whose GID is "3"::
  1497. >>> import urllib2, json
  1498. >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
  1499. ... 'method':'aria2.remove', 'params':['3']})
  1500. >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
  1501. >>> c.read()
  1502. '{"id":"qwer","jsonrpc":"2.0","result":"3"}'
  1503. **Exemplo 3 XML-RPC**
  1504. The following example removes download whose GID is "3"::
  1505. >>> import xmlrpclib
  1506. >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
  1507. >>> s.aria2.remove('3')
  1508. '3'
  1509. .. function:: aria2.forceRemove(gid)
  1510. This method removes the download denoted by *gid*. This method
  1511. behaves just like :func:`aria2.remove` except that this method removes
  1512. download without any action which takes time such as contacting
  1513. BitTorrent tracker.
  1514. .. function:: aria2.pause(gid)
  1515. This method pauses the download denoted by *gid*. *gid* is of type
  1516. string. The status of paused download becomes ``"paused"``. If the
  1517. download is active, the download is placed on the first position of
  1518. waiting queue. As long as the status is ``"paused"``, the download is not
  1519. started. To change status to ``"waiting"``, use :func:`aria2.unpause` method.
  1520. This method returns GID of paused download.
  1521. .. function:: aria2.pauseAll()
  1522. This method is equal to calling :func:`aria2.pause` for every active/waiting
  1523. download. This methods returns ``"OK"`` for success.
  1524. .. function:: aria2.forcePause(pid)
  1525. This method pauses the download denoted by *gid*. This method
  1526. behaves just like :func:`aria2.pause` except that this method pauses
  1527. download without any action which takes time such as contacting
  1528. BitTorrent tracker.
  1529. .. function:: aria2.forcePauseAll()
  1530. This method is equal to calling :func:`aria2.forcePause` for every
  1531. active/waiting download. This methods returns ``"OK"`` for success.
  1532. .. function:: aria2.unpause(gid)
  1533. This method changes the status of the download denoted by *gid* from
  1534. ``"paused"`` to ``"waiting"``. This makes the download eligible to restart.
  1535. *gid* is of type string. This method returns GID of unpaused
  1536. download.
  1537. .. function:: aria2.unpauseAll()
  1538. This method is equal to calling :func:`aria2.unpause` for every active/waiting
  1539. download. This methods returns ``"OK"`` for success.
  1540. .. function:: aria2.tellStatus(gid[, keys])
  1541. This method returns download progress of the download denoted by
  1542. *gid*. *gid* is of type string. *keys* is array of string. If it is
  1543. specified, the response contains only keys in *keys* array. If *keys*
  1544. is empty or not specified, the response contains all keys. This is
  1545. useful when you just want specific keys and avoid unnecessary
  1546. transfers. For example, ``aria2.tellStatus("1", ["gid", "status"])``
  1547. returns *gid* and 'status' key. The response is of type struct and it
  1548. contains following keys. The value type is string.
  1549. ``gid``
  1550. GID of this download.
  1551. ``status``
  1552. ``"active"`` for currently downloading/seeding entry. ``"waiting"`` for the
  1553. entry in the queue; download is not started. ``"paused"`` for the
  1554. paused entry. ``"error"`` for the stopped download because of
  1555. error. ``"complete"`` for the stopped and completed download. ``"removed"``
  1556. for the download removed by user.
  1557. ``totalLength``
  1558. Total length of this download in bytes.
  1559. ``completedLength``
  1560. Completed length of this download in bytes.
  1561. ``uploadLength``
  1562. Uploaded length of this download in bytes.
  1563. ``bitfield``
  1564. Hexadecimal representation of the download progress. The highest bit
  1565. corresponds to piece index 0. The set bits indicate the piece is
  1566. available and unset bits indicate the piece is missing. The spare
  1567. bits at the end are set to zero. When download has not started yet,
  1568. this key will not be included in the response.
  1569. ``downloadSpeed``
  1570. Download speed of this download measured in bytes/sec.
  1571. ``uploadSpeed``
  1572. Upload speed of this download measured in bytes/sec.
  1573. ``infoHash``
  1574. InfoHash. BitTorrent only.
  1575. ``numSeeders``
  1576. The number of seeders the client has connected to. BitTorrent only.
  1577. ``pieceLength``
  1578. Piece length in bytes.
  1579. ``numPieces``
  1580. The number of pieces.
  1581. ``connections``
  1582. The number of peers/servers the client has connected to.
  1583. ``errorCode``
  1584. The last error code occurred in this download. The value is of type
  1585. string. The error codes are defined in `CÓDIGO DE RETORNO`_ section.
  1586. This value is only available for stopped/completed downloads.
  1587. ``followedBy``
  1588. List of GIDs which are generated by the consequence of this
  1589. download. For example, when aria2 downloaded Metalink file, it
  1590. generates downloads described in it(see :option:`--follow-metalink`
  1591. option). This value is useful to track these auto generated
  1592. downloads. If there is no such downloads, this key will not
  1593. be included in the response.
  1594. ``belongsTo``
  1595. GID of a parent download. Some downloads are a part of another
  1596. download. For example, if a file in Metalink has BitTorrent
  1597. resource, the download of ".torrent" is a part of that file. If this
  1598. download has no parent, this key will not be included in the
  1599. response.
  1600. ``dir``
  1601. Directory to save files. This key is not available for stopped
  1602. downloads.
  1603. ``files``
  1604. Returns the list of files. The element of list is the same struct
  1605. used in :func:`aria2.getFiles` method.
  1606. ``bittorrent``
  1607. Struct which contains information retrieved from .torrent
  1608. file. BitTorrent only. It contains following keys.
  1609. ``announceList``
  1610. List of lists of announce URI. If ".torrent" file contains announce
  1611. and no announce-list, announce is converted to announce-list
  1612. format.
  1613. ``comment``
  1614. The comment for the torrent. comment.utf-8 is used if available.
  1615. ``creationDate``
  1616. The creation time of the torrent. The value is an integer since
  1617. the Epoch, measured in seconds.
  1618. ``mode``
  1619. File mode of the torrent. The value is either 'single' or 'multi'.
  1620. ``info``
  1621. Struct which contains data from Info dictionary. It contains
  1622. following keys.
  1623. ``name``
  1624. name in info dictionary. name.utf-8 is used if available.
  1625. **Exemplo 4 JSON-RPC**
  1626. The following example gets information about download whose GID is
  1627. "1"::
  1628. >>> import urllib2, json
  1629. >>> from pprint import pprint
  1630. >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
  1631. ... 'method':'aria2.tellStatus', 'params':['1']})
  1632. >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
  1633. >>> pprint(json.loads(c.read()))
  1634. {u'id': u'qwer',
  1635. u'jsonrpc': u'2.0',
  1636. u'result': {u'bitfield': u'0000000000',
  1637. u'completedLength': u'901120',
  1638. u'connections': u'1',
  1639. u'dir': u'/downloads',
  1640. u'downloadSpeed': u'15158',
  1641. u'files': [{u'index': u'1',
  1642. u'length': u'34896138',
  1643. u'completedLength': u'34896138',
  1644. u'path': u'/downloads/file',
  1645. u'selected': u'true',
  1646. u'uris': [{u'status': u'used',
  1647. u'uri': u'http://example.org/file'}]}],
  1648. u'gid': u'1',
  1649. u'numPieces': u'34',
  1650. u'pieceLength': u'1048576',
  1651. u'status': u'active',
  1652. u'totalLength': u'34896138',
  1653. u'uploadLength': u'0',
  1654. u'uploadSpeed': u'0'}}
  1655. The following example gets information specifying keys you are
  1656. interested in::
  1657. >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
  1658. ... 'method':'aria2.tellStatus',
  1659. ... 'params':['1', ['gid',
  1660. ... 'totalLength',
  1661. ... 'completedLength']]})
  1662. >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
  1663. >>> pprint(json.loads(c.read()))
  1664. {u'id': u'qwer',
  1665. u'jsonrpc': u'2.0',
  1666. u'result': {u'completedLength': u'5701632',
  1667. u'gid': u'1',
  1668. u'totalLength': u'34896138'}}
  1669. **Exemplo 4 XML-RPC**
  1670. The following example gets information about download whose GID is
  1671. "1"::
  1672. >>> import xmlrpclib
  1673. >>> from pprint import pprint
  1674. >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
  1675. >>> r = s.aria2.tellStatus('1')
  1676. >>> pprint(r)
  1677. {'bitfield': 'ffff80',
  1678. 'completedLength': '34896138',
  1679. 'connections': '0',
  1680. 'dir': '/downloads',
  1681. 'downloadSpeed': '0',
  1682. 'errorCode': '0',
  1683. 'files': [{'index': '1',
  1684. 'length': '34896138',
  1685. 'completedLength': '34896138',
  1686. 'path': '/downloads/file',
  1687. 'selected': 'true',
  1688. 'uris': [{'status': 'used',
  1689. 'uri': 'http://example.org/file'}]}],
  1690. 'gid': '1',
  1691. 'numPieces': '17',
  1692. 'pieceLength': '2097152',
  1693. 'status': 'complete',
  1694. 'totalLength': '34896138',
  1695. 'uploadLength': '0',
  1696. 'uploadSpeed': '0'}
  1697. The following example gets information specifying keys you are
  1698. interested in::
  1699. >>> r = s.aria2.tellStatus('1', ['gid', 'totalLength', 'completedLength'])
  1700. >>> pprint(r)
  1701. {'completedLength': '34896138', 'gid': '1', 'totalLength': '34896138'}
  1702. .. function:: aria2.getUris(gid)
  1703. This method returns URIs used in the download denoted by *gid*. *gid*
  1704. is of type string. The response is of type array and its element is of
  1705. type struct and it contains following keys. The value type is string.
  1706. ``uri``
  1707. URI
  1708. ``status``
  1709. 'used' if the URI is already used. 'waiting' if the URI is waiting
  1710. in the queue.
  1711. **Exemplo 5 JSON-RPC**
  1712. ::
  1713. >>> import urllib2, json
  1714. >>> from pprint import pprint
  1715. >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
  1716. ... 'method':'aria2.getUris', 'params':['1']})
  1717. >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
  1718. >>> pprint(json.loads(c.read()))
  1719. {u'id': u'qwer',
  1720. u'jsonrpc': u'2.0',
  1721. u'result': [{u'status': u'used',
  1722. u'uri': u'http://example.org/file'}]}
  1723. **Exemplo 5 XML-RPC**
  1724. ::
  1725. >>> import xmlrpclib
  1726. >>> from pprint import pprint
  1727. >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
  1728. >>> r = s.aria2.getUris('1')
  1729. >>> pprint(r)
  1730. [{'status': 'used', 'uri': 'http://example.org/file'}]
  1731. .. function:: aria2.getFiles(gid)
  1732. This method returns file list of the download denoted by *gid*. *gid*
  1733. is of type string. The response is of type array and its element is of
  1734. type struct and it contains following keys. The value type is string.
  1735. ``index``
  1736. Index of file. Starting with 1. This is the same order with the
  1737. files in multi-file torrent.
  1738. ``path``
  1739. File path.
  1740. ``length``
  1741. File size in bytes.
  1742. ``completedLength``
  1743. Completed length of this file in bytes. Please note that it is
  1744. possible that sum of completedLength is less than completedLength in
  1745. :func:`aria2.tellStatus` method.
  1746. This is because completedLength in
  1747. :func:`aria2.getFiles`
  1748. only calculates completed pieces. On the other hand, completedLength
  1749. in
  1750. :func:`aria2.tellStatus` takes into account
  1751. of partially completed piece.
  1752. ``selected``
  1753. ``"true"`` if this file is selected by :option:`--select-file` option. If
  1754. :option:`--select-file` is not specified or this is single torrent or no
  1755. torrent download, this value is always ``"true"``. Otherwise ``"false"``.
  1756. ``uris``
  1757. Returns the list of URI for this file. The element of list is the
  1758. same struct used in :func:`aria2.getUris` method.
  1759. **Exemplo 6 JSON-RPC**
  1760. ::
  1761. >>> import urllib2, json
  1762. >>> from pprint import pprint
  1763. >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
  1764. ... 'method':'aria2.getFiles', 'params':['1']})
  1765. >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
  1766. >>> pprint(json.loads(c.read()))
  1767. {u'id': u'qwer',
  1768. u'jsonrpc': u'2.0',
  1769. u'result': [{u'index': u'1',
  1770. u'length': u'34896138',
  1771. u'completedLength': u'34896138',
  1772. u'path': u'/downloads/file',
  1773. u'selected': u'true',
  1774. u'uris': [{u'status': u'used',
  1775. u'uri': u'http://example.org/file'}]}]}
  1776. **Exemplo 6 XML-RPC**
  1777. ::
  1778. >>> import xmlrpclib
  1779. >>> from pprint import pprint
  1780. >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
  1781. >>> r = s.aria2.getFiles('1')
  1782. >>> pprint(r)
  1783. [{'index': '1',
  1784. 'length': '34896138',
  1785. 'completedLength': '34896138',
  1786. 'path': '/downloads/file',
  1787. 'selected': 'true',
  1788. 'uris': [{'status': 'used',
  1789. 'uri': 'http://example.org/file'}]}]
  1790. .. function:: aria2.getPeers(gid)
  1791. This method returns peer list of the download denoted by *gid*. *gid*
  1792. is of type string. This method is for BitTorrent only. The response
  1793. is of type array and its element is of type struct and it contains
  1794. following keys. The value type is string.
  1795. ``peerId``
  1796. Percent-encoded peer ID.
  1797. ``ip``
  1798. IP address of the peer.
  1799. ``port``
  1800. Port number of the peer.
  1801. ``bitfield``
  1802. Hexadecimal representation of the download progress of the peer. The
  1803. highest bit corresponds to piece index 0. The set bits indicate the
  1804. piece is available and unset bits indicate the piece is missing. The
  1805. spare bits at the end are set to zero.
  1806. ``amChoking``
  1807. ``"true"`` if this client is choking the peer. Otherwise ``"false"``.
  1808. ``peerChoking``
  1809. ``"true"`` if the peer is choking this client. Otherwise ``"false"``.
  1810. ``downloadSpeed``
  1811. Download speed (byte/sec) that this client obtains from the peer.
  1812. ``uploadSpeed``
  1813. Upload speed(byte/sec) that this client uploads to the peer.
  1814. ``seeder``
  1815. ``"true"`` is this client is a seeder. Otherwise ``"false"``.
  1816. **Exemplo 7 JSON-RPC**
  1817. ::
  1818. >>> import urllib2, json
  1819. >>> from pprint import pprint
  1820. >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
  1821. ... 'method':'aria2.getPeers', 'params':['1']})
  1822. >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
  1823. >>> pprint(json.loads(c.read()))
  1824. {u'id': u'qwer',
  1825. u'jsonrpc': u'2.0',
  1826. u'result': [{u'amChoking': u'true',
  1827. u'bitfield': u'ffffffffffffffffffffffffffffffffffffffff',
  1828. u'downloadSpeed': u'10602',
  1829. u'ip': u'10.0.0.9',
  1830. u'peerChoking': u'false',
  1831. u'peerId': u'aria2%2F1%2E10%2E5%2D%87%2A%EDz%2F%F7%E6',
  1832. u'port': u'6881',
  1833. u'seeder': u'true',
  1834. u'uploadSpeed': u'0'},
  1835. {u'amChoking': u'false',
  1836. u'bitfield': u'ffffeff0fffffffbfffffff9fffffcfff7f4ffff',
  1837. u'downloadSpeed': u'8654',
  1838. u'ip': u'10.0.0.30',
  1839. u'peerChoking': u'false',
  1840. u'peerId': u'bittorrent client758',
  1841. u'port': u'37842',
  1842. u'seeder': u'false',
  1843. u'uploadSpeed': u'6890'}]}
  1844. **Exemplo 7 XML-RPC**
  1845. ::
  1846. >>> import xmlrpclib
  1847. >>> from pprint import pprint
  1848. >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
  1849. >>> r = s.aria2.getPeers('1')
  1850. >>> pprint(r)
  1851. [{'amChoking': 'true',
  1852. 'bitfield': 'ffffffffffffffffffffffffffffffffffffffff',
  1853. 'downloadSpeed': '10602',
  1854. 'ip': '10.0.0.9',
  1855. 'peerChoking': 'false',
  1856. 'peerId': 'aria2%2F1%2E10%2E5%2D%87%2A%EDz%2F%F7%E6',
  1857. 'port': '6881',
  1858. 'seeder': 'true',
  1859. 'uploadSpeed': '0'},
  1860. {'amChoking': 'false',
  1861. 'bitfield': 'ffffeff0fffffffbfffffff9fffffcfff7f4ffff',
  1862. 'downloadSpeed': '8654',
  1863. 'ip': '10.0.0.30',
  1864. 'peerChoking': 'false',
  1865. 'peerId': 'bittorrent client758',
  1866. 'port': '37842',
  1867. 'seeder': 'false,
  1868. 'uploadSpeed': '6890'}]
  1869. .. function:: aria2.getServers(gid)
  1870. This method returns currently connected HTTP, HTTPS e FTP servers of the download denoted by *gid*. *gid* is of type string. The response
  1871. is of type array and its element is of type struct and it contains
  1872. following keys. The value type is string.
  1873. ``index``
  1874. Index of file. Starting with 1. This is the same order with the
  1875. files in multi-file torrent.
  1876. ``servers``
  1877. The list of struct which contains following keys.
  1878. ``uri``
  1879. URI originally added.
  1880. ``currentUri``
  1881. This is the URI currently used for downloading. If redirection is
  1882. involved, currentUri and uri may differ.
  1883. ``downloadSpeed``
  1884. Download speed (byte/sec)
  1885. **Exemplo 8 JSON-RPC**
  1886. ::
  1887. >>> import urllib2, json
  1888. >>> from pprint import pprint
  1889. >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
  1890. ... 'method':'aria2.getServers', 'params':['1']})
  1891. >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
  1892. >>> pprint(json.loads(c.read()))
  1893. {u'id': u'qwer',
  1894. u'jsonrpc': u'2.0',
  1895. u'result': [{u'index': u'1',
  1896. u'servers': [{u'currentUri': u'http://example.org/file',
  1897. u'downloadSpeed': u'10467',
  1898. u'uri': u'http://example.org/file'}]}]}
  1899. **Exemplo 8 XML-RPC**
  1900. ::
  1901. >>> import xmlrpclib
  1902. >>> from pprint import pprint
  1903. >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
  1904. >>> r = s.aria2.getServers('1')
  1905. >>> pprint(r)
  1906. [{'index': '1',
  1907. 'servers': [{'currentUri': 'http://example.org/dl/file',
  1908. 'downloadSpeed': '20285',
  1909. 'uri': 'http://example.org/file'}]}]
  1910. .. function:: aria2.tellActive([keys])
  1911. This method returns the list of active downloads. The response is of
  1912. type array and its element is the same struct returned by
  1913. :func:`aria2.tellStatus` method. For *keys* parameter, please refer to
  1914. :func:`aria2.tellStatus` method.
  1915. .. function:: aria2.tellWaiting(offset, num, [keys])
  1916. This method returns the list of waiting download, including paused
  1917. downloads. *offset* is of type integer and specifies the offset from
  1918. the download waiting at the front. *num* is of type integer and
  1919. specifies the number of downloads to be returned. For *keys*
  1920. parameter, please refer to :func:`aria2.tellStatus` method.
  1921. If *offset* is a positive integer, this method returns downloads in the
  1922. range of [*offset*, *offset* + *num*).
  1923. *offset* can be a negative integer. *offset* == -1 points last
  1924. download in the waiting queue and *offset* == -2 points the download
  1925. before the last download, and so on. The downloads in the response are
  1926. in reversed order.
  1927. For example, imagine that three downloads "A","B" and "C" are waiting
  1928. in this order. aria2.tellWaiting(0, 1) returns
  1929. ["A"]. aria2.tellWaiting(1, 2) returns ["B", "C"].
  1930. aria2.tellWaiting(-1, 2) returns ["C", "B"].
  1931. The response is of type array and its element is the same struct
  1932. returned by :func:`aria2.tellStatus` method.
  1933. .. function:: aria2.tellStopped(offset, num, [keys])
  1934. This method returns the list of stopped download. *offset* is of type
  1935. integer and specifies the offset from the oldest download. *num* is of
  1936. type integer and specifies the number of downloads to be returned.
  1937. For *keys* parameter, please refer to :func:`aria2.tellStatus` method.
  1938. *offset* and *num* have the same semantics as :func:`aria2.tellWaiting`
  1939. method.
  1940. The response is of type array and its element is the same struct
  1941. returned by :func:`aria2.tellStatus` method.
  1942. .. function:: aria2.changePosition(gid, pos, how)
  1943. This method changes the position of the download denoted by
  1944. *gid*. *pos* is of type integer. *how* is of type string. If *how* is
  1945. ``"POS_SET"``, it moves the download to a position relative to the
  1946. beginning of the queue. If *how* is ``"POS_CUR"``, it moves the download
  1947. to a position relative to the current position. If *how* is ``"POS_END"``,
  1948. it moves the download to a position relative to the end of the
  1949. queue. If the destination position is less than 0 or beyond the end of
  1950. the queue, it moves the download to the beginning or the end of the
  1951. queue respectively. The response is of type integer and it is the
  1952. destination position.
  1953. For example, if GID#1 is placed in position 3, ``aria2.changePosition('1',
  1954. -1, 'POS_CUR')`` will change its position to 2. Additional
  1955. ``aria2.changePosition('1', 0, 'POS_SET')`` will change its position to 0(the
  1956. beginning of the queue).
  1957. **Exemplo 9 JSON-RPC**
  1958. The following example moves the download whose GID is "3" to the
  1959. front of the waiting queue::
  1960. >>> import urllib2, json
  1961. >>> from pprint import pprint
  1962. >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
  1963. ... 'method':'aria2.changePosition',
  1964. ... 'params':['3', 0, 'POS_SET']})
  1965. >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
  1966. >>> pprint(json.loads(c.read()))
  1967. {u'id': u'qwer', u'jsonrpc': u'2.0', u'result': 0}
  1968. **Exemplo 9 XML-RPC**
  1969. The following example moves the download whose GID is "3" to the
  1970. front of the waiting queue::
  1971. >>> import xmlrpclib
  1972. >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
  1973. >>> s.aria2.changePosition('3', 0, 'POS_SET')
  1974. 0
  1975. .. function:: aria2.changeUri(gid, fileIndex, delUris, addUris[, position])
  1976. This method removes URIs in *delUris* from and appends URIs in
  1977. *addUris* to download denoted by *gid*. *delUris* and *addUris* are
  1978. list of string. A download can contain multiple files and URIs are
  1979. attached to each file. *fileIndex* is used to select which file to
  1980. remove/attach given URIs. *fileIndex* is 1-based. *position* is used
  1981. to specify where URIs are inserted in the existing waiting URI
  1982. list. *position* is 0-based. When *position* is omitted, URIs are
  1983. appended to the back of the list. This method first execute removal
  1984. and then addition. *position* is the position after URIs are removed,
  1985. not the position when this method is called. When removing URI, if
  1986. same URIs exist in download, only one of them is removed for each URI
  1987. in *delUris*. In other words, there are three URIs
  1988. ``http://example.org/aria2`` and you want remove them all, you have to
  1989. specify (at least) 3 ``http://example.org/aria2`` in *delUris*. This
  1990. method returns a list which contains 2 integers. The first integer is
  1991. the number of URIs deleted. The second integer is the number of URIs
  1992. added.
  1993. **Exemplo 10 JSON-RPC**
  1994. The following example adds 1 URI \http://example.org/file to the file
  1995. whose index is "1" and belongs to the download whose GID is "2"::
  1996. >>> import urllib2, json
  1997. >>> from pprint import pprint
  1998. >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
  1999. ... 'method':'aria2.changeUri',
  2000. ... 'params':['2', 1, [], ['http://example.org/file']]})
  2001. >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
  2002. >>> pprint(json.loads(c.read()))
  2003. {u'id': u'qwer', u'jsonrpc': u'2.0', u'result': [0, 1]}
  2004. **Exemplo 10 XML-RPC**
  2005. The following example adds 1 URI \http://example.org/file to the file
  2006. whose index is "1" and belongs to the download whose GID is "2"::
  2007. >>> import xmlrpclib
  2008. >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
  2009. >>> s.aria2.changeUri('2', 1, [], ['http://example.org/file'])
  2010. [0, 1]
  2011. .. function:: aria2.getOption(gid)
  2012. This method returns options of the download denoted by *gid*. The
  2013. response is of type struct. Its key is the name of option. The value
  2014. type is string. Note that this method does not return options which
  2015. have no default value and have not been set by the command-line
  2016. options, configuration files or RPC methods.
  2017. **Exemplo 11 JSON-RPC**
  2018. The following example gets options of the download whose GID is "1"::
  2019. >>> import urllib2, json
  2020. >>> from pprint import pprint
  2021. >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
  2022. ... 'method':'aria2.getOption', 'params':['1']})
  2023. >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
  2024. >>> pprint(json.loads(c.read()))
  2025. {u'id': u'qwer',
  2026. u'jsonrpc': u'2.0',
  2027. u'result': {u'allow-overwrite': u'false',
  2028. u'allow-piece-length-change': u'false',
  2029. u'always-resume': u'true',
  2030. u'async-dns': u'true',
  2031. ...
  2032. **Exemplo 11 XML-RPC**
  2033. The following example gets options of the download whose GID is "1"::
  2034. >>> import xmlrpclib
  2035. >>> from pprint import pprint
  2036. >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
  2037. >>> r = s.aria2.getOption('1')
  2038. >>> pprint(r)
  2039. {'allow-overwrite': 'false',
  2040. 'allow-piece-length-change': 'false',
  2041. 'always-resume': 'true',
  2042. 'async-dns': 'true',
  2043. ....
  2044. .. function:: aria2.changeOption(gid, options)
  2045. This method changes options of the download denoted by *gid*
  2046. dynamically. *gid* is of type string. *options* is of type struct.
  2047. The following options are available for active downloads:
  2048. * :option:`bt-max-peers <--bt-max-peers>`
  2049. * :option:`bt-request-peer-speed-limit <--bt-request-peer-speed-limit>`
  2050. * :option:`bt-remove-unselected-file <--bt-remove-unselected-file>`
  2051. * :option:`max-download-limit <--max-download-limit>`
  2052. * :option:`max-upload-limit <-u>`
  2053. For waiting or paused downloads, in addition to the above options,
  2054. options listed in `Arquivo de Entrada`_ subsection are available,
  2055. except for following options:
  2056. :option:`dry-run <--dry-run>`,
  2057. :option:`metalink-base-uri <--metalink-base-uri>`,
  2058. :option:`parameterized-uri <-P>`,
  2059. :option:`pause <--pause>` and
  2060. :option:`piece-length <--piece-length>`.
  2061. This method returns ``"OK"`` for success.
  2062. **Exemplo 12 JSON-RPC**
  2063. The following example sets
  2064. :option:`max-download-limit <--max-download-limit>` option to ``"20K"`` for
  2065. the download whose GID is "1"::
  2066. >>> import urllib2, json
  2067. >>> from pprint import pprint
  2068. >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
  2069. ... 'method':'aria2.changeOption',
  2070. ... 'params':['1', {'max-download-limit':'10K'}]})
  2071. >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
  2072. >>> pprint(json.loads(c.read()))
  2073. {u'id': u'qwer', u'jsonrpc': u'2.0', u'result': u'OK'}
  2074. **Exemplo 12 XML-RPC**
  2075. The following example sets
  2076. :option:`max-download-limit <--max-download-limit>` option to ``"20K"`` for
  2077. the download whose GID is "1"::
  2078. >>> import xmlrpclib
  2079. >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
  2080. >>> s.aria2.changeOption('1', {'max-download-limit':'20K'})
  2081. 'OK'
  2082. .. function:: aria2.getGlobalOption()
  2083. This method returns global options. The response is of type
  2084. struct. Its key is the name of option. The value type is string.
  2085. Note that this method does not return options which have no default
  2086. value and have not been set by the command-line options, configuration
  2087. files or RPC methods. Because global options are used as a template
  2088. for the options of newly added download, the response contains keys
  2089. returned by :func:`aria2.getOption` method.
  2090. .. function:: aria2.changeGlobalOption(options)
  2091. This method changes global options dynamically. *options* is of type
  2092. struct.
  2093. The following options are available:
  2094. * :option:`download-result <--download-result>`
  2095. * :option:`log <-l>`
  2096. * :option:`log-level <--log-level>`
  2097. * :option:`max-concurrent-downloads <-j>`
  2098. * :option:`max-download-result <--max-download-result>`
  2099. * :option:`max-overall-download-limit <--max-overall-download-limit>`
  2100. * :option:`max-overall-upload-limit <--max-overall-upload-limit>`
  2101. * :option:`save-cookies <--save-cookies>`
  2102. * :option:`save-session <--save-session>`
  2103. * :option:`server-stat-of <--server-stat-of>`
  2104. In addition to them, options listed in `Arquivo de Entrada`_ subsection
  2105. are available, except for following options:
  2106. :option:`checksum <--checksum>`,
  2107. :option:`index-out <-O>`,
  2108. :option:`out <-o>`,
  2109. :option:`pause <--pause>` and
  2110. :option:`select-file <--select-file>`.
  2111. Using :option:`log <-l>` option, you can dynamically start logging or
  2112. change log file. To stop logging, give empty string("") as a parameter
  2113. value. Note that log file is always opened in append mode. This method
  2114. returns ``"OK"`` for success.
  2115. .. function:: aria2.getGlobalStat()
  2116. This method returns global statistics such as overall download and
  2117. upload speed. The response is of type struct and contains following
  2118. keys. The value type is string.
  2119. ``downloadSpeed``
  2120. Overall download speed (byte/sec).
  2121. ``uploadSpeed``
  2122. Overall upload speed(byte/sec).
  2123. ``numActive``
  2124. The number of active downloads.
  2125. ``numWaiting``
  2126. The number of waiting downloads.
  2127. ``numStopped``
  2128. The number of stopped downloads.
  2129. **Exemplo 13 JSON-RPC**
  2130. ::
  2131. >>> import urllib2, json
  2132. >>> from pprint import pprint
  2133. >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
  2134. ... 'method':'aria2.getGlobalStat'})
  2135. >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
  2136. >>> pprint(json.loads(c.read()))
  2137. {u'id': u'qwer',
  2138. u'jsonrpc': u'2.0',
  2139. u'result': {u'downloadSpeed': u'21846',
  2140. u'numActive': u'2',
  2141. u'numStopped': u'0',
  2142. u'numWaiting': u'0',
  2143. u'uploadSpeed': u'0'}}
  2144. **Exemplo 13 XML-RPC**
  2145. ::
  2146. >>> import xmlrpclib
  2147. >>> from pprint import pprint
  2148. >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
  2149. >>> r = s.aria2.getGlobalStat()
  2150. >>> pprint(r)
  2151. {'downloadSpeed': '23136',
  2152. 'numActive': '2',
  2153. 'numStopped': '0',
  2154. 'numWaiting': '0',
  2155. 'uploadSpeed': '0'}
  2156. .. function:: aria2.purgeDownloadResult()
  2157. This method purges completed/error/removed downloads to free memory.
  2158. This method returns ``"OK"``.
  2159. .. function:: aria2.removeDownloadResult(gid)
  2160. This method removes completed/error/removed download denoted by *gid*
  2161. from memory. This method returns ``"OK"`` for success.
  2162. **Exemplo 14 JSON-RPC**
  2163. The following example removes the download result of the download
  2164. whose GID is "1"::
  2165. >>> import urllib2, json
  2166. >>> from pprint import pprint
  2167. >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
  2168. ... 'method':'aria2.removeDownloadResult',
  2169. ... 'params':['1']})
  2170. >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
  2171. >>> pprint(json.loads(c.read()))
  2172. {u'id': u'qwer', u'jsonrpc': u'2.0', u'result': u'OK'}
  2173. **Exemplo 14 XML-RPC**
  2174. The following example removes the download result of the download
  2175. whose GID is "1"::
  2176. >>> import xmlrpclib
  2177. >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
  2178. >>> s.aria2.removeDownloadResult('1')
  2179. 'OK'
  2180. .. function:: aria2.getVersion()
  2181. This method returns version of the program and the list of enabled
  2182. features. The response is of type struct and contains following keys.
  2183. ``version``
  2184. Version number of the program in string.
  2185. ``enabledFeatures``
  2186. List of enabled features. Each feature name is of type string.
  2187. **Exemplo 15 JSON-RPC**
  2188. ::
  2189. >>> import urllib2, json
  2190. >>> from pprint import pprint
  2191. >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
  2192. ... 'method':'aria2.getVersion'})
  2193. >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
  2194. >>> pprint(json.loads(c.read()))
  2195. {u'id': u'qwer',
  2196. u'jsonrpc': u'2.0',
  2197. u'result': {u'enabledFeatures': [u'Async DNS',
  2198. u'BitTorrent',
  2199. u'Firefox3 Cookie',
  2200. u'GZip',
  2201. u'HTTPS',
  2202. u'Message Digest',
  2203. u'Metalink',
  2204. u'XML-RPC'],
  2205. u'version': u'1.11.0'}}
  2206. **Exemplo 15 XML-RPC**
  2207. ::
  2208. >>> import xmlrpclib
  2209. >>> from pprint import pprint
  2210. >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
  2211. >>> r = s.aria2.getVersion()
  2212. >>> pprint(r)
  2213. {'enabledFeatures': ['Async DNS',
  2214. 'BitTorrent',
  2215. 'Firefox3 Cookie',
  2216. 'GZip',
  2217. 'HTTPS',
  2218. 'Message Digest',
  2219. 'Metalink',
  2220. 'XML-RPC'],
  2221. 'version': '1.11.0'}
  2222. .. function:: aria2.getSessionInfo()
  2223. This method returns session information.
  2224. The response is of type struct and contains following key.
  2225. ``sessionId``
  2226. Session ID, which is generated each time when aria2 is invoked.
  2227. **Exemplo 16 JSON-RPC**
  2228. ::
  2229. >>> import urllib2, json
  2230. >>> from pprint import pprint
  2231. >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
  2232. ... 'method':'aria2.getSessionInfo'})
  2233. >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
  2234. >>> pprint(json.loads(c.read()))
  2235. {u'id': u'qwer',
  2236. u'jsonrpc': u'2.0',
  2237. u'result': {u'sessionId': u'cd6a3bc6a1de28eb5bfa181e5f6b916d44af31a9'}}
  2238. **Exemplo 16 XML-RPC**
  2239. ::
  2240. >>> import xmlrpclib
  2241. >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
  2242. >>> s.aria2.getSessionInfo()
  2243. {'sessionId': 'cd6a3bc6a1de28eb5bfa181e5f6b916d44af31a9'}
  2244. .. function:: aria2.shutdown()
  2245. This method shutdowns aria2. This method returns ``"OK"``.
  2246. .. function:: aria2.forceShutdown()
  2247. This method shutdowns :func:`aria2. This method behaves like aria2.shutdown`
  2248. except that any actions which takes time such as contacting BitTorrent
  2249. tracker are skipped. This method returns ``"OK"``.
  2250. .. function:: system.multicall(methods)
  2251. This methods encapsulates multiple method calls in a single request.
  2252. *methods* is of type array and its element is struct. The struct
  2253. contains two keys: ``methodName`` and ``params``. ``methodName`` is the
  2254. method name to call and ``params`` is array containing parameters to the
  2255. method. This method returns array of responses. The element of array
  2256. will either be a one-item array containing the return value of each
  2257. method call or struct of fault element if an encapsulated method call
  2258. fails.
  2259. **Exemplo 17 JSON-RPC**
  2260. In the following example, we add 2 downloads. First one is
  2261. \http://example.org/file and second one is file.torrent::
  2262. >>> import urllib2, json, base64
  2263. >>> from pprint import pprint
  2264. >>> jsonreq = json.dumps({'jsonrpc':'2.0', 'id':'qwer',
  2265. ... 'method':'system.multicall',
  2266. ... 'params':[[{'methodName':'aria2.addUri',
  2267. ... 'params':[['http://example.org']]},
  2268. ... {'methodName':'aria2.addTorrent',
  2269. ... 'params':[base64.b64encode(open('file.torrent').read())]}]]})
  2270. >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
  2271. >>> pprint(json.loads(c.read()))
  2272. {u'id': u'qwer', u'jsonrpc': u'2.0', u'result': [[u'1'], [u'2']]}
  2273. JSON-RPC also supports Batch request described in JSON-RPC 2.0 Specification::
  2274. >>> jsonreq = json.dumps([{'jsonrpc':'2.0', 'id':'qwer',
  2275. ... 'method':'aria2.addUri',
  2276. ... 'params':[['http://example.org']]},
  2277. ... {'jsonrpc':'2.0', 'id':'asdf',
  2278. ... 'method':'aria2.addTorrent',
  2279. ... 'params':[base64.b64encode(open('file.torrent').read())]}])
  2280. >>> c = urllib2.urlopen('http://localhost:6800/jsonrpc', jsonreq)
  2281. >>> pprint(json.loads(c.read()))
  2282. [{u'id': u'qwer', u'jsonrpc': u'2.0', u'result': u'1'},
  2283. {u'id': u'asdf', u'jsonrpc': u'2.0', u'result': u'2'}]
  2284. **Exemplo 17 XML-RPC**
  2285. In the following example, we add 2 downloads. First one is
  2286. \http://example.org/file and second one is file.torrent::
  2287. >>> import xmlrpclib
  2288. >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
  2289. >>> mc = xmlrpclib.MultiCall(s)
  2290. >>> mc.aria2.addUri(['http://example.org/file'])
  2291. >>> mc.aria2.addTorrent(xmlrpclib.Binary(open('file.torrent').read()))
  2292. >>> r = mc()
  2293. >>> tuple(r)
  2294. ('2', '3')
  2295. Tratamento de Erros
  2296. ~~~~~~~~~~~~~~~~~~~
  2297. In JSON-RPC, aria2 returns JSON object which contains error code in
  2298. code and the error message in message.
  2299. In XML-RPC, aria2 returns faultCode=1 and the error message in
  2300. faultString.
  2301. .. _rpc_options:
  2302. Options
  2303. ~~~~~~~
  2304. Same options for :option:`--input-file <-i>` list are available. See `Arquivo de Entrada`_ subsection for complete list of options.
  2305. In the option struct, name element is option name(without preceding
  2306. ``--``) and value element is argument as string.
  2307. Exemplo JSON-RPC
  2308. ^^^^^^^^^^^^^^^^
  2309. ::
  2310. {'split':'1', 'http-proxy':'http://proxy/'}
  2311. Exemplo XML-RPC
  2312. ^^^^^^^^^^^^^^^
  2313. .. code-block:: xml
  2314. <struct>
  2315. <member>
  2316. <name>split</name>
  2317. <value><string>1</string></value>
  2318. </member>
  2319. <member>
  2320. <name>http-proxy</name>
  2321. <value><string>http://proxy/</string></value>
  2322. </member>
  2323. </struct>
  2324. :option:`header <--header>` and :option:`index-out <-O>`
  2325. option are allowed multiple times in
  2326. command-line. Since name should be unique in struct(many XML-RPC
  2327. library implementation uses hash or dict for struct), single string is
  2328. not enough. To overcome this situation, they can take array as value
  2329. as well as string.
  2330. Exemplos JSON-RPC
  2331. ^^^^^^^^^^^^^^^^^
  2332. ::
  2333. {'header':['Accept-Language: ja', 'Accept-Charset: utf-8']}
  2334. Exemplos XML-RPC
  2335. ^^^^^^^^^^^^^^^^^
  2336. .. code-block:: xml
  2337. <struct>
  2338. <member>
  2339. <name>header</name>
  2340. <value>
  2341. <array>
  2342. <data>
  2343. <value><string>Accept-Language: ja</string></value>
  2344. <value><string>Accept-Charset: utf-8</string></value>
  2345. </data>
  2346. </array>
  2347. </value>
  2348. </member>
  2349. </struct>
  2350. Following example adds a download with 2 options: dir and header.
  2351. header option has 2 values, so it uses a list::
  2352. >>> import xmlrpclib
  2353. >>> s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
  2354. >>> opts = dict(dir='/tmp',
  2355. ... header=['Accept-Language: ja',
  2356. ... 'Accept-Charset: utf-8'])
  2357. >>> s.aria2.addUri(['http://example.org/file'], opts)
  2358. '1'
  2359. JSON-RPC usando HTTP GET
  2360. ~~~~~~~~~~~~~~~~~~~~~~~~
  2361. The JSON-RPC interface also supports request via HTTP GET.
  2362. The encoding scheme in GET parameters is based on JSON-RPC over HTTP Specification [2008-1-15(RC1)].
  2363. The encoding of GET parameters are follows::
  2364. /jsonrpc?method=METHOD_NAME&id=ID&params=BASE64_ENCODED_PARAMS
  2365. The ``method`` and ``id`` are always treated as JSON string and their
  2366. encoding must be UTF-8.
  2367. For example, The encoded string of aria2.tellStatus('3') with id='foo'
  2368. looks like this::
  2369. /jsonrpc?method=aria2.tellStatus&id=foo&params=WyIzIl0%3D
  2370. The ``params`` parameter is Base64-encoded JSON array which usually
  2371. appears in ``params`` attribute in JSON-RPC request object. In the
  2372. above example, the params is ['3'], therefore::
  2373. ['3'] --(Base64)--> WyIzIl0= --(Percent Encode)--> WyIzIl0%3D
  2374. The JSON-RPC interface supports JSONP. You can specify the callback
  2375. function in 'jsoncallback' parameter::
  2376. /jsonrpc?method=aria2.tellStatus&id=foo&params=WyIzIl0%3D&jsoncallback=cb
  2377. For Batch request, ``method`` and ``id`` parameter must not be specified.
  2378. Whole request must be specified in ``params`` parameter. For example,
  2379. Batch request::
  2380. [{'jsonrpc':'2.0', 'id':'qwer', 'method':'aria2.getVersion'},
  2381. {'jsonrpc':'2.0', 'id':'asdf', 'method':'aria2.tellActive'}]
  2382. will be encoded like this::
  2383. /jsonrpc?params=W3sianNvbnJwYyI6ICIyLjAiLCAiaWQiOiAicXdlciIsICJtZXRob2QiOiAiYXJpYTIuZ2V0VmVyc2lvbiJ9LCB7Impzb25ycGMiOiAiMi4wIiwgImlkIjogImFzZGYiLCAibWV0aG9kIjogImFyaWEyLnRlbGxBY3RpdmUifV0%3D
  2384. JSON-RPC sobre WebSocket
  2385. ~~~~~~~~~~~~~~~~~~~~~~~~
  2386. JSON-RPC sobre WebSocket utiliza o mesmo método de assinatura e resposta
  2387. do formato JSON-RPC sobre HTTP. O WebSocket suportado é da versão 13
  2388. o qual é detalhado na :rfc:`6455`.
  2389. Para enviar uma requisição RPC para um servidor RPC, enviar strings serializadas
  2390. JSON num frame Text. A resposta do servidor RPC será entregue também em um frame
  2391. Text.
  2392. O servidor RPC ira enviar a notificação ao cliente. A notificação é
  2393. unidirecional, portanto o cliente que receber a notificação não pode
  2394. responde-la. Esse método de assinatura de notificação é muito usual mas
  2395. não provê uma identificação de chave. Os valores associados pelos parâmetros
  2396. chave são os dados que a notificação porta. O formato desses valores
  2397. variam dependendo do método de notificação. Os seguintes métodos de notificação
  2398. são definidos:
  2399. .. function:: aria2.onDownloadStart(event)
  2400. Essa notificação será enviada quando e se o download for iniciado.
  2401. *event* é o tipo de estrutura e pode conter as seguintes chaves:
  2402. O formato do valor é string.
  2403. ``gid``
  2404. GID do download.
  2405. .. function:: aria2.onDownloadPause(event)
  2406. Esta notificação será enviada se o download for pausado. *event*
  2407. tem a mesma estrutura do argumento *event* do método da função
  2408. :func:`aria2.onDownloadStart`.
  2409. .. function:: aria2.onDownloadStop(event)
  2410. Essa notificação será enviada se o download for interrompido pelo usuário.
  2411. *event* tem a mesma estrutura do argumento *event* do método da função
  2412. :func:`aria2.onDownloadStart`.
  2413. .. function:: aria2.onDownloadComplete(event)
  2414. Esta notificação será enviada quando o download for completado. Para
  2415. downloads BitTorrent, esta notificação será enviada quando for completado e
  2416. o (seed) terminar. O *event* tem a mesma estrutura do *event* do método da
  2417. função :func:`aria2.onDownloadStart`.
  2418. .. function:: aria2.onDownloadError(event)
  2419. Esta notificação será enviada se o download for interrompido por causa de
  2420. um erro.
  2421. O *event* tem a mesma estrutura do *event* do método da função
  2422. :func:`aria2.onDownloadStart`.
  2423. .. function:: aria2.onBtDownloadComplete(event)
  2424. Esta notificação será enviada se o download for completado para o
  2425. BitTorrent (mas o seeding pode não ter sido concluído). O *event* tem a
  2426. mesma estrutura do *event* do método da função :func:`aria2.onDownloadStart`.
  2427. Exemplo Código Cliente XML-RPC
  2428. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2429. O seguinte script Ruby script adiciona ``http://localhost/aria2.tar.bz2`` em
  2430. aria2c no servidor em localhost com a opção :option:`--dir=/downloads <-d>` e
  2431. imprime a resposta do processamento:
  2432. .. code-block:: ruby
  2433. #!/usr/bin/env ruby
  2434. require 'xmlrpc/client'
  2435. require 'pp'
  2436. client=XMLRPC::Client.new2("http://localhost:6800/rpc")
  2437. options={ "dir" => "/downloads" }
  2438. result=client.call("aria2.addUri", [ "http://localhost/aria2.tar.bz2" ], options)
  2439. pp result
  2440. Se você usa Python, pode usar xmlrpclib (em Python3.x, use xmlrpc.client) para
  2441. interagir com aria2::
  2442. import xmlrpclib
  2443. from pprint import pprint
  2444. s = xmlrpclib.ServerProxy("http://localhost:6800/rpc")
  2445. r = s.aria2.addUri(["http://localhost/aria2.tar.bz2"], {"dir":"/downloads"})
  2446. pprint(r)
  2447. DIVERSOS
  2448. --------
  2449. Mensagens na Console
  2450. ~~~~~~~~~~~~~~~~~~~~
  2451. Enquanto executa o download de arquivos, aria2 imprime mensagens na console
  2452. para mostrar o progresso dos downloads. Um exemplo abaixo::
  2453. [#1 SIZE:400.0KiB/33.2MiB(1%) CN:1 SPD:115.7KiBs ETA:4m51s]
  2454. Entenda o que estes números e strings significam.
  2455. ``#N``
  2456. N significa GID, o qual é um ID único para cada download.
  2457. ``SIZE``
  2458. Tamanho Total e Tamanho em bytes. Se a :option:`--select-file` é usada,
  2459. será exibida a somatória do tamanho do arquivo.
  2460. ``SEEDING``
  2461. Taxa compartilhamento ratio. O cliente está funcionando. Após término do
  2462. download do BitTorrent, ``SIZE`` será substituído por ``SEEDING``.
  2463. ``CN``
  2464. Número de conexões que o cliente estabeleceu.
  2465. ``SEED``
  2466. O número de seeders ao qual o cliente está conectado.
  2467. ``SPD``
  2468. Velocidade do download.
  2469. ``UP``
  2470. Velocidade e número de bytes transmitidos upload.
  2471. ``ETA``
  2472. Tempo previsto para conclusão.
  2473. ``TOTAL SPD``
  2474. A soma das velocidades de download para todos downloads paralelos.
  2475. Quando aria2 está alocando o espaço para arquivo ou validando o checksum,
  2476. adicionalmente exibirá o progresso:
  2477. FileAlloc
  2478. GID, tamanho alocado e total em bytes.
  2479. Checksum
  2480. GID, tamanho validado e total em bytes.
  2481. EXEMPLOS DOWNLOAD HTTP / FTP
  2482. ----------------------------
  2483. Download Segmentado HTTP/FTP
  2484. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2485. Download de arquivo
  2486. ^^^^^^^^^^^^^^^^^^^
  2487. .. code-block:: console
  2488. $ aria2c "http://servidor/arquivo.zip"
  2489. .. note::
  2490. Para parar o download, pressione :kbd:`Ctrl-C`. Posteriormente pode ser
  2491. retomado o mesmo download no mesmo diretório. Podem ser modificadas as URIs
  2492. pois elas apontam para o mesmo arquivo.
  2493. Download de arquivo de 2 servidores HTTP diferentes
  2494. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2495. .. code-block:: console
  2496. $ aria2c "http://servidor/arquivo.zip" "http://espelhobrasil/arquivo.zip"
  2497. Download de arquivo do mesmo servidor HTTP usando 2 conexões
  2498. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2499. .. code-block:: console
  2500. $ aria2c -x2 -k1M "http://servidorbrasil/arquivo.zip"
  2501. Download de arquivo de servidor HTTP e FTP
  2502. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2503. .. code-block:: console
  2504. $ aria2c "http://svrbrasil/arquivo.zip" "ftp://servebr/arquivo.zip"
  2505. Download arquivos especificados num arquivo txt concomitantemente
  2506. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2507. .. code-block:: console
  2508. $ aria2c -i arquivo.txt -j2
  2509. .. note::
  2510. -j especifica número de downloads paralelos.
  2511. Usando proxy
  2512. ^^^^^^^^^^^^
  2513. Para HTTP:
  2514. .. code-block:: console
  2515. $ aria2c --http-proxy="http://svrproxy:8080" "http://servidor/arquivo"
  2516. .. code-block:: console
  2517. $ aria2c --http-proxy="http://svrproxy:8080"
  2518. --no-proxy="localhost,127.0.0.1,192.168.0.0/16" "http://servidor/arquivo"
  2519. a máscara de rede /16 quer dizer que para toda a rede 192.168 também não
  2520. será usado o servidor proxy
  2521. Para FTP:
  2522. .. code-block:: console
  2523. $ aria2c --ftp-proxy="http://svrproxy:8080" "ftp://servidor/arquivo"
  2524. .. note::
  2525. Ver :option:`--http-proxy`, :option:`--https-proxy`, :option:`--ftp-proxy`,
  2526. :option:`--all-proxy` e :option:`--no-proxy` para detalhes. Proxy pode ser
  2527. especificado nas variáveis de ambiente. Ver seção `VARIÁVEIS DE AMBIENTE`_ .
  2528. Proxy com autenticação / authorização
  2529. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2530. .. code-block:: console
  2531. $ aria2c --http-proxy="http://usuário:senha@svrproxy:8080" "http://servidor/arquivo"
  2532. .. code-block:: console
  2533. $ aria2c --http-proxy="http://svrproxy:8080" --http-proxy-user="usuário" --http-proxy-passwd="senha" "http://servidor/arquivo"
  2534. Download Metalink
  2535. ~~~~~~~~~~~~~~~~~
  2536. Download arquivos com Metalink remoto
  2537. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2538. .. code-block:: console
  2539. $ aria2c --follow-metalink=mem "http://servidor/arquivo.metalink"
  2540. Download arquivos com Metalink local
  2541. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2542. .. code-block:: console
  2543. $ aria2c -p --lowest-speed-limit=4000 arquivo.metalink
  2544. .. note::
  2545. Para parar o download, pressione :kbd:`Ctrl-C`.
  2546. A transferência pode ser retomada executando aria2c com o mesmo argumento
  2547. no mesmo diretório
  2548. Download diversos arquivos Metalink local
  2549. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2550. .. code-block:: console
  2551. $ aria2c -j2 arquivo1.metalink arquivo2.metalink
  2552. Download só arquivos selecionados usando index
  2553. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2554. .. code-block:: console
  2555. $ aria2c --select-file=1-4,8 arquivo.metalink
  2556. .. note::
  2557. O index é exibido na console usando opção -S.
  2558. Download um arquivo usando Metalink local com preferência do usuário
  2559. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2560. .. code-block:: console
  2561. $ aria2c --metalink-location=pt,us --metalink-version=1.1 --metalink-language=pt-BR arquivo.metalink
  2562. Download BitTorrent
  2563. ~~~~~~~~~~~~~~~~~~~
  2564. Download arquivos de BitTorrent remotos
  2565. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2566. .. code-block:: console
  2567. $ aria2c --follow-torrent=mem "http://servidortorrent/arquivo.torrent"
  2568. Download usando arquivo torrent local
  2569. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2570. .. code-block:: console
  2571. $ aria2c --max-upload-limit=40K arquivo.torrent
  2572. .. note::
  2573. --max-upload-limit especifica taxa máxima de transmissão (upload).
  2574. .. note::
  2575. Para parar o download, pressione :kbd:`Ctrl-C`. A transferência pode ser retomada
  2576. ao executar aria2c com os mesmos argumentos no mesmo diretório.
  2577. Download usando URI BitTorrent Magnet
  2578. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2579. .. code-block:: console
  2580. $ aria2c "magnet:?xt=urn:btih:248D0A1CD08284299DE78D5C1ED359BB46717D8C&dn=aria2"
  2581. .. note::
  2582. Lembre-se inserir delimitadores na URI BitTorrent Magnet, pois ela inclui ``&``
  2583. que tem significado de parâmetro. Utilizar apóstrofo(``'``) ou aspas(``"``).
  2584. Download 2 torrents
  2585. ^^^^^^^^^^^^^^^^^^^
  2586. .. code-block:: console
  2587. $ aria2c -j2 arquivo1.torrent arquivo2.torrent
  2588. Download um arquivo usando torrent e servidor HTTP/FTP
  2589. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2590. .. code-block:: console
  2591. $ aria2c -T arqfile.torrent "http://serv1/arqfile" "ftp://svr2/arqfile"
  2592. .. note::
  2593. Download de arquivos múltiplos torrent com HTTP e FTP não é suportado.
  2594. Download arquivos selecionados usando index(chamado "download seletivo")
  2595. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2596. .. code-block:: console
  2597. $ aria2c --select-file=1-4,8 arquivo.torrent
  2598. .. note::
  2599. O index é exibido na console usando-se a opção -S.
  2600. Especificar arquivo saída
  2601. ^^^^^^^^^^^^^^^^^^^^^^^^^
  2602. Para especificar arquivo de saída em Downloads de BitTorrent, faz-se necessário
  2603. conhecer o index do arquivo no torrent usando a opção :option:`--show-files <-S>`.
  2604. Por exemplo, a saída exibirá algo como::
  2605. idx|path/length
  2606. ===+======================
  2607. 1|dist/base-2.6.18.iso
  2608. |99.9MiB
  2609. ---+----------------------
  2610. 2|dist/driver-2.6.18.iso
  2611. |169.0MiB
  2612. ---+----------------------
  2613. Para salvar 'dist/base-2.6.18.iso' em '/tmp/meudir/base.iso' e
  2614. 'dist/driver-2.6.18.iso' em '/tmp/dir/driver.iso', use o seguinte comando:
  2615. .. code-block:: console
  2616. $ aria2c --dir=/tmp --index-out=1=meudir/base.iso --index-out=2=dir/driver.iso arquivo.torrent
  2617. Modificando porta escuta para peer de entrada
  2618. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2619. .. code-block:: console
  2620. $ aria2c --listen-port=7000-7001,8000 arquivo.torrent
  2621. .. note::
  2622. Já que aria2 não configura o firewall ou porta de roteamento para portas
  2623. de encaminhamento, isto deve ser explicitado manualmente por você.
  2624. Especificar condição para para o programa torrent após término do download
  2625. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2626. .. code-block:: console
  2627. $ aria2c --seed-time=120 --seed-ratio=1.0 arquivo.torrent
  2628. .. note::
  2629. No exemplo acima, o programa termina após transcorrer 120 minutos após
  2630. término do download ou taxa chegar a 1.0.
  2631. Controlar velocidade upload Torrent
  2632. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2633. .. code-block:: console
  2634. $ aria2c --max-upload-limit=100K arquivo.torrent
  2635. Habilitar IPv4 DHT
  2636. ^^^^^^^^^^^^^^^^^^
  2637. .. code-block:: console
  2638. $ aria2c --enable-dht --dht-listen-port=6881 arquivo.torrent
  2639. .. note::
  2640. DHT utiliza a porta udp, como o aria2 não configura firewall nem porta de roteamento
  2641. ou forwarding, por favor executar estas configurações manualmente.
  2642. Habilitar IPv6 DHT
  2643. ^^^^^^^^^^^^^^^^^^
  2644. .. code-block:: console
  2645. $ aria2c --enable-dht6 --dht-listen-port=6881 --dht-listen-addr6=YOUR_GLOBAL_UNICAST_IPV6_ADDR --enable-async-dns6
  2646. .. note::
  2647. Se aria2c não foi compilado com c-ares, a opção :option:`--enable-async-dns6`
  2648. não é necessária. aria2 compartilha a mesma porta ente IPv4 e IPv6 DHT.
  2649. Adicionar e remover rastreador URI
  2650. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2651. Remover todos os rastreadores (tracker) das URIs descritas no arquivo.torrent
  2652. utilize ``http://tracker1/announce`` e ``http://tracker2/announce``
  2653. .. code-block:: console
  2654. $ aria2c --bt-exclude-tracker="*" --bt-tracker="http://tracker1/announce,http://tracker2/announce" file.torrent
  2655. Funcionalidades avançadas HTTP
  2656. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2657. Carregar cookies
  2658. ^^^^^^^^^^^^^^^^
  2659. .. code-block:: console
  2660. $ aria2c --load-cookies=cookies.txt "http://servidor/arquivo.zip"
  2661. .. note::
  2662. Podem ser utilizados sem nenhuma modificação coookies dos navegadores:
  2663. Firefox / Mozilla / Chromium.
  2664. Continuar download iniciado por navegadores ou outros programas
  2665. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2666. Quando desejar continuar ou retomar um download cujo processamento foi
  2667. interrompido, seja em navegador ou qualquer outro programa utilize
  2668. o aria2c para retomar este download do ponto onde parou.
  2669. .. code-block:: console
  2670. $ aria2c -c -s2 "http://servidor/arquivodedownloadparcial.zip"
  2671. Autenticação certificado para Cliente SSL/TLS
  2672. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2673. .. code-block:: console
  2674. $ aria2c --certificate=/path/para/mycert.pem --private-key=/path/para/mykey.pem https://servidor/arquivo
  2675. .. note::
  2676. O arquivo especificado na opção :option:`--private-key` não pode estar
  2677. criptografado. O comportamento do processo fica indefinido quando o
  2678. arquivo estiver criptografado.
  2679. Verificar peer em SSL/TLS usando certificados CA
  2680. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2681. .. code-block:: console
  2682. $ aria2c --ca-certificate=/path/para/ca-certificates.crt
  2683. --check-certificate https://servidor/arquivo
  2684. Funcionalidades avançadas adicionais
  2685. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  2686. Controlar velocidade de download
  2687. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2688. Quando for necessário o controle da utilização da banda disponível, pode ser
  2689. utilizado a opção abaixo. Atenção o sufixo K ou M deve ser em letra maiúscula.
  2690. .. code-block:: console
  2691. $ aria2c --max-download-limit=100K arquivo.metalink
  2692. Reparar um download danificado
  2693. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2694. .. code-block:: console
  2695. $ aria2c -V arquivo.metalink
  2696. .. note::
  2697. Reparar downloads danificados pode ser mais eficiente usando
  2698. BitTorrent ou Metalink com a opção verificação (checksums).
  2699. Desconectar conexão se a velocidade download for menor que um valor
  2700. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2701. .. code-block:: console
  2702. $ aria2c --lowest-speed-limit=10K file.metalink
  2703. Suporte a URI parametrizada
  2704. ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2705. A URI pode ser especificada como partes de um conjunto:
  2706. .. code-block:: console
  2707. $ aria2c -P "http://{svr1,svr2,svr3}/arquivo.iso"
  2708. Também podem ser especificados sequencias de intervalos:
  2709. .. code-block:: console
  2710. $ aria2c -Z -P "http://servidor/imagem[000-100].png"
  2711. .. note::
  2712. -Z opção requerida para que todas URIs não apontem para o mesmo arquivo,
  2713. como declarado no código acima.
  2714. Especificar incrementos para contador:
  2715. .. code-block:: console
  2716. $ aria2c -Z -P "http://servidor/imagem[A-Z:2].png"
  2717. Vericar validação checksum
  2718. ^^^^^^^^^^^^^^^^^^^^^^^^^^
  2719. .. code-block:: console
  2720. $ aria2c --checksum=sha-1=0192ba11326fe2298c8cb4de616f4d4140213837
  2721. http://dobrasil.org/arquivo
  2722. Download Paralelo de uma quantidade arbitrária de URI, Metalink ou Torrent
  2723. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  2724. .. code-block:: console
  2725. $ aria2c -j3 -Z "http://servidor/arquivo1" arquivo2.torrent arq3.metalink
  2726. BitTorrent Criptografado
  2727. ^^^^^^^^^^^^^^^^^^^^^^^^
  2728. Criptografar todo conjunto usando ARC4:
  2729. .. code-block:: console
  2730. $ aria2c --bt-min-crypto-level=arc4 --bt-require-crypto=true arquivo.torrent
  2731. Ver Também
  2732. ----------
  2733. Site do Projeto aria2: http://aria2.sourceforge.net/
  2734. Wiki aria2: http://sourceforge.net/apps/trac/aria2/wiki
  2735. Site do Projeto Metalink: http://www.metalinker.org/
  2736. Descrição do Formato Download Metalink: :rfc:`5854`
  2737. COPYRIGHT
  2738. ---------
  2739. Copyright (C) 2006, 2012 Tatsuhiro Tsujikawa
  2740. Tradução para Português do Brasil 2012, Gilberto dos Santos Alves
  2741. utilizando editor kate e gedit no Debian squeeze 6.0.6 novembro de 2012
  2742. Esse programa é software livre; pode ser redistribuido e/ou modificado
  2743. sob os termos da Licença GNU General Public License como publicada por
  2744. Free Software Foundation www.fsf.org; versão 2 da Licença, ou qualquer
  2745. versão mais recente, qualquer que seja sua escolha.
  2746. Este programa é distribuído na intenção de ser útil, mas SEM NENHUMA GARANTIA;
  2747. sem qualquer garantia implícita de ser COMERCIALIZÁVEL ou para PROPÓSITO
  2748. ESPECÍFICO. Consulte a Linceça GNU Genérica para mais detalhes.
  2749. Você precisa receber uma cópia da Licença Pública GNU Genérica junto com
  2750. este programa; caso não tenha, escrevá para Free Software Foundation, Inc.,
  2751. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  2752. Adicionalmente, como uma exceção especial, os detentores do direito autoral
  2753. autorizam a permissão para compilar programas que possuem ligação com
  2754. parte do código com a biblioteca OpenSSL sob certas condições como descritas
  2755. em cada arquivo fonte e autorizam a distribuição das das combinações das
  2756. ligações incluindo ambas.
  2757. Devem ser obedecidos todos os detalhes da Licença Pública GNU Genérica
  2758. em relação a OpenSSL. Caso haja modificação nos arquivos com esta exceção
  2759. deverá ser extendida esta exceção para as versões modificadas dos arquivos, mas
  2760. isto não é obrigatório. Se não houver esta intenção exclua esta declaração
  2761. de exceção da sua versão. Caso sejam excluídas as declarações de todos
  2762. os arquivos fontes, exclua também esta declaração daqui.
  2763. NOTE
  2764. ----
  2765. This manual page may not necessarily contain the latest information.
  2766. If there are some contradictions between this manual page and actual
  2767. software, please refer to English version of man page.