qbittorrent下载完成后自动上传 并自动删种
前言:
qbittorrent的”Run external program on torrent completion”功能可以实现下载完成后自动执行命令,借助这个我们可以在种子下载玩成之后执行命令或脚本来实现我们需要的功能
本文以”qbittorrent下载完成之后自动执行rclone脚本,上传到google_drive onedrive,上传完成后自动删种”为例
此方法不适用于docker安装的qbit,qbit在容器内无法执行容器外部的rclone
暂时不知道解决方法 欢迎大家反馈
一、安装qbittorrent(以debian为例)
apt update -y && apt upgrade -y
apt install qbittorrent-nox -y
vim /etc/systemd/system/qbittorrent-nox.service
[Unit]
Description=qBittorrent Command Line Client
After=network.target
[Service]
Type=forking
User=root
Group=root
UMask=007
ExecStart=/usr/bin/qbittorrent-nox -d --webui-port=8080
Restart=on-failure
[Install]
WantedBy=multi-user.target
systemctl daemon-reload && systemctl enable qbittorrent-nox
systemctl start qbittorrent-nox
systemctl status qbittorrent-nox
安装完成后通过 ip:8080 访问即可,默认用户名 密码分别为admin adminadmin
安装有很多方法,只不过我平常用这个
二、安装rclone并添加google_drive onedrive
你也可以添加其他存储方式,本文我以上传到google_drive onedrive演示
rclone安装以及添加google_drive onedrive可以看 这篇文章 或Google
三、自动上传并删种
我在rclone的名字为 gd
od
,并且都创建了”qbit
“文件夹用来管理种子
rclone mkdir od:qbit #为od创建一个文件夹"qbit"
rclone tree od:qbit #查看od文件夹"qbit"里的内容
rclone tree gd:qbit #查看qbit文件夹的内容,我google_drive这个文件夹里面本来就有一些文件
查看rclone程序位置,并给予执行权限
最后在qbittorrent-options(setting)中勾选”Run external program on torrent completion”,并按照你自己的需求填写rclone命令
#rclone可以接很多参数 具体根据你自身需要自己选择
#自动上传到google_drive 上传完成后删除源文件,rclone move为"移动"命令
/usr/bin/rclone move "%D%N" gd:qbit/"%N"
#自动上传到onedrive 上传完成后删除源文件
#"--transfers=N"这个参数是指同时上传的最大文件数量,默认为4,因为od上传似乎只有200M的速度,跑不满G口带宽就设置大的点,注意数值越大占用内存越高
/usr/bin/rclone move "%D%N" od:qbit/"%N" --transfers=6
#自动上传到onedrive 不删除源文件,copy 命令为复制
#这个通常是为了刷上传量或有考核
/usr/bin/rclone copy "%D%N" gd:qbit/"%N"
注意:
这里的 %D 是 Default Save Path 的值,如果 Default Save Path 路径末尾有 /
那么就是 /usr/bin/rclone move "%D%N" gd:qbit/"%N"
如果 Default Save Path 末尾没 /
那么就是 /usr/bin/rclone move "%D/%N" gd:qbit/"%N"
我apt安装qbit软件默认带 /
而且没法更改,如果其他安装方法 可能会不带 /
效果展示:
我选择性的下载的”1 2 3 4”集用于google_drive测试,下载”7 8”集用来测试onedrive,中途我在qbittorrent换过命令哈
由图可知,种子于”20:28”开始下载”1 2 3 4”集,此时硬盘为74GB,gd qbit的文件夹为空
“1 2 3 4”集 于”20:32”下载完成,此时触发执行rclone上传命令,rclone创建了文件夹,并开始上传
rclone move上传命令执行并且上传成功后,rclone将本地文件删除,硬盘恢复为74GB
google drive:
成功播放,你也可以用emby alist等在线观看
onedrive:
杂谈
1、是否可以自动删种
大部分用户都是上传完成后,自动删除种子(即move命令),这样来节省磁盘空间
但是当站点对种子有考核或者你需要保留种子增加上传量,你可以选用上传完不删除(即copy命令)
2、如何在线观看
你可以用google drive的在线播放,或者安装个alist/emby实现在线播放,这个比较简单 应该不会出alist/emby的教程了,当然如果有小伙伴需要 可以联系我再水一篇文章
3、同时执行多条命令
比如我想同时上传到gd od 一份用来做备份,这里可能就需要你自己写个脚本了,另外 这篇文章 的多功能脚本可能会帮助到你
4、我没有gd od 怎么办
od我是嫖的E5每个子账号有5TB空间 一个主账号可以开很多个账号,不过onedrive上传下载挺慢的200M左右
gd我是开的土区google one,一年104元2TB空间,挺不错的便宜速度还快上传下载G口以上
你也可以用大盘鸡存储,rclone设置填写大盘鸡sftp信息就行,或者其他的
参考文章:https://forum.rclone.org/t/automate-upload-complete-torrents-in-google-drive-using-qbitorrent/23471


共有 0 条评论