Initial tdarr-cli: Python CLI for the Tdarr API
All checks were successful
release / release (push) Successful in 1m4s

status/nodes/worker/cruddb/insert/api commands (stdlib only). Cracked
Tdarr's x-api-key auth (seededApiKey), alter-worker-limit and update-node
formats. Used to set up 2-node transcoding (workstation NVENC + Pi5 CPU
fallback). Playbook standard: README (per-OS prereqs), doc/plan.md,
.gitignore (build/ first), VS Code build task, install.sh + one-line curl,
Gitea Actions rolling-latest release.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011YPrEZVBpPVoCRyJz2exkZ
This commit is contained in:
2026-07-05 20:31:39 +02:00
commit 7c0c55bcea
7 changed files with 351 additions and 0 deletions

64
README.md Normal file
View File

@@ -0,0 +1,64 @@
# tdarr-cli (`tdarrctl`)
En liten CLI mot **Tdarrs API** — som `npmctl` fast för Tdarr. Byggd för att
konfigurera/styra Tdarr-servern (bibliotek, flows, noder, worker-gränser) utan
att klicka i webb-UI:t. Ren Python (bara stdlib).
## Installera
En rad (laddar ner senaste `tdarrctl` och lägger den i PATH):
```sh
curl -fsSL https://gitea.brasse-pc.eu/brasse/tdarr-cli/raw/branch/master/install.sh | sh
```
Miljövariabler: `TDARRCTL_INSTALL_DIR` (installkatalog), `TDARRCTL_VERSION` (release-tag).
## Prerequisites (per OS)
Endast **Python ≥ 3.8** krävs (inga externa paket — bara standardbiblioteket).
| OS | Kommando |
|----|----------|
| Garuda/Arch (dev-boxen) | `sudo pacman -S --needed python` |
| Debian/Ubuntu | `sudo apt install python3` |
## Konfiguration
- Bas-URL: `TDARR_URL` (standard `http://192.168.0.19:8266`).
- API-nyckel: `TDARR_API_KEY`, annars läses `apiKey=...` ur `~/tdarr-node/.env`.
Skickas som `x-api-key`; skrivs aldrig ut.
## Kör
```sh
python3 tdarrctl.py status # server-status/version
python3 tdarrctl.py nodes # noder + worker-gränser
python3 tdarrctl.py worker <namn> transcodegpu increase [n] # ändra workers
python3 tdarrctl.py libraries # lista bibliotek
python3 tdarrctl.py cruddb <COLLECTION> <mode> [--obj f.json] [--docID id]
python3 tdarrctl.py insert <COLLECTION> <f.json> [--mode insert|update|removeOne]
python3 tdarrctl.py api <METHOD> <path> [--data f.json|-] # generiskt
```
## Bygg (till ./build)
VS Code: **Run Build Task** (`Ctrl+Shift+B`) → `build`-tasken lägger en
körbar `tdarrctl` i `build/` (gitignoread). Manuellt:
```sh
mkdir -p build && install -m 0755 tdarrctl.py build/tdarrctl
./build/tdarrctl status
```
## Test / rök-koll
```sh
python3 -m py_compile tdarrctl.py # syntax
python3 tdarrctl.py status # når servern?
```
## Mer
- Plan & designbeslut: [`doc/plan.md`](doc/plan.md).
- Fördjupning (API-format, collections, exempel): repots **wiki**.