【问题标题】:Can not add options in aria2 using Python xmlrpc?无法使用 Python xmlrpc 在 aria2 中添加选项?
【发布时间】:2016-03-29 09:00:46
【问题描述】:

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

正如aria2所示,它支持--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

【问题讨论】:

标签: python json linux download xml-rpc


【解决方案1】:

我找到了解决办法。

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

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

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

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

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

【讨论】:

    猜你喜欢
    • 2016-07-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多