【发布时间】: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