Add support for artist 5-star rating in Subsonic API

This commit is contained in:
Deluan 2021-04-06 23:06:18 -04:00 committed by Joe Stump
parent 60e66ad6d6
commit e7082df09e
No known key found for this signature in database
GPG Key ID: 29151C3EC48A0EB9

View File

@ -49,13 +49,21 @@ func (c *MediaAnnotationController) SetRating(w http.ResponseWriter, r *http.Req
}
func (c *MediaAnnotationController) setRating(ctx context.Context, id string, rating int) error {
exist, err := c.ds.Album(ctx).Exists(id)
if err != nil {
var exist bool
var err error
if exist, err = c.ds.Artist(ctx).Exists(id); err != nil {
return err
} else if exist {
return c.ds.Artist(ctx).SetRating(rating, id)
}
if exist {
if exist, err = c.ds.Album(ctx).Exists(id); err != nil {
return err
} else if exist {
return c.ds.Album(ctx).SetRating(rating, id)
}
return c.ds.MediaFile(ctx).SetRating(rating, id)
}