🎧 Your Personal Streaming Service
Go airsonicmadsonicmedia-servermusicmusic-servernavidromeopensubsonicraspberry-piself-hostedstreamerstreaming-apistreaming-audiosubsonicsubsonic-server
Add userRating to Subsonic Album/Artist responses. Closes #1486
Deluan30d3f1eda0f5
diff --git a/server/subsonic/browsing.go b/server/subsonic/browsing.goindex 7caa959f5..52a48cca3 100644--- a/server/subsonic/browsing.go+++ b/server/subsonic/browsing.go@@ -267,6 +267,7 @@ func (c *BrowsingController) GetArtistInfo2(w http.ResponseWriter, r *http.Requesimilar.Name = s.Namesimilar.AlbumCount = s.AlbumCountsimilar.Starred = s.Starred+ similar.UserRating = s.UserRatingsimilar.ArtistImageUrl = s.ArtistImageUrlresponse.ArtistInfo2.SimilarArtist = append(response.ArtistInfo2.SimilarArtist, similar)}@@ -387,6 +388,7 @@ func (c *BrowsingController) buildAlbum(ctx context.Context, album *model.Album,dir.PlayCount = album.PlayCountdir.Year = album.MaxYeardir.Genre = album.Genre+ dir.UserRating = album.Ratingif !album.CreatedAt.IsZero() {dir.Created = &album.CreatedAt}diff --git a/server/subsonic/helpers.go b/server/subsonic/helpers.goindex a79442e7a..a1b9e2ff9 100644--- a/server/subsonic/helpers.go+++ b/server/subsonic/helpers.go@@ -100,6 +100,7 @@ func toArtistID3(ctx context.Context, a model.Artist) responses.ArtistID3 {Name: a.Name,AlbumCount: a.AlbumCount,ArtistImageUrl: a.ArtistImageUrl(),+ UserRating: a.Rating,}if a.Starred {artist.Starred = &a.StarredAtdiff --git a/server/subsonic/responses/responses.go b/server/subsonic/responses/responses.goindex 3b9461f1c..2e82cc82f 100644--- a/server/subsonic/responses/responses.go+++ b/server/subsonic/responses/responses.go@@ -165,22 +165,24 @@ type ArtistID3 struct {CoverArt string `xml:"coverArt,attr,omitempty" json:"coverArt,omitempty"`AlbumCount int `xml:"albumCount,attr,omitempty" json:"albumCount,omitempty"`Starred *time.Time `xml:"starred,attr,omitempty" json:"starred,omitempty"`- ArtistImageUrl string `xml:"artistImageUrl,attr,omitempty" json:"artistImageUrl,omitempty"`+ UserRating int `xml:"userRating,attr,omitempty" json:"userRating,omitempty"`+ ArtistImageUrl string `xml:"artistImageUrl,attr,omitempty" json:"artistImageUrl,omitempty"`}type AlbumID3 struct {- Id string `xml:"id,attr" json:"id"`- Name string `xml:"name,attr" json:"name"`- Artist string `xml:"artist,attr,omitempty" json:"artist,omitempty"`- ArtistId string `xml:"artistId,attr,omitempty" json:"artistId,omitempty"`- CoverArt string `xml:"coverArt,attr,omitempty" json:"coverArt,omitempty"`- SongCount int `xml:"songCount,attr,omitempty" json:"songCount,omitempty"`- Duration int `xml:"duration,attr,omitempty" json:"duration,omitempty"`- PlayCount int64 `xml:"playCount,attr,omitempty" json:"playcount,omitempty"`- Created *time.Time `xml:"created,attr,omitempty" json:"created,omitempty"`- Starred *time.Time `xml:"starred,attr,omitempty" json:"starred,omitempty"`- Year int `xml:"year,attr,omitempty" json:"year,omitempty"`- Genre string `xml:"genre,attr,omitempty" json:"genre,omitempty"`+ Id string `xml:"id,attr" json:"id"`+ Name string `xml:"name,attr" json:"name"`+ Artist string `xml:"artist,attr,omitempty" json:"artist,omitempty"`+ ArtistId string `xml:"artistId,attr,omitempty" json:"artistId,omitempty"`+ CoverArt string `xml:"coverArt,attr,omitempty" json:"coverArt,omitempty"`+ SongCount int `xml:"songCount,attr,omitempty" json:"songCount,omitempty"`+ Duration int `xml:"duration,attr,omitempty" json:"duration,omitempty"`+ PlayCount int64 `xml:"playCount,attr,omitempty" json:"playcount,omitempty"`+ Created *time.Time `xml:"created,attr,omitempty" json:"created,omitempty"`+ Starred *time.Time `xml:"starred,attr,omitempty" json:"starred,omitempty"`+ UserRating int `xml:"userRating,attr,omitempty" json:"userRating,omitempty"`+ Year int `xml:"year,attr,omitempty" json:"year,omitempty"`+ Genre string `xml:"genre,attr,omitempty" json:"genre,omitempty"`}type ArtistWithAlbumsID3 struct {