Configuration Guide¶
All configuration is handled via environment variables with sensible defaults. This guide covers all the major configuration areas for qbit-guard.
Essential qBittorrent Settings¶
These are the minimum required settings to connect qbit-guard to qBittorrent:
Important Notes¶
- QBIT_HOST: Must be accessible from the qbit-guard container/script
- QBIT_ALLOWED_CATEGORIES: Only torrents in these categories will be processed
- QBIT_DRY_RUN: Enable for testing - prevents actual torrent deletions
Sonarr Integration (Pre-air Gate)¶
Configure Sonarr integration to block early TV show releases:
How Pre-air Checking Works¶
- Grace Period: Allows releases within
EARLY_GRACE_HOURSof air date (default: 6h) - Hard Limit: Blocks releases more than
EARLY_HARD_LIMIT_HOURSearly (default: 72h) - Whitelists: Trusted groups/indexers/trackers can bypass timing restrictions
- Blocklisting: Blocked releases are automatically blocklisted in Sonarr before deletion
Radarr Integration (Pre-air Gate & ISO Blocklisting)¶
Configure Radarr integration for both movie pre-air checking and ISO cleanup:
How Movie Pre-air Checking Works¶
Similar to TV show pre-air checking, but for movies:
- Grace Period: Allows releases within
EARLY_GRACE_HOURSof release date (default: 6h) - Hard Limit: Blocks releases more than
EARLY_HARD_LIMIT_HOURSearly (default: 72h) - Whitelists: Trusted groups/indexers/trackers can bypass timing restrictions
- Blocklisting: Blocked releases are automatically blocklisted in Radarr before deletion
The system checks multiple release date fields from Radarr including digitalRelease, physicalRelease, inCinemas, and releaseDate.
This integration ensures that both ISO files deleted by qbit-guard and unreleased movies are also blocklisted in Radarr to prevent re-downloading.
Internet Cross-Verification (Optional)¶
Add external verification of air dates using TVmaze and/or TheTVDB:
Provider Options¶
off: No internet verificationtvmaze: Use TVmaze API (no key required)tvdb: Use TheTVDB API (requires API key)both: Use both services for cross-verification
ISO/BDMV Cleanup¶
Configure automatic cleanup of disc image torrents:
How ISO Cleanup Works¶
- Detection: Identifies torrents containing only disc images (ISO, BDMV, VIDEO_TS)
- Video Check: Looks for keepable video files above the size threshold
- Cleanup: Removes torrents with no keepable video content
- Blocklisting: Automatically blocklists removed torrents in appropriate *arr service
Extension Policy¶
Control which file types are allowed or blocked:
Extension Strategies¶
- Block Strategy: Allow everything except blocked extensions
- Allow Strategy: Only allow specified extensions
Enforcement Options¶
- GUARD_EXT_DELETE_IF_ALL_BLOCKED: Delete torrent only if ALL files are disallowed (default: true)
- GUARD_EXT_DELETE_IF_ANY_BLOCKED: Delete torrent if ANY file is disallowed (default: false)
- GUARD_UNCHECK_BLOCKED_FILES: Uncheck (don't download) disallowed files instead of deleting the entire torrent (default: true)
When GUARD_UNCHECK_BLOCKED_FILES=1, qbit-guard will: - Identify files that match the blocklist - Set their priority to 0 (don't download) if some files are allowed - Add a "guard:partial" tag to indicate partial downloads - Allow the torrent to continue downloading only the allowed files - Still delete the torrent if ALL files would be unchecked
Optional Config File¶
Instead of environment variables, use a JSON config file:
Example extensions.json:
| JSON | |
|---|---|
Container Watcher Settings¶
Configure polling behavior for container mode:
| Bash | |
|---|---|
Connection Reliability¶
Configure reconnection behavior when qBittorrent restarts:
| Bash | |
|---|---|
The watcher will automatically detect connection failures and attempt to reconnect with exponential backoff. On successful reconnection, it resets the request ID and re-authenticates to ensure clean state recovery.
Reliability & Performance¶
Fine-tune timeouts and retry behavior:
| Variable | Default | Description |
|---|---|---|
SONARR_TIMEOUT_SEC | 45 | HTTP timeout for Sonarr API calls |
SONARR_RETRIES | 3 | Retry attempts for Sonarr blocklist operations |
RADARR_TIMEOUT_SEC | 45 | HTTP timeout for Radarr API calls |
RADARR_RETRIES | 3 | Retry attempts for Radarr blocklist operations |
USER_AGENT | qbit-guard/2.0 | HTTP User-Agent string |
LOG_LEVEL | INFO | Logging verbosity (INFO or DEBUG) |
Configuration Examples¶
Minimal Setup¶
| Bash | |
|---|---|
Full Pre-air Setup¶
Next Steps¶
- Environment Variables → - Complete reference of all variables
- Examples → - Working Docker Compose configurations
- Troubleshooting → - Common configuration issues