- Config commands (config add/list/remove) to map local audio folders to Kreativ-Tonies via TonieCloud household/tonie ids - tonies list command to look up household/tonie ids - sync command: diff-based upload of new tracks, pruning of removed chapters, and reordering to match local file order (via tonie-api) - Credentials resolved via env vars/CLI flags/prompt, never stored - Unit tests for config persistence and sync planning/apply logic Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
102 lines
2.6 KiB
Markdown
102 lines
2.6 KiB
Markdown
# toni-sync
|
|
|
|
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/)).
|
|
|
|
> **Hinweis:** toni-sync lädt selbst keine Musik von Deezer herunter. Das
|
|
> Herunterladen/Umgehen von DRM-geschützten Streams verstößt gegen die
|
|
> Nutzungsbedingungen von Deezer und ggf. gegen Urheberrecht. Lege deine
|
|
> bereits legal exportierten Audiodateien einfach in die konfigurierten
|
|
> lokalen Ordner - toni-sync kümmert sich nur um den Abgleich mit der
|
|
> TonieCloud.
|
|
|
|
## Installation
|
|
|
|
```bash
|
|
pip install -e .
|
|
```
|
|
|
|
## Anmeldedaten
|
|
|
|
toni-sync benötigt deine TonieCloud-Zugangsdaten (dieselben wie in der
|
|
Tonies-App). Sie werden **nicht** gespeichert, sondern bei jedem Aufruf
|
|
über Umgebungsvariablen oder interaktiven Prompt abgefragt:
|
|
|
|
```bash
|
|
export TONI_SYNC_USERNAME="you@example.com"
|
|
export TONI_SYNC_PASSWORD="********"
|
|
```
|
|
|
|
Alternativ: `--username`/`--password` Optionen bei `tonies list` und `sync`.
|
|
|
|
## Nutzung
|
|
|
|
### 1. Household- und Tonie-IDs herausfinden
|
|
|
|
```bash
|
|
toni-sync tonies list
|
|
```
|
|
|
|
Beispielausgabe:
|
|
|
|
```
|
|
Household: Familie Müller [id=abcd-1234]
|
|
- Peppa Wutz [id=ef01-5678] (12 chapters, 3600s)
|
|
- Gute-Nacht-Geschichten [id=9876-4321] (0 chapters, 0s)
|
|
```
|
|
|
|
### 2. Playlist <-> Toni Mapping konfigurieren
|
|
|
|
```bash
|
|
toni-sync config add \
|
|
--name peppa-wutz \
|
|
--household-id abcd-1234 \
|
|
--tonie-id ef01-5678 \
|
|
--folder ~/Musik/deezer-export/peppa-wutz \
|
|
--playlist-ref "https://www.deezer.com/playlist/XXXXXXXXX"
|
|
```
|
|
|
|
Weitere Kommandos:
|
|
|
|
```bash
|
|
toni-sync config list
|
|
toni-sync config remove peppa-wutz
|
|
```
|
|
|
|
Konfiguration wird standardmäßig in `~/.config/toni-sync/config.yaml`
|
|
gespeichert (überschreibbar via `--config-path` oder `TONI_SYNC_CONFIG`).
|
|
|
|
### 3. Synchronisieren
|
|
|
|
Lege deine (legal exportierten) Audiodateien in den konfigurierten Ordner,
|
|
z. B. `01 - Track.mp3`, `02 - Track.mp3`, ... - die alphabetische
|
|
Dateireihenfolge bestimmt die Kapitelreihenfolge auf dem Tonie.
|
|
|
|
```bash
|
|
# einzelnes Mapping
|
|
toni-sync sync peppa-wutz
|
|
|
|
# alle Mappings
|
|
toni-sync sync --all
|
|
|
|
# nur anzeigen, was sich ändern würde
|
|
toni-sync sync --all --dry-run
|
|
```
|
|
|
|
`sync` lädt neue Dateien hoch, entfernt Kapitel, die lokal nicht mehr
|
|
existieren (abschaltbar via `--no-prune` bei `config add`), und sortiert
|
|
die Kapitel passend zur lokalen Dateireihenfolge.
|
|
|
|
## Unterstützte Audioformate
|
|
|
|
`.mp3`, `.m4a`, `.aac`, `.ogg`, `.flac`, `.wav`
|
|
|
|
## Entwicklung / Tests
|
|
|
|
```bash
|
|
pip install -e ".[dev]"
|
|
pytest
|
|
```
|