Discussion #485: use SortName when sorting artist's albums by name

This commit is contained in:
Drew Weymouth
2026-01-25 09:00:28 -08:00
parent e6127ccc11
commit d681d87b31
5 changed files with 12 additions and 4 deletions
+1
View File
@@ -67,6 +67,7 @@ type Album struct {
ID string
CoverArtID string
Name string
SortName string
Duration time.Duration
ArtistIDs []string
ArtistNames []string
@@ -667,6 +667,7 @@ func fillAlbum(subAlbum *subsonic.AlbumID3, album *mediaprovider.Album) {
album.ID = subAlbum.ID
album.CoverArtID = subAlbum.CoverArt
album.Name = subAlbum.Name
album.SortName = subAlbum.SortName
album.Duration = time.Duration(subAlbum.Duration) * time.Second
album.ArtistIDs = artistIDs
album.ArtistNames = artistNames
+1 -1
View File
@@ -22,7 +22,7 @@ require (
github.com/quarckster/go-mpris-server v1.0.3
github.com/supersonic-app/fyne-lyrics v0.0.0-20250614151306-b1880a70a410
github.com/supersonic-app/go-mpv v0.1.1-0.20250822102843-7a8cde5f5449
github.com/supersonic-app/go-subsonic v0.0.0-20250917154259-2bbe535cf8f3
github.com/supersonic-app/go-subsonic v0.0.0-20260125165421-1efaa048a150
github.com/supersonic-app/go-upnpcast v0.0.0-20250330154256-b957204209a5
github.com/zalando/go-keyring v0.2.6
golang.org/x/net v0.38.0
+2 -2
View File
@@ -134,8 +134,8 @@ github.com/supersonic-app/go-glfw/v3.3/glfw v0.0.0-20250906235349-c09e5a2f6b75 h
github.com/supersonic-app/go-glfw/v3.3/glfw v0.0.0-20250906235349-c09e5a2f6b75/go.mod h1:SyRD8YfuKk+ZXlDqYiqe1qMSqjNgtHzBTG810KUagMc=
github.com/supersonic-app/go-mpv v0.1.1-0.20250822102843-7a8cde5f5449 h1:UHIPI43VzyWuIF8z8WVMdjMsC/orZTZQJraD/Iv+ghw=
github.com/supersonic-app/go-mpv v0.1.1-0.20250822102843-7a8cde5f5449/go.mod h1:1bQz6kBQumJopXEbkiqoLxIXLy7F7yWFBvknvpAtIC0=
github.com/supersonic-app/go-subsonic v0.0.0-20250917154259-2bbe535cf8f3 h1:RuCWkkDc0THP9Y5wbPG8q0Or5zT5cxfLdVzznX+hXbA=
github.com/supersonic-app/go-subsonic v0.0.0-20250917154259-2bbe535cf8f3/go.mod h1:ClhAgC2qobwH19D6kdwULLYSHlOmldDGkdu2G2Z0Ijo=
github.com/supersonic-app/go-subsonic v0.0.0-20260125165421-1efaa048a150 h1:Wh3EUdJI8bSr2nYtnkmG+bGNzEtGGSW3Rcg4eDM1a0M=
github.com/supersonic-app/go-subsonic v0.0.0-20260125165421-1efaa048a150/go.mod h1:ClhAgC2qobwH19D6kdwULLYSHlOmldDGkdu2G2Z0Ijo=
github.com/supersonic-app/go-upnpcast v0.0.0-20250330154256-b957204209a5 h1:aoUJKPFD/ZrNZjK6fl2Xhazwsttx42esKxhSSzEE3Bo=
github.com/supersonic-app/go-upnpcast v0.0.0-20250330154256-b957204209a5/go.mod h1:ibt19zDV5/vvF14jHJpTv3AOorq1EbmrMAubxnuvR5Y=
github.com/yuin/goldmark v1.7.8 h1:iERMLn0/QJeHFhxSt3p6PeN9mGnvIKSpG9YYorDMnic=
+7 -1
View File
@@ -276,7 +276,13 @@ func (a *ArtistPage) sortAlbumsSlices(slices ...[]*mediaprovider.Album) {
}
case discographySorts[2]: /*name*/
sortFunc = func(x, y int) bool {
return curSlice[x].Name < curSlice[y].Name
sortStr := func(a *mediaprovider.Album) string {
if a.SortName != "" {
return a.SortName
}
return a.Name
}
return sortStr(curSlice[x]) < sortStr(curSlice[y])
}
}