删种规则

类型

  • 普通规则 即通过条件列表用来筛选种子, 根据匹配情况进行删种

  • javascript 通过 Javascript 代码, 依据代码段的返回值进行判断删种

殊途佬的盒子删种规则

普通规则

说明

  1. 分享率一: 上传 / 种子大小 的结果

  2. 分享率二: 上传 / 下载 的结果

  3. 站点域名: 种子的 Tracker 地址的域名部分

  4. 各类时间: 选项时间到当前时间的差值, 单位为 秒/s

  5. 各类大小: 单位为 字节 / Byte, 可以使用 * 做乘法运算

  6. 各类速度: 单位为 字节/s / Byte/s

  7. 种子状态: 参照 qBittorrent 对种子状态的定义, 主要包含以下几类: 上传中: uploading, 下载中: downloading 等待下载: stalledDL, 做种但无上传: stalledUP 更多状态请参照 qBittorrent Wiki, 若想删除等待下载状态下的种子, 应填写 stalledDL

  8. 返回信息: 种子 Tracker 列表中由 Tracker 返回的信息

  9. 当前时间: 当天 0 点到当前时间的秒数 例: 填写 当前时间大于 8*3600 与 当前时间小于 22*3600 则只会在当天上午 8 点之后到 22 点之前删种 0 点的时间戳取决于 Vertex 安装环境的时区

  10. 全局速度: 当前下载器的速度

  11. 做种下载连接: 仅计算已连接上的数量, 也即 qBittorrent WebUI 内括号外的数字

  12. 做种下载任务: 任务的数量, 做种包含上传中状态与做种状态, 下载包含下载中与等待下载状态

  13. 比较类型中的 包含 / 包含于 或 不包含 / 不包含于: 值部分需以半角逗号 , 为分割符, 如种子分类不包含于 KEEP, KEEP2, KEEP3 三个分类, 则应填写: KEEP,KEEP2,KEEP3

Javascript

基本结构

// 提供 maindata 与 torrent 参数, maindata 为 qBittorrent 的全局信息, torrent 为当前操作种子的信息
// 返回 true 则意为符合删种条件, 若未设置持续时间, 则立即删除该种, false 为不删除
(maindata, torrent) => {
  return false;
}

maindata

maindata 结构如下

const maindata = {
  downloadSpeed: 0,
  uploadSpeed: 0,
  freeSpaceOnDisk: 0,
  leechingCount: 0,
  seedingCount: 0,
  usedSpace: 0,
  queuedIO: 0,
  readCacheOverload: 0
  writeCacheOverload: 0,
  torrents: [torrent, torrent, torrent....]
}

maindata 各属性释义

属性释义

downloadSpeed

全局下载速度, 单位 Byte/s

uploadSpeed

全局上传速度, 单位 Byte/s

freeSpaceOnDisk

剩余空间, 单位 Byte

leechingCount

当前下载数量, 包括下载, 等待下载状态

seedingCount

当前做种数量, 包括做种, 上传状态

usedSpace

已使用空间, 由所有种子完成量加和得到, 单位 Byte

queuedIO

IO 队列长度, qBittorrent 统计页面的 队列的 I/O 任务, 仅限 qBittorrent

readCacheOverload

读取缓存超负荷, qBittorrent 统计页面的 读取缓存超负荷, 仅限 qBittorrent

writeCacheOverload

写入缓存超负荷, qBittorrent 统计页面的 写入缓存超负荷, 仅限 qBittorrent

originProp

由客户端返回的原始客户端属性, 具体内容请参考文档

torrents

种子列表

torrent

torrent 结构如下

const torrent = {
  availability: 0.5,
  name: 'torrent name',
  uploadSpeed: 0,
  downloadSpeed: 0,
  size: 0,
  progress: 0.1,
  tracker: 'tr.ack.er',
  completed: 0,
  uploaded: 0,
  downloaded: 0,
  ratio: 0.1,
  category: 'category',
  state: 'downloading',
  addedTime: 0,
  completedTime: -1,
  savePath: '/root/Downloads',
  seeder: 0,
  leecher: 0,
  trackerStatus: ''
}

torrent 属性与 qBittorrent 所返回的属性对应关系

