nas-tools
nas-tools copied to clipboard
关于刷流单种子限速的解决方法
需求:因为是用的seedbox,所以上传需要限制在一定范围内,否则会被标记或者超速会被封号某些站点,以前提过作者说不是大众需求的问题所以暂时不加,故自己查阅资料,算是提供一种方法吧。
查阅qbittorrentapi相关资料:https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#add-new-torrent 其中upLimit dlLimit 控制单个种子的上传下载速度
upLimit optional | integer | Set torrent upload speed limit. Unit in bytes/second
dlLimit optional | integer | Set torrent download speed limit. Unit in bytes/second
故修改源码的/pt/client/qbittorrent.py 第206行为:(其中52428800=50mb/s, 8388608=8mb/s)
if isinstance(content, str):
qbc_ret = self.qbc.torrents_add(urls=content,
save_path=save_path,
category=category,
is_paused=is_paused,
tags=tag,
upLimit=8388608,
dlLimit=52428800)
else:
qbc_ret = self.qbc.torrents_add(torrent_files=content,
save_path=save_path,
category=category,
is_paused=is_paused,
tags=tag,
upLimit=8388608,
dlLimit=52428800)
然后重启,可限制新添加的单个种子最大下载速度50mb/s, 最大上传速度8mb/s, 以上就是这样,如果作者能在下载器加个输入框最好不过了,真的很需要限制速度尤其是上传,比如我上传全局80mb/s,需要限制每个只有8mb/s