forked from P3TERX/aria2.conf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
P3TERX
committed
Nov 9, 2018
0 parents
commit b1876cf
Showing
5 changed files
with
214 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
## '#'开头为注释内容, 选项都有相应的注释说明, 根据需要修改 ## | ||
## 被注释的选项填写的是默认值, 建议在需要修改时再取消注释 ## | ||
|
||
## 文件保存相关 ## | ||
|
||
# 文件的保存路径(可使用绝对路径或相对路径), 默认: 当前启动位置 | ||
dir=/root/Download | ||
# 启用磁盘缓存, 0为禁用缓存, 需1.16以上版本, 默认:16M | ||
#disk-cache=32M | ||
# 文件预分配方式, 能有效降低磁盘碎片, 默认:prealloc | ||
# 预分配所需时间: none < falloc ? trunc < prealloc | ||
# falloc和trunc则需要文件系统和内核支持 | ||
# NTFS建议使用falloc, EXT3/4建议trunc, MAC 下需要注释此项 | ||
file-allocation=falloc | ||
# 断点续传 | ||
continue=true | ||
|
||
## 下载连接相关 ## | ||
|
||
# 最大同时下载任务数, 运行时可修改, 默认:5 | ||
max-concurrent-downloads=3 | ||
# 同一服务器连接数, 添加时可指定, 默认:1 | ||
max-connection-per-server=5 | ||
# 最小文件分片大小, 添加时可指定, 取值范围1M -1024M, 默认:20M | ||
# 假定size=10M, 文件为20MiB 则使用两个来源下载; 文件为15MiB 则使用一个来源下载 | ||
min-split-size=10M | ||
# 单个任务最大线程数, 添加时可指定, 默认:5 | ||
split=16 | ||
# 整体下载速度限制, 运行时可修改, 默认:0 | ||
#max-overall-download-limit=0 | ||
# 单个任务下载速度限制, 默认:0 | ||
#max-download-limit=0 | ||
# 整体上传速度限制, 运行时可修改, 默认:0 | ||
max-overall-upload-limit=1M | ||
# 单个任务上传速度限制, 默认:0 | ||
#max-upload-limit=1000 | ||
# 禁用IPv6, 默认:false | ||
disable-ipv6=false | ||
|
||
## 进度保存相关 ## | ||
|
||
# 从会话文件中读取下载任务 | ||
input-file=/root/.aria2/aria2.session | ||
# 在Aria2退出时保存`错误/未完成`的下载任务到会话文件 | ||
save-session=/root/.aria2/aria2.session | ||
# 定时保存会话, 0为退出时才保存, 需1.16.1以上版本, 默认:0 | ||
save-session-interval=60 | ||
|
||
## RPC相关设置 ## | ||
|
||
# 启用RPC, 默认:false | ||
enable-rpc=true | ||
# 允许所有来源, 默认:false | ||
rpc-allow-origin-all=true | ||
# 允许非外部访问, 默认:false | ||
rpc-listen-all=true | ||
# 事件轮询方式, 取值:[epoll, kqueue, port, poll, select], 不同系统默认值不同 | ||
#event-poll=select | ||
# RPC监听端口, 端口被占用时可以修改, 默认:6800 | ||
rpc-listen-port=6800 | ||
# 设置的RPC授权令牌, v1.18.4新增功能, 取代 --rpc-user 和 --rpc-passwd 选项 | ||
rpc-secret= | ||
# 设置的RPC访问用户名, 此选项新版已废弃, 建议改用 --rpc-secret 选项 | ||
#rpc-user=<USER> | ||
# 设置的RPC访问密码, 此选项新版已废弃, 建议改用 --rpc-secret 选项 | ||
#rpc-passwd=<PASSWD> | ||
# 是否启用 RPC 服务的 SSL/TLS 加密, | ||
# 启用加密后 RPC 服务需要使用 https 或者 wss 协议连接 | ||
#rpc-secure=true | ||
# 在 RPC 服务中启用 SSL/TLS 加密时的证书文件(.pem/.crt) | ||
#rpc-certificate=/root/xxx.pem | ||
# 在 RPC 服务中启用 SSL/TLS 加密时的私钥文件(.key) | ||
#rpc-private-key=/root/xxx.key | ||
|
||
## BT/PT下载相关 ## | ||
|
||
# 当下载的是一个种子(以.torrent结尾)时, 自动开始BT任务, 默认:true | ||
follow-torrent=true | ||
# BT监听端口, 当端口被屏蔽时使用, 默认:6881-6999 | ||
listen-port=51413 | ||
# 单个种子最大连接数, 默认:55 | ||
#bt-max-peers=55 | ||
# 打开DHT功能, PT需要禁用, 默认:true | ||
enable-dht=true | ||
# 打开IPv6 DHT功能, PT需要禁用 | ||
enable-dht6=true | ||
# DHT网络监听端口, 默认:6881-6999 | ||
#dht-listen-port=6881-6999 | ||
# 本地节点查找, PT需要禁用, 默认:false | ||
#bt-enable-lpd=true | ||
# 种子交换, PT需要禁用, 默认:true | ||
enable-peer-exchange=true | ||
# 每个种子限速, 对少种的PT很有用, 默认:50K | ||
#bt-request-peer-speed-limit=50K | ||
# 客户端伪装, PT需要 | ||
peer-id-prefix=-TR2770- | ||
user-agent=Transmission/2.77 | ||
# 当种子的分享率达到这个数时, 自动停止做种, 0为一直做种, 默认:1.0 | ||
seed-ratio=1 | ||
# 最小做种时间。此选项设置为0时,将在BT任务下载完成后不进行做种。 | ||
seed-time=0 | ||
# 强制保存会话, 即使任务已经完成, 默认:false | ||
# 较新的版本开启后会在任务完成后依然保留.aria2文件 | ||
force-save=true | ||
# BT校验相关, 默认:true | ||
#bt-hash-check-seed=true | ||
# 继续之前的BT任务时, 无需再次校验, 默认:false | ||
bt-seed-unverified=true | ||
# 保存磁力链接元数据为种子文件(.torrent文件), 默认:false | ||
#bt-save-metadata=true | ||
# 删除未选择文件 | ||
bt-remove-unselected-file=true | ||
# 下载错误后执行 删除文件 | ||
#on-download-error=/root/.aria2/delete.sh | ||
# 下载停止后执行 删除文件 | ||
on-download-stop=/root/.aria2/delete.sh | ||
# 下载完成后执行 上传脚本 | ||
on-download-complete=/root/.aria2/autoupload.sh | ||
# 下载暂停后执行 测试脚本 | ||
on-download-pause=/root/.aria2/test.sh | ||
# 下载开始后执行 测试脚本 | ||
on-download-start=/root/.aria2/test.sh | ||
bt-tracker= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash | ||
filepath=$3 #取文件原始路径,如果是单文件则为/Download/a.mp4,如果是文件夹则该值为文件夹内第一个文件比如/Download/a/1.mp4 | ||
path=${3%/*} #取文件根路径,如把/Download/a/1.mp4变成/Download/a | ||
downloadpath='/root/Download' #Aria2下载目录 | ||
name='Onedrive' #配置Rclone时的name | ||
folder='/DRIVEX/Download' #网盘里的文件夹,如果是根目录直接留空 | ||
MinSize='10k' #限制最低上传大小,默认10k,BT下载时可防止上传其他无用文件。会删除文件,谨慎设置。 | ||
MaxSize='15G' #限制最高文件大小,默认15G,OneDrive上传限制。 | ||
|
||
if [ $2 -eq 0 ] | ||
then | ||
exit 0 | ||
fi | ||
|
||
while true; do | ||
if [ "$path" = "$downloadpath" ] && [ $2 -eq 1 ] #如果下载的是单个文件 | ||
then | ||
rclone move -v "$filepath" ${name}:${folder} --min-size $MinSize --max-size $MaxSize | ||
rm -vf "$filepath".aria2 #删除残留的.aria.2文件 | ||
exit 0 | ||
elif [ "$path" != "$downloadpath" ] #如果下载的是文件夹 | ||
then | ||
while [[ "`ls -A "$path/"`" != "" ]]; do | ||
rclone move -v "$path" ${name}:/${folder}/"${path##*/}" --min-size $MinSize --max-size $MaxSize --delete-empty-src-dirs | ||
rclone delete -v "$path" --max-size $MinSize #删除多余的文件 | ||
rclone rmdirs -v "$downloadpath" --leave-root #删除空目录,--delete-empty-src-dirs参数已实现,加上无所谓。 | ||
done | ||
rm -vf "$path".aria2 #删除残留的.aria2文件 | ||
exit 0 | ||
fi | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
filepath=$3 | ||
path=${3%/*} | ||
downloadpath='/root/Download' #Aria2下载目录 | ||
|
||
if [ $2 -eq 0 ] | ||
then | ||
exit 0 | ||
fi | ||
|
||
if [ "$path" = "$downloadpath" ] && [ $2 -eq 1 ] | ||
then | ||
rm -vf "$filepath".aria2 | ||
exit 0 | ||
elif [ "$path" != "$downloadpath" ] | ||
then | ||
rm -vf "$path".aria2 | ||
exit 0 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
filepath=$3 | ||
path=${3%/*} | ||
downloadpath='/root/Download' #Aria2下载目录 | ||
|
||
if [ $2 -eq 0 ] | ||
then | ||
exit 0 | ||
fi | ||
|
||
if [ "$path" = "$downloadpath" ] && [ $2 -eq 1 ] | ||
then | ||
rm -vf "$filepath".aria2 | ||
rm -vrf "$filepath" | ||
exit 0 | ||
elif [ "$path" != "$downloadpath" ] | ||
then | ||
rm -vf "$path".aria2 | ||
rm -vrf "$path" | ||
exit 0 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/sh | ||
filepath=$3 | ||
path=${3%/*} | ||
downloadpath='/root/Download' #Aria2下载目录 | ||
|
||
echo "Aria2 变量显示测试: [$1] [$2] [$3]" | ||
echo -------------------------- 测试 -------------------------- | ||
echo 下载路径:${downloadpath} | ||
echo 文件路径:${filepath} | ||
echo 文件根路径:${path} | ||
echo 最终路径:"${path##*/}" | ||
echo -------------------------- 测试 -------------------------- | ||
|
||
echo "Aria2 variable display test: [$1] [$2] [$3]" | ||
echo -------------------------- TEST -------------------------- | ||
echo Download path:${downloadpath} | ||
echo File path: ${filepath} | ||
echo Path: ${path} | ||
echo Final path: "${path##*/}" | ||
echo -------------------------- TEST -------------------------- |