Add userRating to Subsonic Album/Artist responses. Closes #1486
This commit is contained in:
@@ -267,6 +267,7 @@ func (c *BrowsingController) GetArtistInfo2(w http.ResponseWriter, r *http.Reque
|
|||||||
similar.Name = s.Name
|
similar.Name = s.Name
|
||||||
similar.AlbumCount = s.AlbumCount
|
similar.AlbumCount = s.AlbumCount
|
||||||
similar.Starred = s.Starred
|
similar.Starred = s.Starred
|
||||||
|
similar.UserRating = s.UserRating
|
||||||
similar.ArtistImageUrl = s.ArtistImageUrl
|
similar.ArtistImageUrl = s.ArtistImageUrl
|
||||||
response.ArtistInfo2.SimilarArtist = append(response.ArtistInfo2.SimilarArtist, similar)
|
response.ArtistInfo2.SimilarArtist = append(response.ArtistInfo2.SimilarArtist, similar)
|
||||||
}
|
}
|
||||||
@@ -387,6 +388,7 @@ func (c *BrowsingController) buildAlbum(ctx context.Context, album *model.Album,
|
|||||||
dir.PlayCount = album.PlayCount
|
dir.PlayCount = album.PlayCount
|
||||||
dir.Year = album.MaxYear
|
dir.Year = album.MaxYear
|
||||||
dir.Genre = album.Genre
|
dir.Genre = album.Genre
|
||||||
|
dir.UserRating = album.Rating
|
||||||
if !album.CreatedAt.IsZero() {
|
if !album.CreatedAt.IsZero() {
|
||||||
dir.Created = &album.CreatedAt
|
dir.Created = &album.CreatedAt
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,6 +100,7 @@ func toArtistID3(ctx context.Context, a model.Artist) responses.ArtistID3 {
|
|||||||
Name: a.Name,
|
Name: a.Name,
|
||||||
AlbumCount: a.AlbumCount,
|
AlbumCount: a.AlbumCount,
|
||||||
ArtistImageUrl: a.ArtistImageUrl(),
|
ArtistImageUrl: a.ArtistImageUrl(),
|
||||||
|
UserRating: a.Rating,
|
||||||
}
|
}
|
||||||
if a.Starred {
|
if a.Starred {
|
||||||
artist.Starred = &a.StarredAt
|
artist.Starred = &a.StarredAt
|
||||||
|
|||||||
@@ -165,22 +165,24 @@ type ArtistID3 struct {
|
|||||||
CoverArt string `xml:"coverArt,attr,omitempty" json:"coverArt,omitempty"`
|
CoverArt string `xml:"coverArt,attr,omitempty" json:"coverArt,omitempty"`
|
||||||
AlbumCount int `xml:"albumCount,attr,omitempty" json:"albumCount,omitempty"`
|
AlbumCount int `xml:"albumCount,attr,omitempty" json:"albumCount,omitempty"`
|
||||||
Starred *time.Time `xml:"starred,attr,omitempty" json:"starred,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 {
|
type AlbumID3 struct {
|
||||||
Id string `xml:"id,attr" json:"id"`
|
Id string `xml:"id,attr" json:"id"`
|
||||||
Name string `xml:"name,attr" json:"name"`
|
Name string `xml:"name,attr" json:"name"`
|
||||||
Artist string `xml:"artist,attr,omitempty" json:"artist,omitempty"`
|
Artist string `xml:"artist,attr,omitempty" json:"artist,omitempty"`
|
||||||
ArtistId string `xml:"artistId,attr,omitempty" json:"artistId,omitempty"`
|
ArtistId string `xml:"artistId,attr,omitempty" json:"artistId,omitempty"`
|
||||||
CoverArt string `xml:"coverArt,attr,omitempty" json:"coverArt,omitempty"`
|
CoverArt string `xml:"coverArt,attr,omitempty" json:"coverArt,omitempty"`
|
||||||
SongCount int `xml:"songCount,attr,omitempty" json:"songCount,omitempty"`
|
SongCount int `xml:"songCount,attr,omitempty" json:"songCount,omitempty"`
|
||||||
Duration int `xml:"duration,attr,omitempty" json:"duration,omitempty"`
|
Duration int `xml:"duration,attr,omitempty" json:"duration,omitempty"`
|
||||||
PlayCount int64 `xml:"playCount,attr,omitempty" json:"playcount,omitempty"`
|
PlayCount int64 `xml:"playCount,attr,omitempty" json:"playcount,omitempty"`
|
||||||
Created *time.Time `xml:"created,attr,omitempty" json:"created,omitempty"`
|
Created *time.Time `xml:"created,attr,omitempty" json:"created,omitempty"`
|
||||||
Starred *time.Time `xml:"starred,attr,omitempty" json:"starred,omitempty"`
|
Starred *time.Time `xml:"starred,attr,omitempty" json:"starred,omitempty"`
|
||||||
Year int `xml:"year,attr,omitempty" json:"year,omitempty"`
|
UserRating int `xml:"userRating,attr,omitempty" json:"userRating,omitempty"`
|
||||||
Genre string `xml:"genre,attr,omitempty" json:"genre,omitempty"`
|
Year int `xml:"year,attr,omitempty" json:"year,omitempty"`
|
||||||
|
Genre string `xml:"genre,attr,omitempty" json:"genre,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ArtistWithAlbumsID3 struct {
|
type ArtistWithAlbumsID3 struct {
|
||||||
|
|||||||
Reference in New Issue
Block a user