mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-05 13:37:38 +03:00
Fix getAlbumList.byYear
. See https://github.com/daneren2005/Subsonic/issues/967
This commit is contained in:
parent
62ed30afed
commit
b88f9013dc
2 changed files with 9 additions and 4 deletions
|
@ -21,7 +21,7 @@ func NewAlbumListController(listGen engine.ListGenerator) *AlbumListController {
|
||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *AlbumListController) getNewAlbumList(r *http.Request) (engine.Entries, error) {
|
func (c *AlbumListController) getAlbumList(r *http.Request) (engine.Entries, error) {
|
||||||
typ, err := requiredParamString(r, "type", "Required string parameter 'type' is not present")
|
typ, err := requiredParamString(r, "type", "Required string parameter 'type' is not present")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -67,7 +67,7 @@ func (c *AlbumListController) getNewAlbumList(r *http.Request) (engine.Entries,
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *AlbumListController) GetAlbumList(w http.ResponseWriter, r *http.Request) (*responses.Subsonic, error) {
|
func (c *AlbumListController) GetAlbumList(w http.ResponseWriter, r *http.Request) (*responses.Subsonic, error) {
|
||||||
albums, err := c.getNewAlbumList(r)
|
albums, err := c.getAlbumList(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, newError(responses.ErrorGeneric, err.Error())
|
return nil, newError(responses.ErrorGeneric, err.Error())
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ func (c *AlbumListController) GetAlbumList(w http.ResponseWriter, r *http.Reques
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *AlbumListController) GetAlbumList2(w http.ResponseWriter, r *http.Request) (*responses.Subsonic, error) {
|
func (c *AlbumListController) GetAlbumList2(w http.ResponseWriter, r *http.Request) (*responses.Subsonic, error) {
|
||||||
albums, err := c.getNewAlbumList(r)
|
albums, err := c.getAlbumList(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, newError(responses.ErrorGeneric, err.Error())
|
return nil, newError(responses.ErrorGeneric, err.Error())
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,8 +61,13 @@ func ByGenre(genre string) ListFilter {
|
||||||
}
|
}
|
||||||
|
|
||||||
func ByYear(fromYear, toYear int) ListFilter {
|
func ByYear(fromYear, toYear int) ListFilter {
|
||||||
|
sortOption := "max_year, name"
|
||||||
|
if fromYear > toYear {
|
||||||
|
fromYear, toYear = toYear, fromYear
|
||||||
|
sortOption = "max_year desc, name"
|
||||||
|
}
|
||||||
return ListFilter{
|
return ListFilter{
|
||||||
Sort: "max_year, name",
|
Sort: sortOption,
|
||||||
Filters: squirrel.Or{
|
Filters: squirrel.Or{
|
||||||
squirrel.And{
|
squirrel.And{
|
||||||
squirrel.GtOrEq{"min_year": fromYear},
|
squirrel.GtOrEq{"min_year": fromYear},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue