fix: a file tagged with no release group joins the same-named album its folder holds
release / govulncheck (push) Successful in 16s
release / web (push) Successful in 1m20s
release / go (push) Successful in 1m31s
release / integration (push) Successful in 4m58s
release / android (push) Successful in 5m1s
release / Build signed APK (releases and dev) (push) Successful in 5m14s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 16s
release / Verify release artifacts (tag releases only) (push) Skipped
release / govulncheck (push) Successful in 16s
release / web (push) Successful in 1m20s
release / go (push) Successful in 1m31s
release / integration (push) Successful in 4m58s
release / android (push) Successful in 5m1s
release / Build signed APK (releases and dev) (push) Successful in 5m14s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 16s
release / Verify release artifacts (tag releases only) (push) Skipped
Under e45561e2 a file with no group tag took the oldest same-named album row,
which left three of Weezer's 1994 bonus tracks on the 2016 album. The lookup
now ranks same-named rows by how many tracks they hold from the file's
folder; tagReadVersion 8 re-places the existing ones.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -459,20 +459,29 @@ func TestScanner_SameTitledAlbumsOfTwoGroupsAreTwoAlbums_Integration(t *testing.
|
||||
t.Fatalf("albums by group = %v, want blue with 2 tracks and green with 1", got)
|
||||
}
|
||||
|
||||
// A bonus track tagged with no release group joins the album its folder
|
||||
// holds, whichever row is older.
|
||||
writeTestMP3(t, filepath.Join(root, "Weezer (2001)/02.mp3"), map[string]string{
|
||||
"TIT2": "Photograph (live)", "TPE1": "Weezer", "TALB": "Weezer",
|
||||
})
|
||||
if _, err := scanner.Scan(ctx, nil); err != nil {
|
||||
t.Fatalf("scan the bonus track: %v", err)
|
||||
}
|
||||
if got := albumsByGroup(); len(got) != 2 || got[blue] != 2 || got[green] != 2 {
|
||||
t.Fatalf("albums by group = %v, want the ungrouped 2001 bonus track on green", got)
|
||||
}
|
||||
|
||||
// The green track as the old lookup left it: on the blue album's row,
|
||||
// under an older tag-read version, its own album row gone.
|
||||
// under an older tag-read version.
|
||||
if _, err := pool.Exec(ctx, `
|
||||
WITH b AS (SELECT id FROM albums WHERE release_group_mbid = $1)
|
||||
UPDATE tracks SET album_id = (SELECT id FROM b), tag_read_version = 6 WHERE file_path = $2`, blue, greenPath); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, err := pool.Exec(ctx, `DELETE FROM albums WHERE release_group_mbid = $1`, green); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, err := scanner.Scan(ctx, nil); err != nil {
|
||||
t.Fatalf("rescan: %v", err)
|
||||
}
|
||||
if got := albumsByGroup(); len(got) != 2 || got[blue] != 2 || got[green] != 1 {
|
||||
if got := albumsByGroup(); len(got) != 2 || got[blue] != 2 || got[green] != 2 {
|
||||
t.Errorf("after the re-read, albums by group = %v, want the green track on its own album", got)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user