简体   繁体   English

获取Aria2(aria2c)以继续下载通过RPC添加的文件

[英]Getting Aria2 (aria2c) to resume download of files added via RPC

I am currently running aria2 in daemon mode in order to control it via xml-rpc commands. 我目前正在以守护程序模式运行aria2,以便通过xml-rpc命令对其进行控制。 The addition of files via xml-rpc works fine. 通过xml-rpc添加文件效果很好。 The problem I am trying to solve is how to get aria2 to resume the "session" if it is stopped abruptly, rather than gracefully. 我要解决的问题是,如果aria2突然而不是正常停止,如何使aria2恢复“会话”。

I'm using the setting "save-session-interval" described in the manual here in order to attempt to get aria to save to the session file at an interval. 我正在使用此处手册中描述的设置“ save-session-interval”,以尝试使aria间隔保存到会话文件中。 If I interrupt aria via a ctrl-c interrupt it gracefully saves the pending downloads into the session file. 如果我通过ctrl-c中断来中断aria,它将正常地将待处理的下载保存到会话文件中。 After which if I restart aria via the same command, it resumes the downloads correctly. 之后,如果我通过相同的命令重新启动aria,它将正确地恢复下载。

Every 20seconds aria2 writes to the console saying that it has serialized the session. aria2每20秒写入一次控制台,说它已序列化会话。 Notepad++ even detects that the file has been changed, however the file remains empty. Notepad ++甚至检测到文件已更改,但是文件仍然为空。

07/11 22:49:54 [NOTICE] Serialized session to 'C:\temp\aria\session.txt' successfully.

The command I am using to start aria: 我用来启动aria的命令:

aria2c.exe --conf-path=C:\temp\aria\aria.conf --daemon

The contents of the conf file are: conf文件的内容为:

dir=C:\temp\aria
input-file=C:\temp\aria\session.txt
save-session=C:\temp\aria\session.txt
enable-rpc=true
save-session-interval=20

The xml-rpc command I am using is being called from python like so: 我正在使用的xml-rpc命令是从python调用的,如下所示:

import xmlrpclib
fileurl = "http://example.com/sample_file.txt"
s = xmlrpclib.ServerProxy('http://localhost:6800/rpc')
val = s.aria2.addUri([fileurl], {'http-user':'user', 'http-passwd':'pass'})

An additional thing I've tried is to empty the session file after stopping aria gracefully (allowing it to write the pending download to the session file). 我尝试过的另一件事是,优雅地停止aria后清空会话文件(允许将未完成的下载写入会话文件)。 It then overrides the session file with the download. 然后,它将使用下载覆盖会话文件。 This behavior points me to believe that aria does not save downloads added via xml-rpc into the "session" list for saving to the session file. 此行为使我相信aria不会将通过xml-rpc添加的下载保存到“会话”列表中,以保存到会话文件中。

I've also tried adding the "save-session-interval" to the initial command instead of the conf file but the behavior is identical. 我也尝试将“ save-session-interval”添加到初始命令而不是conf文件中,但是行为是相同的。

Aria Version Details: Aria版本详细信息:

aria2 version 1.17.1

I am using the below conf file with aria running as deamon and it works fine : 我正在使用下面的conf文件,aria作为守护进程运行,并且运行良好:

dir=/media/ExternalHd/aria
file-allocation=falloc
continue
log-level=error
max-connection-per-server=4
summary-interval=120
daemon=true
enable-rpc=true
rpc-listen-port=6800
rpc-listen-all=true
max-concurrent-downloads=2
save-session=/home/pi/Desktop/aria.txt
input-file=/home/pi/Desktop/aria.txt
log=/home/pi/Desktop/aria.log
disable-ipv6=true
disk-cache=25M
timeout=600
retry-wait=30
max-tries=50
save-session-interval=10

Try using the above config and run aria2c as deamon, you can also use the various methods to access the aria2c RPC interface as detailed here from desktop and mobile devices. 尝试使用上述配置并将aria2c作为守护进程运行,您还可以使用各种方法从台式机和移动设备访问aria2c RPC接口,如此处所述 I am using the mobile app and web-interface and it saves the session with aria2c v 1.16.5 我正在使用移动应用程序和Web界面,它使用aria2c v 1.16.5保存会话

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM