我使用aria2作为远程控制的下载客户端。
正如aria2所显示的,它支持--on-download-complete,它可以向执行的脚本传递3个参数。以下是参考资料:https://aria2.github.io/manual/en/html/aria2c.html?highlight=on-download#event-hook
但是现在我使用Python包装来与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
发布于 2016-03-29 17:10:35
我找到了解决办法。
它只支持命令行中的“事件钩子”。
以下是解决方案:https://aria2.github.io/manual/en/html/aria2c.html#event-hook
我们应该以这种格式添加已执行的脚本。
我以前做的实验不适合Aria2c。它天生就有这个缺陷(证明)。
希望这能对另一个灵魂有所帮助。
https://stackoverflow.com/questions/36279756
复制相似问题