惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

N
News and Events Feed by Topic
D
Docker
云风的 BLOG
云风的 BLOG
F
Fortinet All Blogs
F
Full Disclosure
H
Hackread – Cybersecurity News, Data Breaches, AI and More
P
Proofpoint News Feed
Microsoft Azure Blog
Microsoft Azure Blog
WordPress大学
WordPress大学
The GitHub Blog
The GitHub Blog
L
LangChain Blog
H
Help Net Security
B
Blog
T
Tailwind CSS Blog
V
V2EX
博客园_首页
阮一峰的网络日志
阮一峰的网络日志
人人都是产品经理
人人都是产品经理
The Cloudflare Blog
Recent Announcements
Recent Announcements
aimingoo的专栏
aimingoo的专栏
美团技术团队
A
About on SuperTechFans
C
Cybersecurity and Infrastructure Security Agency CISA
K
Kaspersky official blog
I
InfoQ
Project Zero
Project Zero
I
Intezer
Google DeepMind News
Google DeepMind News
博客园 - 【当耐特】
Hugging Face - Blog
Hugging Face - Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
T
Threat Research - Cisco Blogs
Last Week in AI
Last Week in AI
C
Cyber Attacks, Cyber Crime and Cyber Security
G
GRAHAM CLULEY
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
AWS News Blog
AWS News Blog
Spread Privacy
Spread Privacy
S
Securelist
Recorded Future
Recorded Future
D
Darknet – Hacking Tools, Hacker News & Cyber Security
博客园 - 叶小钗
S
Security Affairs
Blog — PlanetScale
Blog — PlanetScale
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
月光博客
月光博客
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
罗磊的独立博客
The Hacker News
The Hacker News

Rat's Blog - Google Drive

GoIndex:一个无需服务器的Google Drive目录索引程序 - Rat's Blog 申请西南学院EDU教育邮箱,可免费获取无限容量的Google Drive网盘 - Rat's Blog 解决Rclone挂载Google Drive时上传失败和内存占用高等问题 - Rat's Blog Rclone+Google Drive搭建无限容量的媒体库,适用于Plex/Emby/Jellyfin等 - Rat's Blog Sharecmd:一个可以将文件上传至Google Drive/Dropbox并自动生成分享链接的工具 - Rat's Blog Windows下使用RaiDrive挂载Google Drive/OneDrive网盘为本地硬盘使用 - Rat's Blog 免费申请谷歌G Suite套件、并获取无限空间Google Drive - Rat's Blog Aria2+Caddy+Rclone+GDlist+Aria2Ng+Google Drive一键安装脚本 - Rat's Blog VPS使用GDList挂载Google Drive和OneDrive网盘,支持多个同时挂载 - Rat's Blog
使用Aira2下载文件后自动上传到Google Drive网盘 - Rat's Blog
博主: Rat's · 2018-10-30 · via Rat's Blog - Google Drive

说明:网盘挂载方法参考:在Debian/Ubuntu上使用rclone挂载Google Drive网盘Aira2安装参考:BT种子/磁力链接下载工具:Aria2一键安装管理脚本,以上工作都准备好了后,就可以使用Aria2将文件电影等资源下载到网盘了,鉴于hostloc有大佬说因为某些原因,不能将下载路径默认为Google Drive网盘指定的本地文件夹,就发现了这个方法,能直接在挂载后使用。通过配置项on-download-complete来完成下载文件自动移到Google Drive网盘里。

更新

【2018.10.30】
这里分享下萌咖大佬的Aira2上传脚本,不过是精简版,全能版暂不分享,精简版包含以下功能:
1、脚本适用于Rclone挂载的网盘,比如Onedrive/Google Drive等。
2、判断上传文件的文件大小区间。
限制最低上传大小:可防止产生的.aria2后缀文件一起上传到网盘。
限制最高文件大小:适用于Onedrive等,官方限制上传不能超过15G,其它可自行更改其数值。
3、支持文件名中包含空格等特殊字符。

使用方法

原理是当下载完后aria2会给脚本传3个参数$1$2$3分别为gid、文件数量、文件路径。我们对文件路径这个字符串处理一番就可以达到目的了。

新建脚本文件rcloneupload.sh,并复制下面代码:

#!/bin/bash

GID="$1";
FileNum="$2";
File="$3";
MinSize="5"  #限制最低上传大小,默认5k
MaxSize="157286400"  #限制最高文件大小(单位k),默认15G
RemoteDIR="/RATS/";  #rclone挂载的本地文件夹,最后面保留/
LocalDIR="/download/";  #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
    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
    EXEC="$(command -v mv)"
    if [[ -z "$EXEC" ]]; then return; fi
    Option=" -f";
    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" -le "$MinSize" ]]; then
        echo -ne "\033[33m$FileLoad \033[0mtoo small to spik.\n";
        return;
      fi
      if [[ "$ItemSize" -ge "$MaxSize" ]]; then
        echo -ne "\033[33m$FileLoad \033[0mtoo large to spik.\n";
        return;
      fi
      eval "${EXEC}${Option}" \'"${FileLoad}"\' "${RemoteDIR}";
    fi
  fi
  IFS=$IFS_BAK
}
LoadFile;

授权chmod +x rcloneupload.sh,然后再到Aria2配置文件中加上一行on-download-complete=/root/rcloneupload.sh即可,后面为脚本的路径。最后重启Aria2生效。

本文只提到了Google Drive网盘挂载方法,如果你想用Onedrive可查看→Rclone挂载Onedrive网盘教程。对于不想用Rclone挂载Onedrive的,可以参考博客另一个教程→传送门


版权声明:本文为原创文章,版权归 Rat's Blog 所有,转载请注明出处!

本文链接:https://www.moerats.com/archives/482/

如教程需要更新,或者相关链接出现404,可以在文章下面评论留言。