Previously, an accidentally empty tonie folder combined with pruning
(the default) would delete every existing chapter on the tonie. Now:
- syncer.BuildPlan detects an empty local folder and returns a
Plan{Skipped: true, SkipReason: ...} instead of computing a diff
- syncer.ApplyPlan is a no-op for a skipped plan (defense in depth)
- Plan.NeedsChanges() reports false for skipped plans
- cmd/toni-sync sync prints "Skipped: <reason>" for such folders and
moves on, regardless of --no-prune
- Added a test covering the skip behavior end-to-end (BuildPlan +
ApplyPlan no-op)
- README documents the safety behavior
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The chapter order on the tonie is already fully API-controlled via
SortChaptersOfTonie/PATCH. This adds an explicit way to define that
order via an .m3u/.m3u8 file placed in the tonie folder, instead of
relying on alphabetical filenames:
- internal/syncer/playlist.go: finds a single playlist file in the
tonie folder, parses its entries (ignoring blanks/#-comments), and
reorders local tracks accordingly. Tracks not referenced by the
playlist are appended afterwards so nothing is silently dropped;
playlist entries without a matching local file are ignored.
Multiple playlist files in the same folder is an error (ambiguous
order).
- ListLocalTracks now prefers this playlist-defined order, falling
back to alphabetical filename order when no playlist is present.
- Tests covering playlist ordering, unreferenced-track handling,
missing entries, and the multiple-playlists error case.
- README documents the .m3u/.m3u8 convention.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Mappings between local playlist folders and Kreativ-Tonies are now
expressed purely through the filesystem instead of a YAML config:
<root>/<household_id>/<freier_name> [id=<tonie_id>]/*.mp3
- internal/library: discovers tonie folders from this structure
(Discover/Filter), and scaffolds it automatically from the
TonieCloud account (Scaffold), leaving already-existing folders
(matched by tonie id) untouched
- internal/syncer: decoupled from the removed config package via a
plain Target{TonieID, Folder, Prune} struct
- cmd/toni-sync: new `init --root PATH` command to scaffold the
library; `sync [FILTER] --root PATH` now discovers targets from the
folder tree instead of a config file; removed the `config` command
group entirely
- Unit tests for folder discovery, filtering, and scaffolding
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- 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>