mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-04 13:07:36 +03:00
Use order/sort album/artist when sorting tracks in playlists. Fixes #2819
This commit is contained in:
parent
bf2bcb1279
commit
6d253225de
1 changed files with 9 additions and 1 deletions
|
@ -5,6 +5,7 @@ import (
|
||||||
|
|
||||||
. "github.com/Masterminds/squirrel"
|
. "github.com/Masterminds/squirrel"
|
||||||
"github.com/deluan/rest"
|
"github.com/deluan/rest"
|
||||||
|
"github.com/navidrome/navidrome/conf"
|
||||||
"github.com/navidrome/navidrome/log"
|
"github.com/navidrome/navidrome/log"
|
||||||
"github.com/navidrome/navidrome/model"
|
"github.com/navidrome/navidrome/model"
|
||||||
"github.com/navidrome/navidrome/utils/slice"
|
"github.com/navidrome/navidrome/utils/slice"
|
||||||
|
@ -26,8 +27,15 @@ func (r *playlistRepository) Tracks(playlistId string, refreshSmartPlaylist bool
|
||||||
p.db = r.db
|
p.db = r.db
|
||||||
p.tableName = "playlist_tracks"
|
p.tableName = "playlist_tracks"
|
||||||
p.sortMappings = map[string]string{
|
p.sortMappings = map[string]string{
|
||||||
"id": "playlist_tracks.id",
|
"id": "playlist_tracks.id",
|
||||||
|
"artist": "order_artist_name asc",
|
||||||
|
"album": "order_album_name asc, order_album_artist_name asc",
|
||||||
}
|
}
|
||||||
|
if conf.Server.PreferSortTags {
|
||||||
|
p.sortMappings["artist"] = "COALESCE(NULLIF(sort_artist_name,''),order_artist_name) asc"
|
||||||
|
p.sortMappings["album"] = "COALESCE(NULLIF(sort_album_name,''),order_album_name)"
|
||||||
|
}
|
||||||
|
|
||||||
pls, err := r.Get(playlistId)
|
pls, err := r.Get(playlistId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(r.ctx, "Error getting playlist's tracks - THIS SHOULD NOT HAPPEN!", "playlistId", playlistId, err)
|
log.Error(r.ctx, "Error getting playlist's tracks - THIS SHOULD NOT HAPPEN!", "playlistId", playlistId, err)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue