gpt4 book ai didi

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

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:46:43 28 4
gpt4 key购买 nike

我正在使用 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


服务器 = PyAria2(
'本地主机',
6800,
rpcSecret={“useSecret”:假,“ secret ”:无}
)
unique_id_accepted = server.addUri([http://somewhere.com/somefile.iso],
选项={
"目录": "/srv/",
“gid”:“abcdef1234567890”,
“每台服务器的最大连接数”:5,
“下载完成”:“触摸/tmp/完成”
}
)

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

选项有问题吗?

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

非常感谢!


更新我找到了 示例 XML-RPC 客户端代码 https://aria2.github.io/manual/en/html/aria2c.html#sample-xml-rpc-client-code

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


更新了

aria2c 的版本 aria2c -v

1.18.1
** 配置 **
启用的功能:异步 DNS、BitTorrent、Firefox3 Cookie、GZip、HTTPS、消息摘要、Metalink、XML-RPC
哈希算法:sha-1、sha-224、sha-256、sha-384、sha-512、md5
库: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

最佳答案

我找到了解决方案。

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

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

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

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

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

关于python - 无法使用 Python xmlrpc 在 aria2 中添加选项?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36279756/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com