Drop Artist/Album/Title depth assumptions from layout checks

Matching has always been by relative path, so any folder layout works as
long as both libraries use the same one. Remove the depth and loose-root-file
warnings, which flagged valid layouts, and reword the UI and README to say
"same folder layout on both sides" with Artist/Album/Title.ext only as an
example. The "elsewhere" fallback is now described as same top-level folder,
different subfolder. Add a test covering flat and deeply nested layouts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
cdnutterandClaude Opus 5.5 committed 2026-09-22 16:48:55 -07:00
1 parent f49274360b
commit 75e0516434
9 files changed
+52 -33

No files matched your search

+25
View File
@@ -9,6 +9,7 @@ import (
"log/slog"
"os"
"path/filepath"
"strings"
"testing"
"time"
@@ -479,3 +480,27 @@ func TestNormTitle(t *testing.T) {
}
}
}
func TestAnyLayoutMatchesWithoutWarnings(t *testing.T) {
ev := setup(t, false)
// Flat files, deeper Genre/Artist/Album/Disc nesting: all fine as long as both sides agree.
for _, rel := range []string{"loose.flac", "Rock/Band/Album/Disc 1/01 - Song.flac", "Band/Song.flac"} {
ev.write(ev.host, rel, "same:"+rel)
ev.write(ev.slave, rel, "same:"+rel)
}
ev.scan()
for _, rel := range []string{"loose.flac", "Rock/Band/Album/Disc 1/01 - Song.flac", "Band/Song.flac"} {
if m := ev.match(rel); m.Status != store.StatusIdentical || m.Kind != store.KindPath {
t.Fatalf("%s: want identical/path, got %s/%s", rel, m.Status, m.Kind)
}
}
p, err := ev.st.Pair(ctx, ev.pair.ID)
if err != nil {
t.Fatal(err)
}
for _, w := range p.LastScanWarnings {
if strings.Contains(w, "layout") || strings.Contains(w, "folder") || strings.Contains(w, "depth") {
t.Fatalf("matching layouts must not produce layout warnings, got %q", w)
}
}
}