Cache smart playlist refreshes for 5 seconds

This commit is contained in:
Deluan
2021-10-17 22:58:12 -04:00
committed by Deluan Quintão
parent d21932bd1b
commit 21da1df4ea
3 changed files with 22 additions and 10 deletions
+3 -3
View File
@@ -20,9 +20,9 @@ import (
//"order": "lastPlayed desc",
//"limit": 10
//}
type SmartPlaylist model.SmartPlaylist
type smartPlaylist model.SmartPlaylist
func (sp SmartPlaylist) AddCriteria(sql SelectBuilder) SelectBuilder {
func (sp smartPlaylist) AddCriteria(sql SelectBuilder) SelectBuilder {
sql = sql.Where(RuleGroup(sp.RuleGroup)).Limit(uint64(sp.Limit))
if order := sp.OrderBy(); order != "" {
sql = sql.OrderBy(order)
@@ -30,7 +30,7 @@ func (sp SmartPlaylist) AddCriteria(sql SelectBuilder) SelectBuilder {
return sql
}
func (sp SmartPlaylist) OrderBy() string {
func (sp smartPlaylist) OrderBy() string {
order := strings.ToLower(sp.Order)
for f, fieldDef := range fieldMap {
if strings.HasPrefix(order, f) {