最新消息:

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

主机面板 eben 1141浏览

前期准备

AriaNg

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

oneindex

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

自动上传脚本

项目地址:https://github.com/weiyidu/OneDrive

Aria2一键安装脚本(逗比制作)

wget N nocheckcertificate https://softs.loan/Bash/aria2.sh && chmod +x aria2.sh && bash aria2.sh
# 如果上面这个脚本无法下载,尝试使用备用下载:
wget N nocheckcertificate 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》使用

赋予运行权限 chmod +x autoupload.sh

wget nocheckcertificate q O /root/autoupload.sh “https://raw.githubusercontent.com/weiyidu/OneDrive/master/autoupload_new.sh” && chmod +x /root/autoupload.sh

修改LocalDIR目录与第1步的目录地址一样

#!/bin/bash
GID=“$1”;
FileNum=“$2”;
File=“$3”;
MaxSize=“15728640”
RemoteDIR=“”;  #上传到Onedrive的路径,默认为根目录。
LocalDIR=“/home/”;  #Aria2下载目录,记得最后面加上/
if [[ z $(echo “$FileNum” |grep o ‘[0-9]*’ |head n1) ]]; then FileNum=‘0’; fi
if [[ “$FileNum” le ‘0’ ]]; then exit 0; fi
if [[ “$#” != ‘3’ ]]; then exit 0; fi
function LoadFile(){
  IFS_BAK=$IFS
  IFS=$‘\n’
  if [[ ! d “$LocalDIR” ]]; then return; fi
  if [[ e “$File” ]]; then
    if [[ $(dirname “$File”) == $(readlink f $LocalDIR) ]]; then
      ONEDRIVE=“onedrive”;
    else
      ONEDRIVE=“onedrive-d”;
    fi
    FileLoad=“${File/#$LocalDIR}”
    while true
      do
        if [[ “$FileLoad” == ‘/’ ]]; then return; fi
        echo “$FileLoad” |grep q ‘/’;
        if [[ “$?” == “0” ]]; then
          FileLoad=$(dirname “$FileLoad”);
        else
          break;
        fi;
      done;
    if [[ “$FileLoad” == “$LocalDIR” ]]; then return; fi
    if [[ n “$RemoteDIR” ]]; then
      Option=” -f $RemoteDIR”;
    else
      Option=“”;
    fi
    EXEC=“$(command -v $ONEDRIVE)”;
    if [[ z “$EXEC” ]]; then return; fi
    cd “$LocalDIR”;
    if [[ e “$FileLoad” ]]; then
      ItemSize=$(du s “$FileLoad” |cut f1 |grep o ‘[0-9]*’ |head n1)
      if [[ z “$ItemSize” ]]; then return; fi
      if [[ “$ItemSize” ge “$MaxSize” ]]; then
        echo ne “\033[33m$File \033[0mtoo large to spik.\n”;
        return;
      fi
      eval “${EXEC}${Option}” \“${FileLoad}”\;
      if [[ $? == ‘0’ ]]; then
        rm rf “$FileLoad”;
      fi
    fi
  fi
  IFS=$IFS_BAK
}
LoadFile;

转载请注明:落伍老站长 » 使用Aria2+AriaNg+oneindex+onedrive建立离线BT下载/在线播放