fix: set album track totals

This commit is contained in:
2026-07-12 03:28:27 +02:00
parent 99c531928e
commit e336bb96f1
2 changed files with 19 additions and 0 deletions
+3
View File
@@ -1399,6 +1399,9 @@ func buildTagMetadata(trackMeta map[string]any, title, source, trackID string, o
if trackTotal == 0 {
trackTotal = jsonutil.IntFromAny(trackMeta["track_total"])
}
if trackTotal == 0 && opts.total > 0 {
trackTotal = opts.total
}
if opts.forPlaylist && opts.total > 0 {
trackTotal = opts.total
}
+16
View File
@@ -490,6 +490,22 @@ func TestBuildTagMetadataUsesAlbumArtistOverride(t *testing.T) {
}
}
func TestBuildTagMetadataUsesAlbumContextTrackTotal(t *testing.T) {
meta := map[string]any{
"title": "ideal world (feat. higma)",
"track_number": float64(2),
"performer": map[string]any{"name": "Seren Azuma"},
"album": map[string]any{
"title": "YUKIHASU",
"artist": map[string]any{"name": "Seren Azuma"},
},
}
tags := buildTagMetadata(meta, "ideal world (feat. higma)", "qobuz", "295525879", ripTrackOptions{total: 11})
if tags.TrackTotal != 11 {
t.Fatalf("track total = %d, want 11", tags.TrackTotal)
}
}
func TestBuildTagMetadataPlaylistOmitsDiscTags(t *testing.T) {
meta := map[string]any{
"title": "One Step Too Far",