使用Aria2+AriaNg+oneindex+onedrive建立离线BT下载/在线播放 - 唯一度博客

使用Aria2+AriaNg+oneindex+onedrive建立离线BT下载/在线播放

2018-07-03 24条评论 5,421次阅读 1人点赞
之前因为比较懒就没有写,正好最近又用到这个,就补上吧。
需要配合《OneDrive for Business in Linux》一起使用

前期准备

AriaNg

项目地址:https://github.com/mayswind/AriaNg/releases

oneindex

项目地址:https://github.com/donwa/oneindex

自动上传脚本

项目地址:https://github.com/weiyidu/OneDrive
Aria2一键安装脚本(逗比制作)

1
2
3
4
wget -N --no-check-certificate https://softs.loan/Bash/aria2.sh && chmod +x aria2.sh && bash aria2.sh
# 如果上面这个脚本无法下载,尝试使用备用下载:
wget -N --no-check-certificate https://raw.githubusercontent.com/ToyoDAdoubi/doubi/master/aria2.sh && chmod +x aria2.sh && bash aria2.sh

使用教程https://doub.io/shell-jc4/(需要科学上网访问)

安装

网站运行环境:推荐"宝塔面板",安装教程
1、创建AriaNg网站


如果连接不上宝塔面板安全放行6800端口

2、创建oneindex网站

需求

1、PHP空间,PHP 5.6+ 打开curl支持
2、onedrive 账号 (个人、企业版或教育版/工作或学校帐户)
3、oneindex 程序

特殊文件实现功能

在文件夹底部添加说明:在onedrive的文件夹中添加README.md文件,使用markdown语法。
在文件夹头部添加说明:在onedrive的文件夹中添加HEAD.md 文件,使用markdown语法。
加密文件夹:在onedrive的文件夹中添加.password文件,填入密码,密码不能为空。
直接输出网页:在onedrive的文件夹中添加index.html 文件,程序会直接输出网页而不列目录。
配合 文件展示设置-直接输出 效果更佳

修改Aria2配置

1、修改下载目录,如下图,选择7 修改配置文件,选择3
2、选择5 手动 打开配置文件修改,在最后一行on-download-complete=/root/autoupload.sh
autoupload.sh脚本内容,需要配合《OneDrive for Business in Linux》使用
修改downloadpath目录与第1步的目录地址一样

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
num="$2"
path="$3"
downloadpath='/home' #下载目录
if [ $num -eq 0 ]
then
exit 0
fi
function getdir(){
IFS=$'\n';for file in `ls "$1"`
do
if [ -d "$1/$file" ]
then
getdir "$1/$file"
else
if [ "${1%/*}" = "$downloadpath" ] && [ $num -eq 1 ]
then
onedrive "$1"
elif [ $num -eq 1 ]
then
onedrive "$1/$file"
else
onedrive -u "$downloadpath" "$1/$file"
fi
fi
done
}
while true; do
filepath=$path
path=${path%/*};
if [ "$path" = "$downloadpath" ]
then
getdir "$filepath"
if [ -d $filepath ]
then
rm -r "$filepath"
else
rm "$filepath"
fi
echo 3 > /proc/sys/vm/drop_caches
swapoff -a && swapon -a
exit 0
fi
done

赋予运行权限 chmod +x autoupload.sh
点赞 分享


comments powered by Disqus