ctrlsubsonic: add byGenre to ServeGetAlbumListTwo

This commit is contained in:
Duncan Overbruck
2020-03-02 16:48:01 +01:00
parent 14d68f748c
commit a0d8e7c6df

View File

@@ -115,6 +115,8 @@ func (c *Controller) ServeGetAlbumListTwo(r *http.Request) *spec.Response {
params.GetIntOr("fromYear", 1800),
params.GetIntOr("toYear", 2200))
q = q.Order("tag_year")
case "byGenre":
q = q.Joins("JOIN genres ON albums.tag_genre_id=genres.id AND genres.name=?", params.GetOr("genre", "Unknown Genre"))
case "frequent":
user := r.Context().Value(CtxUser).(*db.User)
q = q.Joins("JOIN plays ON albums.id=plays.album_id AND plays.user_id=?",