Skip to content

Commit 8bc41e8

Browse files
committed
fix: address review blockers and doc duplicates
1 parent e5e216e commit 8bc41e8

3 files changed

Lines changed: 28 additions & 6 deletions

File tree

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,6 @@ bash scripts/vpn-mode.sh nord
189189
| `scripts/setup.sh` | Creates folders, generates .env, copies config templates |
190190
| `scripts/doctor.sh` | Runs preflight checks (runtime, env, compose, ports) |
191191
| `scripts/upgrade-from-basic.sh` | One-shot migration from basic stack to advanced |
192-
| `scripts/doctor.sh` | Runs preflight checks (runtime, env, compose, ports) |
193192
| `scripts/configure.sh` | Auto-configures all service connections via API |
194193
| `scripts/health-check.sh` | Full stack health diagnostic |
195194
| `scripts/install-launchd-jobs.sh` | Installs all automation as background jobs |

SETUP.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,6 @@ This installs:
226226
- Log prune (daily cleanup, removes logs older than 30 days)
227227
- Download watchdog (stalled torrent auto-fix every 15 min)
228228
- Kometa scheduler (metadata refresh every 4 hours)
229-
- Log prune (daily log cleanup with 30-day retention)
230229

231230
Automation logs go to `<MEDIA_DIR>/logs/` and launchd stdout/stderr logs go to `<MEDIA_DIR>/logs/launchd/` (default `~/Media/...`).
232231

scripts/download-watchdog.py

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,12 @@ def load_media_dir() -> Path:
3939
LOG_FILE = BASE_DIR / "logs" / "download-watchdog.log"
4040
RADARR_CFG = BASE_DIR / "config" / "radarr" / "config.xml"
4141
SONARR_CFG = BASE_DIR / "config" / "sonarr" / "config.xml"
42+
CREDENTIALS_FILE = BASE_DIR / "state" / "first-run-credentials.txt"
4243

4344
RADARR_URL = os.getenv("RADARR_URL", "http://localhost:7878")
4445
SONARR_URL = os.getenv("SONARR_URL", "http://localhost:8989")
4546
QBIT_URL = os.getenv("QBIT_URL", "http://localhost:8080")
4647

47-
QBIT_USERNAME = os.getenv("QBIT_USERNAME", "admin")
48-
QBIT_PASSWORD = os.getenv("QBIT_PASSWORD", "")
49-
5048
STALL_SECONDS = int(os.getenv("WATCHDOG_STALL_SECONDS", "1800"))
5149
SLOW_SECONDS = int(os.getenv("WATCHDOG_SLOW_SECONDS", "1200"))
5250
MIN_SPEED_BPS = int(os.getenv("WATCHDOG_MIN_SPEED_BPS", str(300 * 1024)))
@@ -77,6 +75,26 @@ def parse_api_key_xml(path):
7775
return text[start + 8 : end].strip()
7876

7977

78+
def load_qbit_credentials():
79+
username = os.getenv("QBIT_USERNAME", "").strip()
80+
password = os.getenv("QBIT_PASSWORD", "").strip()
81+
82+
if username and password:
83+
return username, password
84+
85+
if CREDENTIALS_FILE.exists():
86+
try:
87+
for line in CREDENTIALS_FILE.read_text(errors="ignore").splitlines():
88+
if line.startswith("qBittorrent Username:") and not username:
89+
username = line.split(":", 1)[1].strip()
90+
elif line.startswith("qBittorrent Password:") and not password:
91+
password = line.split(":", 1)[1].strip()
92+
except Exception:
93+
pass
94+
95+
return (username or "admin"), password
96+
97+
8098
def http_json(url, headers=None, timeout=30):
8199
req = urllib.request.Request(url, headers=headers or {})
82100
with urllib.request.urlopen(req, timeout=timeout) as resp:
@@ -168,8 +186,14 @@ def main():
168186
log("[ERROR] No API keys found")
169187
return 1
170188

189+
qbit_username, qbit_password = load_qbit_credentials()
190+
globals()["QBIT_USERNAME"] = qbit_username
191+
globals()["QBIT_PASSWORD"] = qbit_password
192+
171193
if not QBIT_PASSWORD:
172-
log("[ERROR] QBIT_PASSWORD is not set. Check your environment or credentials file.")
194+
log(
195+
f"[ERROR] QBIT_PASSWORD is not set and no credentials found in {CREDENTIALS_FILE}"
196+
)
173197
return 1
174198

175199
try:

0 commit comments

Comments
 (0)