简体   繁体   中英

Can not add options in aria2 using Python xmlrpc?

I am using aria2 as a download client for remote control.

As what aria2 shows, it supports --on-download-complete , it can pass 3 parameters to the executed script. Here's is the reference: https://aria2.github.io/manual/en/html/aria2c.html?highlight=on-download#event-hook

But now I am using a Python xmlrpc wrapper to talk to Aria2. this is the wrapper i am using: https://github.com/alfateam123/pyaria2

server = PyAria2( 'localhost', 6800, rpcSecret={"useSecret": False, "secret": None} ) unique_id_accepted = server.addUri([http://somewhere.com/somefile.iso], options={ "dir": "/srv/", "gid": "abcdef1234567890", "max-connection per-server": 5, "on-download-complete": "touch /tmp/done" } )

if Aria2 starts to download from the URI, the unique_id_accepted is the same as gid in this scenario. Actually aria2 works. When I see the downloading jobs in Aria2, the gid is accepted. But after it completes, it does not execute the command touch /tmp/done

Is there something wrong with the options?

How could you talk to aria2 to execute commands after it completes?

So many thanks!


update I found Sample XML-RPC Client Code https://aria2.github.io/manual/en/html/aria2c.html#sample-xml-rpc-client-code

I tried this line: "onDownloadComplete": "touch /tmp/done" but it still does not work.


updated

version of aria2c aria2c -v

1.18.1 ** Configuration ** Enabled Features: Async DNS, BitTorrent, Firefox3 Cookie, GZip, HTTPS, Message Digest, Metalink, XML-RPC Hash Algorithms: sha-1, sha-224, sha-256, sha-384, sha-512, md5 Libraries: zlib/1.2.8 libxml2/2.9.1 sqlite3/3.8.1 GnuTLS/2.12.23 libgcrypt/1.5.3 c-ares/1.10.0

I found the solution.

It only supports "event hook" in command line.

Here is the solution: https://aria2.github.io/manual/en/html/aria2c.html#event-hook

We should add the executed script in this format.

The experiment I did before was not suitable to Aria2c. It was born with this defect (Proved).

Hope this could be helpful for another soul :P

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM