Skip to main content

Auto Remove Torrents (H&R Version)

这是一个支持 H&R 检查的自动删种程序,基于 autoremove-torrents 修改,在此感谢原作者jerrymakesjelly。

新增功能

  • 支持通过 API 检查种子的 H&R 状态
  • 可以根据 H&R 达标情况决定是否删除种子

安装

pip install autoremove-torrents-hnr

配置示例

my_task:
  client: qbittorrent
  host: http://127.0.0.1:7474
  username: admin
  password: password
  
  strategies:
    remove_completed_hnr:
      categories: 
        - TJUPT
      hnr:
        host: https://pt.example.org/api/v1/hnr.php
        api_token: your_api_token
        require_complete: true  # true表示只删除已达标的种子

其他条件配置请参考原项目 autoremove-torrents 的文档。

hnr 配置说明

H&R API 接口文档:hnr_api.md

在策略配置中添加 hnr 部分:

  • host: H&R API 地址
  • api_token: API 访问令牌
  • require_complete:
    • true: 只删除 H&R 已达标的种子
    • false: 只删除 H&R 未达标的种子

使用方法

# 预览模式(不会真正删除)
autoremove-torrents --view --conf=config.yml

# 正常运行
autoremove-torrents --conf=config.yml

日志

autoremove-torrents --conf=config.yml --log=logs/autoremove.log

项目结构

1 客户端模块 (client/)

  • hnr_api.py: H&R API 客户端,用于查询种子的 H&R 状态
  • 其他客户端适配器(如 qBittorrent, Transmission 等)

2 条件模块 (condition/)

  • base.py: 条件基类,定义了条件的基本接口
  • hnr.py: H&R 条件检查实现
  • 其他条件实现(如分享率、做种时间等)

3 核心功能文件

  • strategy.py: 策略执行器,负责:

  • 应用各种条件

  • 管理种子的保留和删除列表

  • 执行删除操作

  • conditionparser.py: 条件解析器,负责:

  • 解析配置文件中的条件

  • 创建对应的条件实例

  • 处理条件组合

工作流程

1 配置加载

  • 读取 config.yml
  • 解析任务和策略配置

2 客户端连接

  • 根据配置创建对应的客户端实例
  • 建立连接并验证

3 策略执行

  • 获取种子列表
  • 应用分类过滤
  • 执行条件检查
  • 确定删除列表

4 删除操作

  • 执行种子删除
  • 记录操作日志

许可证

MIT License

Metadata

Release files for autoremove-torrents-hnr 1.6.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for autoremove-torrents-hnr 1.6.1
File Size Uploaded
autoremove_torrents_hnr-1.6.1.tar.gz 32.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for autoremove-torrents-hnr 1.6.1
File Interpreter ABI Platform
autoremove_torrents_hnr-1.6.1-py3-none-any.whl Python 3 none any Details

Total release size: 86.0 kB

Release files / autoremove_torrents_hnr-1.6.1.tar.gz

Download URL autoremove_torrents_hnr-1.6.1.tar.gz
Size 32.2 kB
Tags Source
SHA-256 checksum
How to use checksums
e6acdcd736ee59b7f5f532283352cd46c7b330b38582b86e4cd2d5a0e93c1a89
BLAKE2b-256 checksum
How to use checksums
031cdef4b90799c4de3b03e517f4b61562f40625dca983ebccb6a5f57986f9d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.2

Release files / autoremove_torrents_hnr-1.6.1-py3-none-any.whl

Download URL autoremove_torrents_hnr-1.6.1-py3-none-any.whl
Size 53.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b003b3202c1e089ad5f519484ef190416c016d98448fa207275a3ccafc71b39b
BLAKE2b-256 checksum
How to use checksums
408c9078d66618688570670bfd3e67e6f3e7fa69d2607f28c336193378d1b15a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.2

Release history Release notifications | RSS feed

2.1.0

2 release files

2.0.0

2 release files

This release

1.6.1 This release

2 release files

1.6.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page