Convert all Subsonic API ints to int32 as per specification (#2252)
* Fix Genre * Fix ArtistID3 * Fix AlbumID3 * Fix Child * Fix NowPlayingEntry * Fix Playlist * Fix Share * Fix User * Fix Artist * Fix Directory * Fix Error
This commit is contained in:
+16
-16
@@ -85,8 +85,8 @@ func toArtist(r *http.Request, a model.Artist) responses.Artist {
|
||||
artist := responses.Artist{
|
||||
Id: a.ID,
|
||||
Name: a.Name,
|
||||
AlbumCount: a.AlbumCount,
|
||||
UserRating: a.Rating,
|
||||
AlbumCount: int32(a.AlbumCount),
|
||||
UserRating: int32(a.Rating),
|
||||
CoverArt: a.CoverArtID().String(),
|
||||
ArtistImageUrl: public.ImageURL(r, a.CoverArtID(), 600),
|
||||
}
|
||||
@@ -100,10 +100,10 @@ func toArtistID3(r *http.Request, a model.Artist) responses.ArtistID3 {
|
||||
artist := responses.ArtistID3{
|
||||
Id: a.ID,
|
||||
Name: a.Name,
|
||||
AlbumCount: a.AlbumCount,
|
||||
AlbumCount: int32(a.AlbumCount),
|
||||
CoverArt: a.CoverArtID().String(),
|
||||
ArtistImageUrl: public.ImageURL(r, a.CoverArtID(), 600),
|
||||
UserRating: a.Rating,
|
||||
UserRating: int32(a.Rating),
|
||||
}
|
||||
if a.Starred {
|
||||
artist.Starred = &a.StarredAt
|
||||
@@ -116,8 +116,8 @@ func toGenres(genres model.Genres) *responses.Genres {
|
||||
for i, g := range genres {
|
||||
response[i] = responses.Genre{
|
||||
Name: g.Name,
|
||||
SongCount: g.SongCount,
|
||||
AlbumCount: g.AlbumCount,
|
||||
SongCount: int32(g.SongCount),
|
||||
AlbumCount: int32(g.AlbumCount),
|
||||
}
|
||||
}
|
||||
return &responses.Genres{Genre: response}
|
||||
@@ -142,14 +142,14 @@ func childFromMediaFile(ctx context.Context, mf model.MediaFile) responses.Child
|
||||
child.IsDir = false
|
||||
child.Parent = mf.AlbumID
|
||||
child.Album = mf.Album
|
||||
child.Year = mf.Year
|
||||
child.Year = int32(mf.Year)
|
||||
child.Artist = mf.Artist
|
||||
child.Genre = mf.Genre
|
||||
child.Track = mf.TrackNumber
|
||||
child.Duration = int(mf.Duration)
|
||||
child.Track = int32(mf.TrackNumber)
|
||||
child.Duration = int32(mf.Duration)
|
||||
child.Size = mf.Size
|
||||
child.Suffix = mf.Suffix
|
||||
child.BitRate = mf.BitRate
|
||||
child.BitRate = int32(mf.BitRate)
|
||||
child.CoverArt = mf.CoverArtID().String()
|
||||
child.ContentType = mf.ContentType()
|
||||
player, ok := request.PlayerFrom(ctx)
|
||||
@@ -158,7 +158,7 @@ func childFromMediaFile(ctx context.Context, mf model.MediaFile) responses.Child
|
||||
} else {
|
||||
child.Path = fakePath(mf)
|
||||
}
|
||||
child.DiscNumber = mf.DiscNumber
|
||||
child.DiscNumber = int32(mf.DiscNumber)
|
||||
child.Created = &mf.CreatedAt
|
||||
child.AlbumId = mf.AlbumID
|
||||
child.ArtistId = mf.ArtistID
|
||||
@@ -170,7 +170,7 @@ func childFromMediaFile(ctx context.Context, mf model.MediaFile) responses.Child
|
||||
if mf.Starred {
|
||||
child.Starred = &mf.StarredAt
|
||||
}
|
||||
child.UserRating = mf.Rating
|
||||
child.UserRating = int32(mf.Rating)
|
||||
|
||||
format, _ := getTranscoding(ctx)
|
||||
if mf.Suffix != "" && format != "" && mf.Suffix != format {
|
||||
@@ -209,14 +209,14 @@ func childFromAlbum(_ context.Context, al model.Album) responses.Child {
|
||||
child.Name = al.Name
|
||||
child.Album = al.Name
|
||||
child.Artist = al.AlbumArtist
|
||||
child.Year = al.MaxYear
|
||||
child.Year = int32(al.MaxYear)
|
||||
child.Genre = al.Genre
|
||||
child.CoverArt = al.CoverArtID().String()
|
||||
child.Created = &al.CreatedAt
|
||||
child.Parent = al.AlbumArtistID
|
||||
child.ArtistId = al.AlbumArtistID
|
||||
child.Duration = int(al.Duration)
|
||||
child.SongCount = al.SongCount
|
||||
child.Duration = int32(al.Duration)
|
||||
child.SongCount = int32(al.SongCount)
|
||||
if al.Starred {
|
||||
child.Starred = &al.StarredAt
|
||||
}
|
||||
@@ -224,7 +224,7 @@ func childFromAlbum(_ context.Context, al model.Album) responses.Child {
|
||||
if al.PlayCount > 0 {
|
||||
child.Played = &al.PlayDate
|
||||
}
|
||||
child.UserRating = al.Rating
|
||||
child.UserRating = int32(al.Rating)
|
||||
return child
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user