feat(subsonic): support dsub edgecase for queries by decade
* Found a podcast that returns 403 without a UserAgent string so I added one. URL is https://feeds.buzzsprout.com/132359.rss * Fixed lint issues including needed error checking. * DSub swaps fromYear and toYear so swap them back in that case. TBD -- fix the same logic in ServeGetRandomSongs
This commit is contained in:
@@ -115,10 +115,12 @@ func (c *Controller) ServeGetAlbumList(r *http.Request) *spec.Response {
|
|||||||
case "alphabeticalByName":
|
case "alphabeticalByName":
|
||||||
q = q.Order("right_path")
|
q = q.Order("right_path")
|
||||||
case "byYear":
|
case "byYear":
|
||||||
q = q.Where(
|
fromYear := params.GetOrInt("fromYear", 1800)
|
||||||
"tag_year BETWEEN ? AND ?",
|
toYear := params.GetOrInt("toYear", 2200)
|
||||||
params.GetOrInt("fromYear", 1800),
|
if fromYear > toYear {
|
||||||
params.GetOrInt("toYear", 2200))
|
toYear, fromYear = fromYear, toYear
|
||||||
|
}
|
||||||
|
q = q.Where("tag_year BETWEEN ? AND ?", fromYear, toYear)
|
||||||
q = q.Order("tag_year")
|
q = q.Order("tag_year")
|
||||||
case "byGenre":
|
case "byGenre":
|
||||||
genre, _ := params.Get("genre")
|
genre, _ := params.Get("genre")
|
||||||
|
|||||||
@@ -125,10 +125,12 @@ func (c *Controller) ServeGetAlbumListTwo(r *http.Request) *spec.Response {
|
|||||||
case "alphabeticalByName":
|
case "alphabeticalByName":
|
||||||
q = q.Order("tag_title")
|
q = q.Order("tag_title")
|
||||||
case "byYear":
|
case "byYear":
|
||||||
q = q.Where(
|
fromYear := params.GetOrInt("fromYear", 1800)
|
||||||
"tag_year BETWEEN ? AND ?",
|
toYear := params.GetOrInt("toYear", 2200)
|
||||||
params.GetOrInt("fromYear", 1800),
|
if fromYear > toYear {
|
||||||
params.GetOrInt("toYear", 2200))
|
toYear, fromYear = fromYear, toYear
|
||||||
|
}
|
||||||
|
q = q.Where("tag_year BETWEEN ? AND ?", fromYear, toYear)
|
||||||
q = q.Order("tag_year")
|
q = q.Order("tag_year")
|
||||||
case "byGenre":
|
case "byGenre":
|
||||||
genre, _ := params.Get("genre")
|
genre, _ := params.Get("genre")
|
||||||
|
|||||||
Reference in New Issue
Block a user