簡體   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