Fix ServeGetArtists and ServeGetStarred to conform to spec more

This commit is contained in:
2026-02-17 15:45:37 +01:00
parent 4fff4185b5
commit 3836e97ccb
7 changed files with 100 additions and 75 deletions

No files matched your search

+4 -3
View File
@@ -334,7 +334,7 @@ func (c *Controller) ServeGetRandomSongs(r *http.Request) *spec.Response {
q = q.Joins("JOIN track_genres ON track_genres.track_id=tracks.id")
q = q.Joins("JOIN genres ON genres.id=track_genres.genre_id AND genres.name=?", genre)
}
if m := getMusicFolder(c.musicPaths, params); m != "" {
if m := getMusicFolder(c, params); m != "" {
q = q.Where("albums.root_dir=?", m)
}
if err := q.Find(&tracks).Error; err != nil {
@@ -777,10 +777,11 @@ func scrobbleStatsUpdatePodcastEpisode(dbc *db.DB, peID int) error {
return nil
}
func getMusicFolder(musicPaths []MusicPath, p params.Params) string {
func getMusicFolder(c *Controller, p params.Params) string {
musicPaths := c.musicPaths
idx, err := p.GetInt("musicFolderId")
if err != nil {
return ""
return c.defaultMusicPath
}
if idx < 0 || idx >= len(musicPaths) {
return os.DevNull