Make sorting lists by name/title case-insensitive (#2993)
* Make sort by order_* fields case-insensitive. * Sort internet radios by name case-insensitive
This commit is contained in:
@@ -85,6 +85,7 @@ func NewAlbumRepository(ctx context.Context, db dbx.Builder) model.AlbumReposito
|
||||
r.sortMappings = map[string]string{
|
||||
"name": "order_album_name asc, order_album_artist_name asc",
|
||||
"artist": "compilation asc, order_album_artist_name asc, order_album_name asc",
|
||||
"albumArtist": "compilation asc, order_album_artist_name asc, order_album_name asc",
|
||||
"max_year": "coalesce(nullif(original_date,''), cast(max_year as text)), release_date, name, order_album_name asc",
|
||||
"random": "RANDOM()",
|
||||
"recently_added": recentlyAddedSort(),
|
||||
|
||||
@@ -41,6 +41,7 @@ func NewMediaFileRepository(ctx context.Context, db dbx.Builder) *mediaFileRepos
|
||||
}
|
||||
} else {
|
||||
r.sortMappings = map[string]string{
|
||||
"title": "order_title",
|
||||
"artist": "order_artist_name asc, order_album_name asc, release_date asc, disc_number asc, track_number asc",
|
||||
"album": "order_album_name asc, release_date asc, disc_number asc, track_number asc, order_artist_name asc, title asc",
|
||||
"random": "RANDOM()",
|
||||
|
||||
@@ -30,10 +30,12 @@ func (r *playlistRepository) Tracks(playlistId string, refreshSmartPlaylist bool
|
||||
"id": "playlist_tracks.id",
|
||||
"artist": "order_artist_name asc",
|
||||
"album": "order_album_name asc, order_album_artist_name asc",
|
||||
"title": "order_title",
|
||||
}
|
||||
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)"
|
||||
p.sortMappings["title"] = "COALESCE(NULLIF(sort_title,''),title)"
|
||||
}
|
||||
|
||||
pls, err := r.Get(playlistId)
|
||||
|
||||
@@ -26,6 +26,9 @@ func NewRadioRepository(ctx context.Context, db dbx.Builder) model.RadioReposito
|
||||
r.filterMappings = map[string]filterFunc{
|
||||
"name": containsFilter,
|
||||
}
|
||||
r.sortMappings = map[string]string{
|
||||
"name": "(name collate nocase), name",
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user