From 6e2d4f73c53ab908b5933cfbbc1ffc97584e0a08 Mon Sep 17 00:00:00 2001 From: sentriz Date: Mon, 23 Aug 2021 21:30:11 +0100 Subject: [PATCH] feat: support filter by year in browse by folder mode --- server/ctrlsubsonic/handlers_by_folder.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/server/ctrlsubsonic/handlers_by_folder.go b/server/ctrlsubsonic/handlers_by_folder.go index 988e8fe..8b61aab 100644 --- a/server/ctrlsubsonic/handlers_by_folder.go +++ b/server/ctrlsubsonic/handlers_by_folder.go @@ -106,6 +106,12 @@ func (c *Controller) ServeGetAlbumList(r *http.Request) *spec.Response { q = q.Order("parent_albums.right_path") case "alphabeticalByName": q = q.Order("right_path") + case "byYear": + q = q.Where( + "tag_year BETWEEN ? AND ?", + params.GetOrInt("toYear", 2200), + params.GetOrInt("fromYear", 1800)) + q = q.Order("tag_year") case "frequent": user := r.Context().Value(CtxUser).(*db.User) q = q.Joins(`