繁体   English   中英

无法使用 Python xmlrpc 在 aria2 中添加选项?

[英]Can not add options in aria2 using Python xmlrpc?

我使用 aria2 作为远程控制的下载客户端。

正如 aria2 所示,它支持 --on --on-download-complete ,它可以将 3 个参数传递给执行的脚本。 这是参考: https : //aria2.github.io/manual/en/html/aria2c.html?highlight=on-download#event-hook

但现在我使用 Python xmlrpc 包装器与 Aria2 对话。 这是我正在使用的包装器: 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" } )

如果 Aria2 开始从 URI 下载,则unique_id_accepted与此场景中的gid相同。 实际上 aria2 有效。 当我在 Aria2 中看到下载作业时, gid被接受。 但是它完成后,它不会执行命令touch /tmp/done

选项有问题吗?

完成后如何与 aria2 对话以执行命令?

非常感谢!


更新我发现Sample XML-RPC Client Code https://aria2.github.io/manual/en/html/aria2c.html#sample-xml-rpc-client-code

我试过这一行: "onDownloadComplete": "touch /tmp/done"但它仍然不起作用。


更新

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

我找到了解决方案。

它仅支持命令行中的“事件挂钩”。

这是解决方案: https : //aria2.github.io/manual/en/html/aria2c.html#event-hook

我们应该以这种格式添加执行的脚本。

我之前做的实验不适合Aria2c。 它天生就有这个缺陷(已证明)。

希望这对另一个灵魂有帮助:P

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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