Rewrite toni-sync in Go

- Replace the Python implementation with a Go module compiling to a
  single static binary (no Python/pip runtime dependency)
- internal/tonieapi: minimal, dependency-light HTTP client for the
  TonieCloud REST API (login, households, creative tonies, file
  upload via presigned S3 request, chapter add/sort/clear)
- internal/config: YAML-based mapping of local playlist folders to
  Kreativ-Tonies, credentials never stored
- internal/syncer: diff/apply logic (upload new tracks, prune removed
  chapters, reorder to match local file order), built against a
  TonieClient interface for testability
- cmd/toni-sync: Cobra CLI with `tonies list`, `config add/list/remove`,
  `sync [NAME|--all] [--dry-run]`
- Unit tests for config persistence and syncer plan/apply logic

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-08-14 06:52:11 +02:00
co-authored by Copilot
parent 4860edf886
commit d003c32433
23 changed files with 1278 additions and 631 deletions
+27 -6
View File
@@ -2,8 +2,9 @@
Ein CLI-Tool zur Verwaltung von Kreativ-Tonies: Es synchronisiert lokale
Audio-Ordner (z. B. exportierte Deezer-Playlists) automatisch zu den
passenden Kreativ-Tonies über die inoffizielle TonieCloud-API
([`tonie-api`](https://pypi.org/project/tonie-api/)).
passenden Kreativ-Tonies über die inoffizielle TonieCloud-API. Geschrieben
in Go, kompiliert zu einer einzigen statischen Binary - keine Laufzeit-
Abhängigkeiten (kein Python/pip nötig).
> **Hinweis:** toni-sync lädt selbst keine Musik von Deezer herunter. Das
> Herunterladen/Umgehen von DRM-geschützten Streams verstößt gegen die
@@ -14,8 +15,18 @@ passenden Kreativ-Tonies über die inoffizielle TonieCloud-API
## Installation
Benötigt wird nur ein Go-Toolchain (>= 1.21) zum Bauen - danach ist das
Ergebnis eine einzelne Binary ohne weitere Abhängigkeiten:
```bash
pip install -e .
go build -o toni-sync ./cmd/toni-sync
./toni-sync --help
```
Oder direkt installieren (landet in `$(go env GOPATH)/bin`):
```bash
go install ./cmd/toni-sync
```
## Anmeldedaten
@@ -29,7 +40,7 @@ export TONI_SYNC_USERNAME="you@example.com"
export TONI_SYNC_PASSWORD="********"
```
Alternativ: `--username`/`--password` Optionen bei `tonies list` und `sync`.
Alternativ: `--username`/`--password` Flags bei `tonies list` und `sync`.
## Nutzung
@@ -93,9 +104,19 @@ die Kapitel passend zur lokalen Dateireihenfolge.
`.mp3`, `.m4a`, `.aac`, `.ogg`, `.flac`, `.wav`
## Projektstruktur
```
cmd/toni-sync/ CLI-Einstiegspunkt (Cobra-Kommandos)
internal/tonieapi/ Eigener, minimaler TonieCloud-API-Client
internal/config/ Laden/Speichern der Playlist<->Toni-Mappings (YAML)
internal/syncer/ Diff-/Apply-Logik zwischen lokalem Ordner und Tonie
```
## Entwicklung / Tests
```bash
pip install -e ".[dev]"
pytest
go build ./...
go vet ./...
go test ./...
```