Support m3u playlist files to define chapter order
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>
This commit is contained in:
@@ -94,8 +94,28 @@ Der Library-Root wird wie folgt bestimmt (erste zutreffende Option):
|
||||
|
||||
### 3. Audiodateien einsortieren & synchronisieren
|
||||
|
||||
Lege deine (legal exportierten) Audiodateien in den passenden Tonie-Ordner,
|
||||
z. B. `01 - Track.mp3`, `02 - Track.mp3`, ...
|
||||
Lege deine (legal exportierten) Audiodateien in den passenden Tonie-Ordner.
|
||||
Die Kapitelreihenfolge wird wie folgt bestimmt:
|
||||
|
||||
- **Mit Playlist:** Liegt genau eine `.m3u`/`.m3u8`-Datei im Tonie-Ordner,
|
||||
bestimmt deren Zeilenreihenfolge die Kapitelreihenfolge (Kommentare/`#`-Zeilen
|
||||
und Leerzeilen werden ignoriert, Pfade relativ zum Ordner). Dateien, die
|
||||
lokal existieren aber nicht in der Playlist stehen, werden trotzdem
|
||||
synchronisiert und ans Ende angehängt (nichts geht verloren). Einträge in
|
||||
der Playlist ohne passende Datei werden ignoriert. Liegen mehrere Playlist-
|
||||
Dateien im selben Ordner, bricht `sync` mit einem Fehler ab (Reihenfolge
|
||||
wäre sonst mehrdeutig).
|
||||
- **Ohne Playlist:** alphabetische Dateireihenfolge, z. B. `01 - Track.mp3`,
|
||||
`02 - Track.mp3`, ...
|
||||
|
||||
Beispiel `playlist.m3u`:
|
||||
|
||||
```
|
||||
#EXTM3U
|
||||
02 - Second Track.mp3
|
||||
01 - First Track.mp3
|
||||
03 - Third Track.mp3
|
||||
```
|
||||
|
||||
```bash
|
||||
# alle gefundenen Tonies synchronisieren
|
||||
@@ -110,7 +130,7 @@ toni-sync sync --root ~/Musik/tonies --dry-run
|
||||
|
||||
`sync` lädt neue Dateien hoch, entfernt Kapitel, die lokal nicht mehr
|
||||
existieren (abschaltbar via `--no-prune`), und sortiert die Kapitel passend
|
||||
zur lokalen Dateireihenfolge.
|
||||
zur lokalen Reihenfolge (Playlist-Datei falls vorhanden, sonst alphabetisch).
|
||||
|
||||
### Household-/Tonie-IDs nachschlagen
|
||||
|
||||
|
||||
Reference in New Issue
Block a user