Add played field to Subsonic API responses. Fix #1971

This is not an "official" field in the specification, but I guess it does not hurt to expose this ;)
This commit is contained in:
Deluan
2022-11-02 11:20:51 -04:00
parent 081cfe5a9f
commit ca2cb26d8e
3 changed files with 18 additions and 0 deletions
+6
View File
@@ -165,6 +165,9 @@ func childFromMediaFile(ctx context.Context, mf model.MediaFile) responses.Child
child.ArtistId = mf.ArtistID
child.Type = "music"
child.PlayCount = mf.PlayCount
if mf.PlayCount > 0 {
child.Played = &mf.PlayDate
}
if mf.Starred {
child.Starred = &mf.StarredAt
}
@@ -211,6 +214,9 @@ func childFromAlbum(ctx context.Context, al model.Album) responses.Child {
child.Starred = &al.StarredAt
}
child.PlayCount = al.PlayCount
if al.PlayCount > 0 {
child.Played = &al.PlayDate
}
child.UserRating = al.Rating
return child
}