-
Notifications
You must be signed in to change notification settings - Fork 0
Quick Start
Option 1: Install from PyPI (recommended)
# Install the package
pip install qbt-rules
# Create config directory (if not exists)
mkdir -p ~/.config/qbt-rules
# Download example configurations
curl -o ~/.config/qbt-rules/config.yml \
https://raw.githubusercontent.com/andronics/qbt-rules/main/config/config.example.yml
curl -o ~/.config/qbt-rules/rules.yml \
https://raw.githubusercontent.com/andronics/qbt-rules/main/config/rules.example.yml
# Edit config with your qBittorrent credentials
nano ~/.config/qbt-rules/config.ymlOption 2: Install from source
# Clone the repository
git clone https://github.com/andronics/qbt-rules.git
cd qbt-rules
# Install in editable mode
pip install -e .
# Copy example configurations
cp config/config.example.yml config/config.yml
cp config/rules.example.yml config/rules.yml-
Set qBittorrent Connection
Edit
config/config.ymlor set environment variables:export QBITTORRENT_HOST="http://localhost:8080" export QBITTORRENT_USER="admin" export QBITTORRENT_PASS="your_password"
-
Enable qBittorrent Web UI
- Open qBittorrent → Tools → Options → Web UI
- Check "Web User Interface (Remote control)"
- Set username and password
- Note the port (default: 8080)
Let's create a simple rule to auto-categorize HD movies.
Edit config/rules.yml:
rules:
- name: "Auto-categorize HD movies"
enabled: true
stop_on_match: false
conditions:
all:
- field: info.name
operator: matches
value: '(?i).*(1080p|2160p|4k).*'
- field: info.category
operator: ==
value: ""
actions:
- type: set_category
params:
category: movies-hd
- type: add_tag
params:
tags:
- hd
- auto-categorizedWhat this rule does:
- Matches: Torrents with "1080p", "2160p", or "4k" in the name (case-insensitive)
- AND: Currently have no category assigned
- Actions: Sets category to "movies-hd" and adds tags
Important: Create the "movies-hd" category in qBittorrent first!
Dry-run mode (see what would happen without making changes):
qbt-rules --dry-runExpected output:
2024-12-10 12:00:00 | INFO | Successfully authenticated with qBittorrent
2024-12-10 12:00:00 | INFO | Loaded 1 rules (execute in file order)
2024-12-10 12:00:00 | INFO | Would set_category Movie.2160p.BluRay to movies-hd (params={'category': 'movies-hd'})
2024-12-10 12:00:00 | INFO | Would add_tag Movie.2160p.BluRay (params={'tags': ['hd', 'auto-categorized']})
2024-12-10 12:00:00 | INFO | Rule 'Auto-categorize HD movies' matched 1 torrent(s)
Run for real (remove --dry-run):
qbt-rulesOther useful commands:
# Validate rules syntax
qbt-rules --validate
# List all enabled rules
qbt-rules --list-rules
# Debug with trace logging
qbt-rules --dry-run --trace
# Override log level
qbt-rules --dry-run --log-level DEBUGCongratulations! You've created your first automation rule. Continue reading for comprehensive documentation.
qbt-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)