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

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:
2026-10-20 14:44:45 -04:00
co-authored by Claude Opus 5.5
parent e45561e282
commit 210f884b2d
4 changed files with 52 additions and 22 deletions
+7 -4
View File
@@ -78,7 +78,10 @@ var audioExtensions = map[string]bool{
// (resolveAlbum). Weezer's six self-titled albums were one 118-track row,
// so their merges, wants and upgrades all counted as one album; a re-read
// files each existing track under its own album.
const tagReadVersion int16 = 7
// 8: a file tagged with no release group joins the same-named album that
// already holds a track from its folder. Under 7 it took the oldest row,
// which left three of Weezer's 1994 bonus tracks on the 2016 album.
const tagReadVersion int16 = 8
type Stats struct {
Scanned int `json:"scanned"`
@@ -319,7 +322,7 @@ func (s *Scanner) scanFile(
if err != nil {
return pgtype.UUID{}, false, fmt.Errorf("artist: %w", err)
}
album, err := s.resolveAlbum(ctx, q, artist.ID, albumTitle, meta.Year(), albumMBID, releaseGroupMBID)
album, err := s.resolveAlbum(ctx, q, artist.ID, albumTitle, meta.Year(), albumMBID, releaseGroupMBID, filepath.Dir(path))
if err != nil {
return pgtype.UUID{}, false, fmt.Errorf("album: %w", err)
}
@@ -565,8 +568,8 @@ func (s *Scanner) resolveArtist(ctx context.Context, q *dbq.Queries, name, mbid
return artist, nil
}
func (s *Scanner) resolveAlbum(ctx context.Context, q *dbq.Queries, artistID pgtype.UUID, title string, year int, mbid, releaseGroupMBID string) (dbq.Album, error) {
lookup := dbq.GetAlbumByArtistAndTitleParams{ArtistID: artistID, Title: title}
func (s *Scanner) resolveAlbum(ctx context.Context, q *dbq.Queries, artistID pgtype.UUID, title string, year int, mbid, releaseGroupMBID, dir string) (dbq.Album, error) {
lookup := dbq.GetAlbumByArtistAndTitleParams{ArtistID: artistID, Title: title, Dir: dir}
if releaseGroupMBID != "" {
rg := releaseGroupMBID
lookup.ReleaseGroupMbid = &rg