-
Notifications
You must be signed in to change notification settings - Fork 0
Examples
Stephen Cox edited this page Dec 10, 2025
·
4 revisions
This section provides real-world rule examples organised by common use cases.
- name: "Auto-categorize HD movies"
enabled: true
stop_on_match: true
conditions:
trigger: on_added
all:
- field: info.name
operator: matches
value: '(?i).*(1080p|2160p|4k).*\.(mkv|mp4|avi)$'
actions:
- type: set_category
params:
category: "Movies-HD"
- type: add_tag
params:
tag: "movies"- name: "Auto-categorize TV shows"
enabled: true
stop_on_match: true
conditions:
trigger: on_added
all:
- field: info.name
operator: matches
value: '(?i).*[Ss]\d{2}[Ee]\d{2}.*'
actions:
- type: set_category
params:
category: "TV-Shows"
- type: add_tag
params:
tag: "tv"- name: "Categorize private tracker content"
enabled: true
stop_on_match: true
conditions:
trigger: on_added
any:
- field: trackers.url
operator: contains
value: "privatehd.to"
- field: trackers.url
operator: contains
value: "passthepopcorn.me"
actions:
- type: set_category
params:
category: "Private"
- type: add_tag
params:
tag: "private-tracker"- name: "Remove torrents with only archives"
enabled: true
stop_on_match: true
conditions:
trigger: on_added
all:
- field: files.name
operator: matches
value: '(?i).*\.(rar|zip|7z|tar|gz)$'
actions:
- type: delete_torrent
params:
delete_files: true- name: "Delete torrents with sample files"
enabled: true
stop_on_match: true
conditions:
trigger: on_added
any:
- field: info.name
operator: contains
value: "sample"
- field: files.name
operator: contains
value: "sample"
actions:
- type: delete_torrent
params:
delete_files: true- name: "Remove torrents too small"
enabled: true
conditions:
trigger: on_added
all:
- field: info.size
operator: "<"
value: 104857600 # < 100MB
- field: info.category
operator: "=="
value: "Movies"
actions:
- type: delete_torrent
params:
delete_files: true- name: "Tag all private tracker torrents"
enabled: true
conditions:
trigger: manual
all:
- field: trackers.url
operator: not_contains
value: "public"
actions:
- type: add_tag
params:
tag: "private"- name: "Force start low-seeded torrents on private trackers"
enabled: true
conditions:
trigger: manual
all:
- field: trackers.url
operator: contains
value: "privatehd.to"
- field: info.num_complete
operator: "<"
value: 3
actions:
- type: force_start- name: "Reannounce torrents with tracker errors"
enabled: true
conditions:
trigger: scheduled
all:
- field: trackers.msg
operator: not_contains
value: "Working"
- field: info.state
operator: "=="
value: "stalledUP"
actions:
- type: reannounce- name: "Delete old completed torrents"
enabled: true
conditions:
trigger: scheduled
all:
- field: info.state
operator: in
value: ["uploading", "pausedUP", "stalledUP"]
- field: info.completion_on
operator: older_than
value: 2592000 # 30 days
- field: info.ratio
operator: ">="
value: 1.0
actions:
- type: delete_torrent
params:
delete_files: false- name: "Delete stalled downloads after 7 days"
enabled: true
conditions:
trigger: scheduled
all:
- field: info.state
operator: "=="
value: "stalledDL"
- field: info.added_on
operator: older_than
value: 604800 # 7 days
actions:
- type: delete_torrent
params:
delete_files: true- name: "Remove errored torrents"
enabled: true
conditions:
trigger: scheduled
any:
- field: info.state
operator: "=="
value: "error"
- field: info.state
operator: "=="
value: "missingFiles"
actions:
- type: delete_torrent
params:
delete_files: false- name: "Pause torrents with high ratio and seeders"
enabled: true
conditions:
trigger: scheduled
all:
- field: info.ratio
operator: ">="
value: 2.0
- field: info.num_complete
operator: ">"
value: 10
- field: info.state
operator: "=="
value: "uploading"
actions:
- type: stop- name: "Force start torrents with low seeders"
enabled: true
conditions:
trigger: scheduled
all:
- field: info.num_complete
operator: "<="
value: 2
- field: info.state
operator: in
value: ["pausedUP", "stalledUP"]
actions:
- type: force_start- name: "Limit upload speed for old torrents"
enabled: true
conditions:
trigger: scheduled
all:
- field: info.completion_on
operator: older_than
value: 1209600 # 14 days
- field: info.ratio
operator: ">="
value: 1.5
actions:
- type: set_upload_limit
params:
limit: 524288 # 512 KB/s- name: "Recheck torrents with missing files"
enabled: true
conditions:
trigger: scheduled
all:
- field: info.state
operator: "=="
value: "missingFiles"
actions:
- type: recheck- name: "Delete permanently errored torrents"
enabled: true
conditions:
trigger: scheduled
all:
- field: info.state
operator: "=="
value: "error"
- field: info.added_on
operator: older_than
value: 259200 # 3 days
actions:
- type: delete_torrent
params:
delete_files: false- name: "Resume paused downloads with activity"
enabled: true
conditions:
trigger: scheduled
all:
- field: info.state
operator: "=="
value: "pausedDL"
- field: info.availability
operator: ">"
value: 0.5
actions:
- type: start- name: "Manage large, slow downloads"
enabled: true
conditions:
trigger: scheduled
all:
- field: info.size
operator: ">"
value: 10737418240 # > 10GB
- field: info.state
operator: "=="
value: "downloading"
- field: info.dlspeed
operator: "<"
value: 102400 # < 100 KB/s
- field: info.added_on
operator: newer_than
value: 86400 # < 1 day old
none:
- field: info.category
operator: "=="
value: "Priority"
actions:
- type: set_download_limit
params:
limit: 1048576 # 1 MB/s max
- type: add_tag
params:
tag: "throttled"- name: "Smart seeding based on ratio and time"
enabled: true
conditions:
trigger: on_completed
any:
# High ratio achieved
- field: info.ratio
operator: ">="
value: 3.0
# OR seeded for 30 days with ratio >= 1.0
- all:
- field: info.completion_on
operator: older_than
value: 2592000 # 30 days
- field: info.ratio
operator: ">="
value: 1.0
actions:
- type: stop
- type: add_tag
params:
tag: "seeding-complete"- name: "Private tracker: force seed low-seeded content"
enabled: true
conditions:
trigger: on_completed
all:
- field: trackers.url
operator: contains
value: "passthepopcorn.me"
- field: info.num_complete
operator: "<="
value: 5
actions:
- type: force_start
- type: set_category
params:
category: "Private-Important"
- type: add_tag
params:
tag: "must-seed"
- type: set_upload_limit
params:
limit: -1 # Unlimited# Daily cleanup at 3 AM
- name: "Daily cleanup: remove completed torrents"
enabled: true
conditions:
trigger: scheduled
schedule: "0 3 * * *"
all:
- field: info.state
operator: in
value: ["pausedUP", "stalledUP"]
- field: info.ratio
operator: ">="
value: 2.0
- field: info.completion_on
operator: older_than
value: 604800 # 7 days
actions:
- type: delete_torrent
params:
delete_files: false
# Weekly recheck of all torrents
- name: "Weekly integrity check"
enabled: true
conditions:
trigger: scheduled
schedule: "0 4 * * 0" # Sundays at 4 AM
all:
- field: info.state
operator: in
value: ["uploading", "stalledUP"]
actions:
- type: recheck# Auto-categorize on add
- name: "Webhook: Categorize new downloads"
enabled: true
conditions:
trigger: on_added
any:
- field: info.name
operator: matches
value: '(?i).*\.(mkv|mp4|avi)$'
- field: files.name
operator: matches
value: '(?i).*\.(mkv|mp4|avi)$'
actions:
- type: set_category
params:
category: "Videos"
- type: add_tag
params:
tag: "auto-categorized"
# Post-completion actions
- name: "Webhook: Tag completed downloads"
enabled: true
conditions:
trigger: on_completed
all:
- field: info.ratio
operator: "<"
value: 1.0
actions:
- type: add_tag
params:
tag: "needs-seeding"
- type: force_startqbt-rules v0.3.0 | Python-based rules engine for qBittorrent automation
GitHub • PyPI • Issues • Discussions • Contributing • License
Requirements: Python 3.8+ • qBittorrent 5.0+
Made with ❤️ by the qbt-rules community | Licensed under MIT
v0.3.0 | GitHub
- ✅ Unified CLI (
qbt-rules) - ✅ Custom triggers
- ✅ Trigger-agnostic mode
- ✅ Size operators (
50GB)