Fix tracks never "loved" to be selected in Smart Playlists. Refer to https://github.com/navidrome/navidrome/issues/1417#issuecomment-1163423575
This commit is contained in:
@@ -38,12 +38,12 @@ var fieldMap = map[string]*mappedField{
|
||||
"bpm": {field: "media_file.bpm"},
|
||||
"channels": {field: "media_file.channels"},
|
||||
"genre": {field: "genre.name"},
|
||||
"loved": {field: "annotation.starred"},
|
||||
"loved": {field: "COALESCE(annotation.starred, false)"},
|
||||
"dateloved": {field: "annotation.starred_at"},
|
||||
"lastplayed": {field: "annotation.play_date"},
|
||||
"playcount": {field: "COALESCE(annotation.play_count, 0)", order: "annotation.play_count"},
|
||||
"rating": {field: "COALESCE(annotation.rating, 0)", order: "annotation.rating"},
|
||||
"random": {field: "-", order: "random()"},
|
||||
"playcount": {field: "COALESCE(annotation.play_count, 0)"},
|
||||
"rating": {field: "COALESCE(annotation.rating, 0)"},
|
||||
"random": {field: "", order: "random()"},
|
||||
}
|
||||
|
||||
type mappedField struct {
|
||||
@@ -54,7 +54,7 @@ type mappedField struct {
|
||||
func mapFields(expr map[string]interface{}) map[string]interface{} {
|
||||
m := make(map[string]interface{})
|
||||
for f, v := range expr {
|
||||
if dbf := fieldMap[strings.ToLower(f)]; dbf != nil {
|
||||
if dbf := fieldMap[strings.ToLower(f)]; dbf != nil && dbf.field != "" {
|
||||
m[dbf.field] = v
|
||||
} else {
|
||||
log.Error("Invalid field in criteria", "field", f)
|
||||
|
||||
Reference in New Issue
Block a user