Keeps qBittorrent's active MAM Unsat count at or below a configured cap.
Find a file
2026-08-08 09:39:52 -06:00
.env.example feat: add web UI for manual force-resume of paused candidates 2026-08-04 00:30:54 -06:00
.gitignore feat: initial commit 2026-07-31 21:36:15 -06:00
mam_unsat_queue.py fix: use categories instead of tags 2026-08-08 09:39:52 -06:00
preference.txt fix: use categories instead of tags 2026-08-08 09:39:52 -06:00
README.md feat: add web UI for manual force-resume of paused candidates 2026-08-04 00:30:54 -06:00
requirements.txt feat: add web UI for manual force-resume of paused candidates 2026-08-04 00:30:54 -06:00

mam-unsat-queue

Keeps qBittorrent's active MAM Unsat count at or below a configured cap. Mature MAM seeds and non-MAM torrents are left alone; paused MAM torrents are resumed, in preference.txt tag order, only as Unsat slots free up.

Setup

python3 -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .env # fill in QBIT_USER / QBIT_PASS

Run

python3 mam_unsat_queue.py                  # daemon, polls every POLL_INTERVAL
python3 mam_unsat_queue.py --check          # dry run: logs intent, resumes nothing
python3 mam_unsat_queue.py --check --once   # single dry-run status check

The first run classifies every torrent's tracker against MAM_TRACKER_MATCH (one API call per torrent) and caches the result in mam_cache.json; later runs only classify newly added torrents.

Web UI

When running as a daemon (i.e. not --once), a small web UI is started automatically at http://WEB_HOST:WEB_PORT (default http://127.0.0.1:8787). It lets you type in a number of torrents (1-150, default 1) and force-resume that many paused MAM candidates immediately, in preference.txt order — ignoring MAX_UNSAT. Useful for manually pulling ahead of the automatic pacing. It also links to MAM's snatch summary page.

Config (.env)

Var Meaning
QBIT_HOST / QBIT_USER / QBIT_PASS qBittorrent WebUI credentials
SEED_HOURS MAM's Unsat window (default 72)
BUFFER_HOURS Extra safety margin added on top (default 4)
MAX_UNSAT Max concurrent active Unsats (default 150)
POLL_INTERVAL Seconds between checks (default 60)
MAM_TRACKER_MATCH Substring matched against tracker URLs
PREFERENCE_FILE Tag priority list, one tag per line, most preferred first
CACHE_FILE Where the tracker-classification cache is stored
WEB_HOST / WEB_PORT Where the web UI listens (default 127.0.0.1:8787)

A torrent counts as an active Unsat once seeding, until its qBittorrent seeding_time (accumulated only while actually running and seeding, so downtime isn't credited) passes SEED_HOURS + BUFFER_HOURS.