Skip to content

Commit

Permalink
Fix #432: use artist sort name if present to sort
Browse files Browse the repository at this point in the history
  • Loading branch information
dweymouth committed Jul 26, 2024
1 parent 0359d12 commit fdd4495
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
8 changes: 7 additions & 1 deletion backend/mediaprovider/subsonic/artistiterator.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,13 @@ func (s *subsonicMediaProvider) IterateArtists(sortOrder string, filter mediapro
func(artists []*subsonic.ArtistID3) []*subsonic.ArtistID3 {
c := collate.New(language.English, collate.Loose)
slices.SortFunc(artists, func(a, b *subsonic.ArtistID3) int {
return c.CompareString(a.Name, b.Name)
sortStr := func(a *subsonic.ArtistID3) string {
if a.SortName != "" {
return a.SortName
}
return a.Name
}
return c.CompareString(sortStr(a), sortStr(b))
})
return artists
},
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
github.com/dweymouth/fyne-lyrics v0.0.0-20240528234907-15eee7ce5e64
github.com/dweymouth/go-jellyfin v0.0.0-20240517151952-5ceca61cb645
github.com/dweymouth/go-mpv v0.0.0-20240724002347-c5e5b36f1bbf
github.com/dweymouth/go-subsonic v0.0.0-20240721002411-f2df85be66f1
github.com/dweymouth/go-subsonic v0.0.0-20240726004217-2e8e348ad417
github.com/godbus/dbus/v5 v5.1.0
github.com/google/uuid v1.3.0
github.com/pelletier/go-toml/v2 v2.0.8
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ github.com/dweymouth/go-jellyfin v0.0.0-20240517151952-5ceca61cb645 h1:KzqSaQwG3
github.com/dweymouth/go-jellyfin v0.0.0-20240517151952-5ceca61cb645/go.mod h1:fcUagHBaQnt06GmBAllNE0J4O/7064zXRWdqnTTtVjI=
github.com/dweymouth/go-mpv v0.0.0-20240724002347-c5e5b36f1bbf h1:QVjXWx7XGkSPOCEu5EL9QVY3fkdDSnG5KEkok5o1svM=
github.com/dweymouth/go-mpv v0.0.0-20240724002347-c5e5b36f1bbf/go.mod h1:Ov0ieN90M7i+0k3OxhA/g1dozGs+UcPHDsMKqPgRDk0=
github.com/dweymouth/go-subsonic v0.0.0-20240721002411-f2df85be66f1 h1:Ibjafpy6ds3DtmX43hxsnqiBR7mBcihl4IRq+jwlyJA=
github.com/dweymouth/go-subsonic v0.0.0-20240721002411-f2df85be66f1/go.mod h1:OWtcumdQsan8uM6wmx6PqKhldaCthH10CQ+vb+94kzo=
github.com/dweymouth/go-subsonic v0.0.0-20240726004217-2e8e348ad417 h1:VVVqQvHwm2K3+h8z4Tw3jYIDKETpEMR++XICdJDx0pE=
github.com/dweymouth/go-subsonic v0.0.0-20240726004217-2e8e348ad417/go.mod h1:OWtcumdQsan8uM6wmx6PqKhldaCthH10CQ+vb+94kzo=
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
Expand Down

0 comments on commit fdd4495

Please sign in to comment.