From ec55f3b22a8c689cbd2305965b3c538f5c2bf25f Mon Sep 17 00:00:00 2001 From: sentriz Date: Thu, 18 Jan 2024 21:10:19 +0000 Subject: [PATCH] feat(subsonic): return `playCount` in album responses closes #458 --- db/db.go | 1 + server/ctrlsubsonic/handlers_by_tags.go | 9 +- server/ctrlsubsonic/spec/construct_by_tags.go | 3 + server/ctrlsubsonic/spec/spec.go | 1 + .../testdata/test_get_album_list_alpha_artist | 27 ++-- .../testdata/test_get_album_list_alpha_name | 27 ++-- .../testdata/test_get_album_list_newest | 27 ++-- .../testdata/test_get_album_list_random | 121 +++++++++-------- .../test_get_album_list_two_alpha_artist | 9 ++ .../test_get_album_list_two_alpha_name | 9 ++ .../testdata/test_get_album_list_two_newest | 9 ++ .../testdata/test_get_album_list_two_random | 123 ++++++++++-------- .../testdata/test_get_album_with_cover | 1 + .../testdata/test_get_album_without_cover | 3 +- .../testdata/test_get_artist_id_one | 3 + .../testdata/test_get_artist_id_three | 3 + .../testdata/test_get_artist_id_two | 3 + .../testdata/test_search_three_q_alb | 9 ++ 18 files changed, 245 insertions(+), 143 deletions(-) diff --git a/db/db.go b/db/db.go index 9f0ff60b..0b60c084 100644 --- a/db/db.go +++ b/db/db.go @@ -339,6 +339,7 @@ type Album struct { AlbumStar *AlbumStar AlbumRating *AlbumRating AverageRating float64 `sql:"default: null"` + Play *Play } func (a *Album) SID() *specid.ID { diff --git a/server/ctrlsubsonic/handlers_by_tags.go b/server/ctrlsubsonic/handlers_by_tags.go index 5a2fa8f2..3f5da918 100644 --- a/server/ctrlsubsonic/handlers_by_tags.go +++ b/server/ctrlsubsonic/handlers_by_tags.go @@ -117,6 +117,8 @@ func (c *Controller) ServeGetAlbum(r *http.Request) *spec.Response { }). Preload("AlbumStar", "user_id=?", user.ID). Preload("AlbumRating", "user_id=?", user.ID). + Preload("AlbumRating", "user_id=?", user.ID). + Preload("Play", "user_id=?", user.ID). First(album, id.Value). Error if errors.Is(err, gorm.ErrRecordNotFound) { @@ -199,6 +201,7 @@ func (c *Controller) ServeGetAlbumListTwo(r *http.Request) *spec.Response { Preload("Artists"). Preload("AlbumStar", "user_id=?", user.ID). Preload("AlbumRating", "user_id=?", user.ID). + Preload("Play", "user_id=?", user.ID). Find(&albums) sub := spec.NewResponse() sub.AlbumsTwo = &spec.Albums{ @@ -256,7 +259,8 @@ func (c *Controller) ServeSearchThree(r *http.Request) *spec.Response { Preload("Artists"). Preload("Genres"). Preload("AlbumStar", "user_id=?", user.ID). - Preload("AlbumRating", "user_id=?", user.ID) + Preload("AlbumRating", "user_id=?", user.ID). + Preload("Play", "user_id=?", user.ID) for _, s := range queries { q = q.Where(`tag_title LIKE ? OR tag_title_u_dec LIKE ?`, s, s) } @@ -517,7 +521,8 @@ func (c *Controller) ServeGetStarredTwo(r *http.Request) *spec.Response { Order("album_stars.star_date DESC"). Preload("Artists"). Preload("AlbumStar", "user_id=?", user.ID). - Preload("AlbumRating", "user_id=?", user.ID) + Preload("AlbumRating", "user_id=?", user.ID). + Preload("Play", "user_id=?", user.ID) if m := getMusicFolder(c.musicPaths, params); m != "" { q = q.Where("albums.root_dir=?", m) } diff --git a/server/ctrlsubsonic/spec/construct_by_tags.go b/server/ctrlsubsonic/spec/construct_by_tags.go index 07d64c7f..a3d84577 100644 --- a/server/ctrlsubsonic/spec/construct_by_tags.go +++ b/server/ctrlsubsonic/spec/construct_by_tags.go @@ -51,6 +51,9 @@ func NewAlbumByTags(a *db.Album, artists []*db.Artist) *Album { for _, g := range a.Genres { ret.Genres = append(ret.Genres, &GenreRef{Name: g.Name}) } + if a.Play != nil { + ret.PlayCount = a.Play.Count + } return ret } diff --git a/server/ctrlsubsonic/spec/spec.go b/server/ctrlsubsonic/spec/spec.go index d48d92ee..757234d0 100644 --- a/server/ctrlsubsonic/spec/spec.go +++ b/server/ctrlsubsonic/spec/spec.go @@ -144,6 +144,7 @@ type Album struct { Name string `xml:"name,attr" json:"name"` TrackCount int `xml:"songCount,attr" json:"songCount"` Duration int `xml:"duration,attr" json:"duration"` + PlayCount int `xml:"playCount,attr" json:"playCount"` Genre string `xml:"genre,attr,omitempty" json:"genre,omitempty"` Genres []*GenreRef `xml:"genres,omitempty" json:"genres,omitempty"` Year int `xml:"year,attr,omitempty" json:"year,omitempty"` diff --git a/server/ctrlsubsonic/testdata/test_get_album_list_alpha_artist b/server/ctrlsubsonic/testdata/test_get_album_list_alpha_artist index 81f84c6a..7654a864 100644 --- a/server/ctrlsubsonic/testdata/test_get_album_list_alpha_artist +++ b/server/ctrlsubsonic/testdata/test_get_album_list_alpha_artist @@ -20,7 +20,8 @@ "coverArt": "al-3", "name": "album-0", "songCount": 3, - "duration": 300 + "duration": 300, + "playCount": 0 }, { "id": "al-4", @@ -35,7 +36,8 @@ "coverArt": "al-4", "name": "album-1", "songCount": 3, - "duration": 300 + "duration": 300, + "playCount": 0 }, { "id": "al-5", @@ -50,7 +52,8 @@ "coverArt": "al-5", "name": "album-2", "songCount": 3, - "duration": 300 + "duration": 300, + "playCount": 0 }, { "id": "al-7", @@ -65,7 +68,8 @@ "coverArt": "al-7", "name": "album-0", "songCount": 3, - "duration": 300 + "duration": 300, + "playCount": 0 }, { "id": "al-8", @@ -80,7 +84,8 @@ "coverArt": "al-8", "name": "album-1", "songCount": 3, - "duration": 300 + "duration": 300, + "playCount": 0 }, { "id": "al-9", @@ -95,7 +100,8 @@ "coverArt": "al-9", "name": "album-2", "songCount": 3, - "duration": 300 + "duration": 300, + "playCount": 0 }, { "id": "al-11", @@ -110,7 +116,8 @@ "coverArt": "al-11", "name": "album-0", "songCount": 3, - "duration": 300 + "duration": 300, + "playCount": 0 }, { "id": "al-12", @@ -125,7 +132,8 @@ "coverArt": "al-12", "name": "album-1", "songCount": 3, - "duration": 300 + "duration": 300, + "playCount": 0 }, { "id": "al-13", @@ -140,7 +148,8 @@ "coverArt": "al-13", "name": "album-2", "songCount": 3, - "duration": 300 + "duration": 300, + "playCount": 0 } ] } diff --git a/server/ctrlsubsonic/testdata/test_get_album_list_alpha_name b/server/ctrlsubsonic/testdata/test_get_album_list_alpha_name index 0151da9c..438dfafd 100644 --- a/server/ctrlsubsonic/testdata/test_get_album_list_alpha_name +++ b/server/ctrlsubsonic/testdata/test_get_album_list_alpha_name @@ -20,7 +20,8 @@ "coverArt": "al-3", "name": "album-0", "songCount": 3, - "duration": 300 + "duration": 300, + "playCount": 0 }, { "id": "al-7", @@ -35,7 +36,8 @@ "coverArt": "al-7", "name": "album-0", "songCount": 3, - "duration": 300 + "duration": 300, + "playCount": 0 }, { "id": "al-11", @@ -50,7 +52,8 @@ "coverArt": "al-11", "name": "album-0", "songCount": 3, - "duration": 300 + "duration": 300, + "playCount": 0 }, { "id": "al-4", @@ -65,7 +68,8 @@ "coverArt": "al-4", "name": "album-1", "songCount": 3, - "duration": 300 + "duration": 300, + "playCount": 0 }, { "id": "al-8", @@ -80,7 +84,8 @@ "coverArt": "al-8", "name": "album-1", "songCount": 3, - "duration": 300 + "duration": 300, + "playCount": 0 }, { "id": "al-12", @@ -95,7 +100,8 @@ "coverArt": "al-12", "name": "album-1", "songCount": 3, - "duration": 300 + "duration": 300, + "playCount": 0 }, { "id": "al-5", @@ -110,7 +116,8 @@ "coverArt": "al-5", "name": "album-2", "songCount": 3, - "duration": 300 + "duration": 300, + "playCount": 0 }, { "id": "al-9", @@ -125,7 +132,8 @@ "coverArt": "al-9", "name": "album-2", "songCount": 3, - "duration": 300 + "duration": 300, + "playCount": 0 }, { "id": "al-13", @@ -140,7 +148,8 @@ "coverArt": "al-13", "name": "album-2", "songCount": 3, - "duration": 300 + "duration": 300, + "playCount": 0 } ] } diff --git a/server/ctrlsubsonic/testdata/test_get_album_list_newest b/server/ctrlsubsonic/testdata/test_get_album_list_newest index 81f84c6a..7654a864 100644 --- a/server/ctrlsubsonic/testdata/test_get_album_list_newest +++ b/server/ctrlsubsonic/testdata/test_get_album_list_newest @@ -20,7 +20,8 @@ "coverArt": "al-3", "name": "album-0", "songCount": 3, - "duration": 300 + "duration": 300, + "playCount": 0 }, { "id": "al-4", @@ -35,7 +36,8 @@ "coverArt": "al-4", "name": "album-1", "songCount": 3, - "duration": 300 + "duration": 300, + "playCount": 0 }, { "id": "al-5", @@ -50,7 +52,8 @@ "coverArt": "al-5", "name": "album-2", "songCount": 3, - "duration": 300 + "duration": 300, + "playCount": 0 }, { "id": "al-7", @@ -65,7 +68,8 @@ "coverArt": "al-7", "name": "album-0", "songCount": 3, - "duration": 300 + "duration": 300, + "playCount": 0 }, { "id": "al-8", @@ -80,7 +84,8 @@ "coverArt": "al-8", "name": "album-1", "songCount": 3, - "duration": 300 + "duration": 300, + "playCount": 0 }, { "id": "al-9", @@ -95,7 +100,8 @@ "coverArt": "al-9", "name": "album-2", "songCount": 3, - "duration": 300 + "duration": 300, + "playCount": 0 }, { "id": "al-11", @@ -110,7 +116,8 @@ "coverArt": "al-11", "name": "album-0", "songCount": 3, - "duration": 300 + "duration": 300, + "playCount": 0 }, { "id": "al-12", @@ -125,7 +132,8 @@ "coverArt": "al-12", "name": "album-1", "songCount": 3, - "duration": 300 + "duration": 300, + "playCount": 0 }, { "id": "al-13", @@ -140,7 +148,8 @@ "coverArt": "al-13", "name": "album-2", "songCount": 3, - "duration": 300 + "duration": 300, + "playCount": 0 } ] } diff --git a/server/ctrlsubsonic/testdata/test_get_album_list_random b/server/ctrlsubsonic/testdata/test_get_album_list_random index 64fd041d..604aaa10 100644 --- a/server/ctrlsubsonic/testdata/test_get_album_list_random +++ b/server/ctrlsubsonic/testdata/test_get_album_list_random @@ -8,94 +8,116 @@ "albumList": { "album": [ { - "id": "al-12", + "id": "al-9", "created": "2019-11-30T00:00:00Z", - "artist": "artist-2", + "artist": "artist-1", "artists": null, "displayArtist": "", - "title": "album-1", - "album": "album-1", - "parent": "al-10", + "title": "album-2", + "album": "album-2", + "parent": "al-6", "isDir": true, - "coverArt": "al-12", - "name": "album-1", + "coverArt": "al-9", + "name": "album-2", "songCount": 3, - "duration": 300 + "duration": 300, + "playCount": 0 }, { - "id": "al-8", + "id": "al-7", "created": "2019-11-30T00:00:00Z", "artist": "artist-1", "artists": null, "displayArtist": "", - "title": "album-1", - "album": "album-1", + "title": "album-0", + "album": "album-0", "parent": "al-6", "isDir": true, - "coverArt": "al-8", - "name": "album-1", + "coverArt": "al-7", + "name": "album-0", "songCount": 3, - "duration": 300 + "duration": 300, + "playCount": 0 }, { - "id": "al-3", + "id": "al-4", "created": "2019-11-30T00:00:00Z", "artist": "artist-0", "artists": null, "displayArtist": "", - "title": "album-0", - "album": "album-0", + "title": "album-1", + "album": "album-1", "parent": "al-2", "isDir": true, - "coverArt": "al-3", - "name": "album-0", + "coverArt": "al-4", + "name": "album-1", "songCount": 3, - "duration": 300 + "duration": 300, + "playCount": 0 }, { - "id": "al-9", + "id": "al-12", "created": "2019-11-30T00:00:00Z", - "artist": "artist-1", + "artist": "artist-2", + "artists": null, + "displayArtist": "", + "title": "album-1", + "album": "album-1", + "parent": "al-10", + "isDir": true, + "coverArt": "al-12", + "name": "album-1", + "songCount": 3, + "duration": 300, + "playCount": 0 + }, + { + "id": "al-5", + "created": "2019-11-30T00:00:00Z", + "artist": "artist-0", "artists": null, "displayArtist": "", "title": "album-2", "album": "album-2", - "parent": "al-6", + "parent": "al-2", "isDir": true, - "coverArt": "al-9", + "coverArt": "al-5", "name": "album-2", "songCount": 3, - "duration": 300 + "duration": 300, + "playCount": 0 }, { - "id": "al-4", + "id": "al-3", "created": "2019-11-30T00:00:00Z", "artist": "artist-0", "artists": null, "displayArtist": "", - "title": "album-1", - "album": "album-1", + "title": "album-0", + "album": "album-0", "parent": "al-2", "isDir": true, - "coverArt": "al-4", - "name": "album-1", + "coverArt": "al-3", + "name": "album-0", "songCount": 3, - "duration": 300 + "duration": 300, + "playCount": 0 }, { - "id": "al-5", + "id": "al-8", "created": "2019-11-30T00:00:00Z", - "artist": "artist-0", + "artist": "artist-1", "artists": null, "displayArtist": "", - "title": "album-2", - "album": "album-2", - "parent": "al-2", + "title": "album-1", + "album": "album-1", + "parent": "al-6", "isDir": true, - "coverArt": "al-5", - "name": "album-2", + "coverArt": "al-8", + "name": "album-1", "songCount": 3, - "duration": 300 + "duration": 300, + "playCount": 0 }, { "id": "al-13", @@ -110,7 +132,8 @@ "coverArt": "al-13", "name": "album-2", "songCount": 3, - "duration": 300 + "duration": 300, + "playCount": 0 }, { "id": "al-11", @@ -125,22 +148,8 @@ "coverArt": "al-11", "name": "album-0", "songCount": 3, - "duration": 300 - }, - { - "id": "al-7", - "created": "2019-11-30T00:00:00Z", - "artist": "artist-1", - "artists": null, - "displayArtist": "", - "title": "album-0", - "album": "album-0", - "parent": "al-6", - "isDir": true, - "coverArt": "al-7", - "name": "album-0", - "songCount": 3, - "duration": 300 + "duration": 300, + "playCount": 0 } ] } diff --git a/server/ctrlsubsonic/testdata/test_get_album_list_two_alpha_artist b/server/ctrlsubsonic/testdata/test_get_album_list_two_alpha_artist index 35104eb8..e9d52e74 100644 --- a/server/ctrlsubsonic/testdata/test_get_album_list_two_alpha_artist +++ b/server/ctrlsubsonic/testdata/test_get_album_list_two_alpha_artist @@ -20,6 +20,7 @@ "name": "album-0", "songCount": 3, "duration": 300, + "playCount": 0, "year": 2021 }, { @@ -35,6 +36,7 @@ "name": "album-1", "songCount": 3, "duration": 300, + "playCount": 0, "year": 2021 }, { @@ -50,6 +52,7 @@ "name": "album-2", "songCount": 3, "duration": 300, + "playCount": 0, "year": 2021 }, { @@ -65,6 +68,7 @@ "name": "album-0", "songCount": 3, "duration": 300, + "playCount": 0, "year": 2021 }, { @@ -80,6 +84,7 @@ "name": "album-1", "songCount": 3, "duration": 300, + "playCount": 0, "year": 2021 }, { @@ -95,6 +100,7 @@ "name": "album-2", "songCount": 3, "duration": 300, + "playCount": 0, "year": 2021 }, { @@ -110,6 +116,7 @@ "name": "album-0", "songCount": 3, "duration": 300, + "playCount": 0, "year": 2021 }, { @@ -125,6 +132,7 @@ "name": "album-1", "songCount": 3, "duration": 300, + "playCount": 0, "year": 2021 }, { @@ -140,6 +148,7 @@ "name": "album-2", "songCount": 3, "duration": 300, + "playCount": 0, "year": 2021 } ] diff --git a/server/ctrlsubsonic/testdata/test_get_album_list_two_alpha_name b/server/ctrlsubsonic/testdata/test_get_album_list_two_alpha_name index 6a4aec28..253ae220 100644 --- a/server/ctrlsubsonic/testdata/test_get_album_list_two_alpha_name +++ b/server/ctrlsubsonic/testdata/test_get_album_list_two_alpha_name @@ -20,6 +20,7 @@ "name": "album-0", "songCount": 3, "duration": 300, + "playCount": 0, "year": 2021 }, { @@ -35,6 +36,7 @@ "name": "album-0", "songCount": 3, "duration": 300, + "playCount": 0, "year": 2021 }, { @@ -50,6 +52,7 @@ "name": "album-0", "songCount": 3, "duration": 300, + "playCount": 0, "year": 2021 }, { @@ -65,6 +68,7 @@ "name": "album-1", "songCount": 3, "duration": 300, + "playCount": 0, "year": 2021 }, { @@ -80,6 +84,7 @@ "name": "album-1", "songCount": 3, "duration": 300, + "playCount": 0, "year": 2021 }, { @@ -95,6 +100,7 @@ "name": "album-1", "songCount": 3, "duration": 300, + "playCount": 0, "year": 2021 }, { @@ -110,6 +116,7 @@ "name": "album-2", "songCount": 3, "duration": 300, + "playCount": 0, "year": 2021 }, { @@ -125,6 +132,7 @@ "name": "album-2", "songCount": 3, "duration": 300, + "playCount": 0, "year": 2021 }, { @@ -140,6 +148,7 @@ "name": "album-2", "songCount": 3, "duration": 300, + "playCount": 0, "year": 2021 } ] diff --git a/server/ctrlsubsonic/testdata/test_get_album_list_two_newest b/server/ctrlsubsonic/testdata/test_get_album_list_two_newest index 35104eb8..e9d52e74 100644 --- a/server/ctrlsubsonic/testdata/test_get_album_list_two_newest +++ b/server/ctrlsubsonic/testdata/test_get_album_list_two_newest @@ -20,6 +20,7 @@ "name": "album-0", "songCount": 3, "duration": 300, + "playCount": 0, "year": 2021 }, { @@ -35,6 +36,7 @@ "name": "album-1", "songCount": 3, "duration": 300, + "playCount": 0, "year": 2021 }, { @@ -50,6 +52,7 @@ "name": "album-2", "songCount": 3, "duration": 300, + "playCount": 0, "year": 2021 }, { @@ -65,6 +68,7 @@ "name": "album-0", "songCount": 3, "duration": 300, + "playCount": 0, "year": 2021 }, { @@ -80,6 +84,7 @@ "name": "album-1", "songCount": 3, "duration": 300, + "playCount": 0, "year": 2021 }, { @@ -95,6 +100,7 @@ "name": "album-2", "songCount": 3, "duration": 300, + "playCount": 0, "year": 2021 }, { @@ -110,6 +116,7 @@ "name": "album-0", "songCount": 3, "duration": 300, + "playCount": 0, "year": 2021 }, { @@ -125,6 +132,7 @@ "name": "album-1", "songCount": 3, "duration": 300, + "playCount": 0, "year": 2021 }, { @@ -140,6 +148,7 @@ "name": "album-2", "songCount": 3, "duration": 300, + "playCount": 0, "year": 2021 } ] diff --git a/server/ctrlsubsonic/testdata/test_get_album_list_two_random b/server/ctrlsubsonic/testdata/test_get_album_list_two_random index 0267d2ce..99edf567 100644 --- a/server/ctrlsubsonic/testdata/test_get_album_list_two_random +++ b/server/ctrlsubsonic/testdata/test_get_album_list_two_random @@ -8,138 +8,147 @@ "albumList2": { "album": [ { - "id": "al-7", + "id": "al-3", "created": "2019-11-30T00:00:00Z", - "artistId": "ar-2", - "artist": "artist-1", - "artists": [{ "id": "ar-2", "name": "artist-1" }], - "displayArtist": "artist-1", + "artistId": "ar-1", + "artist": "artist-0", + "artists": [{ "id": "ar-1", "name": "artist-0" }], + "displayArtist": "artist-0", "title": "album-0", "album": "album-0", - "coverArt": "al-7", + "coverArt": "al-3", "name": "album-0", "songCount": 3, "duration": 300, + "playCount": 0, "year": 2021 }, { - "id": "al-4", + "id": "al-5", "created": "2019-11-30T00:00:00Z", "artistId": "ar-1", "artist": "artist-0", "artists": [{ "id": "ar-1", "name": "artist-0" }], "displayArtist": "artist-0", - "title": "album-1", - "album": "album-1", - "coverArt": "al-4", - "name": "album-1", + "title": "album-2", + "album": "album-2", + "coverArt": "al-5", + "name": "album-2", "songCount": 3, "duration": 300, + "playCount": 0, "year": 2021 }, { - "id": "al-12", + "id": "al-8", "created": "2019-11-30T00:00:00Z", - "artistId": "ar-3", - "artist": "artist-2", - "artists": [{ "id": "ar-3", "name": "artist-2" }], - "displayArtist": "artist-2", + "artistId": "ar-2", + "artist": "artist-1", + "artists": [{ "id": "ar-2", "name": "artist-1" }], + "displayArtist": "artist-1", "title": "album-1", "album": "album-1", - "coverArt": "al-12", + "coverArt": "al-8", "name": "album-1", "songCount": 3, "duration": 300, + "playCount": 0, "year": 2021 }, { - "id": "al-3", + "id": "al-11", "created": "2019-11-30T00:00:00Z", - "artistId": "ar-1", - "artist": "artist-0", - "artists": [{ "id": "ar-1", "name": "artist-0" }], - "displayArtist": "artist-0", + "artistId": "ar-3", + "artist": "artist-2", + "artists": [{ "id": "ar-3", "name": "artist-2" }], + "displayArtist": "artist-2", "title": "album-0", "album": "album-0", - "coverArt": "al-3", + "coverArt": "al-11", "name": "album-0", "songCount": 3, "duration": 300, + "playCount": 0, "year": 2021 }, { - "id": "al-8", + "id": "al-12", "created": "2019-11-30T00:00:00Z", - "artistId": "ar-2", - "artist": "artist-1", - "artists": [{ "id": "ar-2", "name": "artist-1" }], - "displayArtist": "artist-1", + "artistId": "ar-3", + "artist": "artist-2", + "artists": [{ "id": "ar-3", "name": "artist-2" }], + "displayArtist": "artist-2", "title": "album-1", "album": "album-1", - "coverArt": "al-8", + "coverArt": "al-12", "name": "album-1", "songCount": 3, "duration": 300, + "playCount": 0, "year": 2021 }, { - "id": "al-9", + "id": "al-7", "created": "2019-11-30T00:00:00Z", "artistId": "ar-2", "artist": "artist-1", "artists": [{ "id": "ar-2", "name": "artist-1" }], "displayArtist": "artist-1", + "title": "album-0", + "album": "album-0", + "coverArt": "al-7", + "name": "album-0", + "songCount": 3, + "duration": 300, + "playCount": 0, + "year": 2021 + }, + { + "id": "al-13", + "created": "2019-11-30T00:00:00Z", + "artistId": "ar-3", + "artist": "artist-2", + "artists": [{ "id": "ar-3", "name": "artist-2" }], + "displayArtist": "artist-2", "title": "album-2", "album": "album-2", - "coverArt": "al-9", + "coverArt": "al-13", "name": "album-2", "songCount": 3, "duration": 300, + "playCount": 0, "year": 2021 }, { - "id": "al-5", + "id": "al-4", "created": "2019-11-30T00:00:00Z", "artistId": "ar-1", "artist": "artist-0", "artists": [{ "id": "ar-1", "name": "artist-0" }], "displayArtist": "artist-0", - "title": "album-2", - "album": "album-2", - "coverArt": "al-5", - "name": "album-2", + "title": "album-1", + "album": "album-1", + "coverArt": "al-4", + "name": "album-1", "songCount": 3, "duration": 300, + "playCount": 0, "year": 2021 }, { - "id": "al-13", + "id": "al-9", "created": "2019-11-30T00:00:00Z", - "artistId": "ar-3", - "artist": "artist-2", - "artists": [{ "id": "ar-3", "name": "artist-2" }], - "displayArtist": "artist-2", + "artistId": "ar-2", + "artist": "artist-1", + "artists": [{ "id": "ar-2", "name": "artist-1" }], + "displayArtist": "artist-1", "title": "album-2", "album": "album-2", - "coverArt": "al-13", + "coverArt": "al-9", "name": "album-2", "songCount": 3, "duration": 300, - "year": 2021 - }, - { - "id": "al-11", - "created": "2019-11-30T00:00:00Z", - "artistId": "ar-3", - "artist": "artist-2", - "artists": [{ "id": "ar-3", "name": "artist-2" }], - "displayArtist": "artist-2", - "title": "album-0", - "album": "album-0", - "coverArt": "al-11", - "name": "album-0", - "songCount": 3, - "duration": 300, + "playCount": 0, "year": 2021 } ] diff --git a/server/ctrlsubsonic/testdata/test_get_album_with_cover b/server/ctrlsubsonic/testdata/test_get_album_with_cover index f0185a3b..40ee4ae4 100644 --- a/server/ctrlsubsonic/testdata/test_get_album_with_cover +++ b/server/ctrlsubsonic/testdata/test_get_album_with_cover @@ -18,6 +18,7 @@ "name": "album-0", "songCount": 3, "duration": 300, + "playCount": 0, "genre": "Unknown Genre", "genres": [{ "name": "Unknown Genre" }], "year": 2021, diff --git a/server/ctrlsubsonic/testdata/test_get_album_without_cover b/server/ctrlsubsonic/testdata/test_get_album_without_cover index 069d3d63..0fd05727 100644 --- a/server/ctrlsubsonic/testdata/test_get_album_without_cover +++ b/server/ctrlsubsonic/testdata/test_get_album_without_cover @@ -15,7 +15,8 @@ "album": "", "name": "", "songCount": 0, - "duration": 0 + "duration": 0, + "playCount": 0 } } } diff --git a/server/ctrlsubsonic/testdata/test_get_artist_id_one b/server/ctrlsubsonic/testdata/test_get_artist_id_one index 5c1fe45a..0b02ff17 100644 --- a/server/ctrlsubsonic/testdata/test_get_artist_id_one +++ b/server/ctrlsubsonic/testdata/test_get_artist_id_one @@ -23,6 +23,7 @@ "name": "album-0", "songCount": 3, "duration": 300, + "playCount": 0, "genre": "Unknown Genre", "genres": [{ "name": "Unknown Genre" }], "year": 2021 @@ -40,6 +41,7 @@ "name": "album-1", "songCount": 3, "duration": 300, + "playCount": 0, "genre": "Unknown Genre", "genres": [{ "name": "Unknown Genre" }], "year": 2021 @@ -57,6 +59,7 @@ "name": "album-2", "songCount": 3, "duration": 300, + "playCount": 0, "genre": "Unknown Genre", "genres": [{ "name": "Unknown Genre" }], "year": 2021 diff --git a/server/ctrlsubsonic/testdata/test_get_artist_id_three b/server/ctrlsubsonic/testdata/test_get_artist_id_three index c5542f36..389ed9c5 100644 --- a/server/ctrlsubsonic/testdata/test_get_artist_id_three +++ b/server/ctrlsubsonic/testdata/test_get_artist_id_three @@ -23,6 +23,7 @@ "name": "album-0", "songCount": 3, "duration": 300, + "playCount": 0, "genre": "Unknown Genre", "genres": [{ "name": "Unknown Genre" }], "year": 2021 @@ -40,6 +41,7 @@ "name": "album-1", "songCount": 3, "duration": 300, + "playCount": 0, "genre": "Unknown Genre", "genres": [{ "name": "Unknown Genre" }], "year": 2021 @@ -57,6 +59,7 @@ "name": "album-2", "songCount": 3, "duration": 300, + "playCount": 0, "genre": "Unknown Genre", "genres": [{ "name": "Unknown Genre" }], "year": 2021 diff --git a/server/ctrlsubsonic/testdata/test_get_artist_id_two b/server/ctrlsubsonic/testdata/test_get_artist_id_two index e8fb6338..b85d4d49 100644 --- a/server/ctrlsubsonic/testdata/test_get_artist_id_two +++ b/server/ctrlsubsonic/testdata/test_get_artist_id_two @@ -23,6 +23,7 @@ "name": "album-0", "songCount": 3, "duration": 300, + "playCount": 0, "genre": "Unknown Genre", "genres": [{ "name": "Unknown Genre" }], "year": 2021 @@ -40,6 +41,7 @@ "name": "album-1", "songCount": 3, "duration": 300, + "playCount": 0, "genre": "Unknown Genre", "genres": [{ "name": "Unknown Genre" }], "year": 2021 @@ -57,6 +59,7 @@ "name": "album-2", "songCount": 3, "duration": 300, + "playCount": 0, "genre": "Unknown Genre", "genres": [{ "name": "Unknown Genre" }], "year": 2021 diff --git a/server/ctrlsubsonic/testdata/test_search_three_q_alb b/server/ctrlsubsonic/testdata/test_search_three_q_alb index 7ffb5dd3..2d346c82 100644 --- a/server/ctrlsubsonic/testdata/test_search_three_q_alb +++ b/server/ctrlsubsonic/testdata/test_search_three_q_alb @@ -20,6 +20,7 @@ "name": "album-0", "songCount": 0, "duration": 0, + "playCount": 0, "genre": "Unknown Genre", "genres": [{ "name": "Unknown Genre" }], "year": 2021 @@ -37,6 +38,7 @@ "name": "album-1", "songCount": 0, "duration": 0, + "playCount": 0, "genre": "Unknown Genre", "genres": [{ "name": "Unknown Genre" }], "year": 2021 @@ -54,6 +56,7 @@ "name": "album-2", "songCount": 0, "duration": 0, + "playCount": 0, "genre": "Unknown Genre", "genres": [{ "name": "Unknown Genre" }], "year": 2021 @@ -71,6 +74,7 @@ "name": "album-0", "songCount": 0, "duration": 0, + "playCount": 0, "genre": "Unknown Genre", "genres": [{ "name": "Unknown Genre" }], "year": 2021 @@ -88,6 +92,7 @@ "name": "album-1", "songCount": 0, "duration": 0, + "playCount": 0, "genre": "Unknown Genre", "genres": [{ "name": "Unknown Genre" }], "year": 2021 @@ -105,6 +110,7 @@ "name": "album-2", "songCount": 0, "duration": 0, + "playCount": 0, "genre": "Unknown Genre", "genres": [{ "name": "Unknown Genre" }], "year": 2021 @@ -122,6 +128,7 @@ "name": "album-0", "songCount": 0, "duration": 0, + "playCount": 0, "genre": "Unknown Genre", "genres": [{ "name": "Unknown Genre" }], "year": 2021 @@ -139,6 +146,7 @@ "name": "album-1", "songCount": 0, "duration": 0, + "playCount": 0, "genre": "Unknown Genre", "genres": [{ "name": "Unknown Genre" }], "year": 2021 @@ -156,6 +164,7 @@ "name": "album-2", "songCount": 0, "duration": 0, + "playCount": 0, "genre": "Unknown Genre", "genres": [{ "name": "Unknown Genre" }], "year": 2021