const torrent = {
  availability: 'availability',
  name: 'name',
  uploadSpeed: 'upspeed',
  downloadSpeed: 'dlspeed',
  size: 'size',
  progress: 'progress',
  tracker: 'tracker',
  completed: 'completed',
  uploaded: 'uploaded',
  downloaded: 'downloaded',
  ratio: 'ratio',
  category: 'category',
  state: 'state',
  addedTime: 'added_on',
  completedTime: 'completion_on',
  savePath: 'save_path',
  seeder: 'num_seeds',
  leecher: 'num_leechs'
}

torrent 各属性释义

属性释义

availability

可用性, 可以是小数, 4.1.x 版本没有这个参数, 由客户端根据已连接的 peer 计算得出

name

种子名称

uploadSpeed

上传速度, 单位 Byte/s

downloadSpeed

下载速度, 单位 Byte/s

size

种子大小, 单位Byte

progress

种子当前进度

tracker

Tracker 地址, 与 qBittorrent 返回不同, 此属性仅包含域名

completed

已完成大小, 单位 Byte

uploaded

已上传, 单位 Byte

downloaded

已下载, 单位 Byte

ratio

分享率

category

分类

state

种子当前状态

addedTime

种子添加时间, 秒时间戳

completedTime

种子完成时间, 秒时间戳

savePath

保存路径

seeder

已连接的做种 peer 数量

leecher

已连接的下载 peer 数量

trackerStatus

Tracker 返回信息, 部分站点不支持

originProp

由客户端返回的原始种子属性, 具体内容请参考文档

关于种子列表, 了解更多 => qBittorrent-Api-Wiki:get-torrent-list

torrent 任务状态释义

状态释义

error

发生了一些错误,适用于暂停的种子

missingFiles

Torrent 数据文件丢失

uploading

Torrent 正在播种,正在传输数据

pausedUP

Torrent 已暂停并已完成下载

queuedUP

队列已启用且 torrent 已排队等待上传

stalledUP

Torrent 正在播种,但没有建立连接

checkingUP

Torrent 已完成下载,正在检查中

forcedUP

Torrent 被强制上传并忽略队列限制

allocating

Torrent 正为下载分配磁盘空间

downloading

正在下载 Torrent,正在传输数据

metaDL

Torrent 刚刚开始下载并正在获取元数据

pausedDL

Torrent 已暂停并且尚未完成下载

queuedDL

队列已启用且 torrent 已排队等待下载

stalledDL

Torrent 正在下载,但未建立连接

checkingDL

与 checkingUP 相同,但 torrent 尚未完成下载

forcedDL

Torrent 被强制下载以忽略队列限制

checkingResumeData

在 qBt 启动时检查恢复数据

moving

Torrent 正在移动到另一个位置

unknown

未知状态

关于任务状态, 了解更多 => qBittorrent-Api-Wiki:torrent-management

举栗

黑车

// 黑车
(maindata, torrent) => {
  const categoryList = [
    "不想",
    "删的",
    "种子",
    "加",
    "这些",
    "分类"
  ];
  const ruleData = [
    { down: 80, up: 50 },
    { down: 70, up: 40 },
    { down: 60, up: 30 },
    { down: 50, up: 25 },
    { down: 40, up: 20 },
    { down: 20, up: 7 },
    { down: 15, up: 5 },
    { down: 10, up: 2 },
    { down: 5, up: 0.5 }
  ];
  const { state, upspeed, category, dlspeed } = torrent.originProp;
  if (categoryList.indexOf(category) !== -1) {
    return false;
  }
  for (const rule of ruleData) {
    if (
      state == "downloading" &&
      dlspeed >= util.calSize(rule.down, "MiB") &&
      upspeed <= util.calSize(rule.up, "MiB")
    ) {
      return true;
    }
  }
  return false;
};

慢车

// 慢车 持续时间30s
// 下载状态,上传低于550kb,进度在10-100之间
// 下载人数大于100的种子不删
// 0点-7点,或者客户端下载种子数量小于等于10时不删种
(maindata, torrent) => {
  const categoryList = [
    "不想",
    "删的",
    "种子",
    "加",
    "这些",
    "分类"
  ];
  const { state, upspeed, progress, ratio, category } = torrent.originProp;
  if (categoryList.indexOf(category) !== -1 || torrent.leecher >= 100) {
    return false;
  }
  if (
    (moment().hour() >= 0 && moment().hour() <= 7) ||
    maindata.leechingCount <= 10
  ) {
    return false;
  }
  if (
    state === "downloading" &&
    upspeed <= util.calSize(1, "MiB") &&
    moment().unix() - torrent.addedTime >= 600
  ) {
    return true;
  }
  return false;
};