🎧 Your Personal Streaming Service
Go airsonicmadsonicmedia-servermusicmusic-servernavidromeopensubsonicraspberry-piself-hostedstreamerstreaming-apistreaming-audiosubsonicsubsonic-server
feat(subsonic): add groupings field to OpenSubsonic Child response
Deluanf12e75aa1107
diff --git a/server/subsonic/helpers.go b/server/subsonic/helpers.goindex 74d57ade4..8a9eb7110 100644--- a/server/subsonic/helpers.go+++ b/server/subsonic/helpers.go@@ -266,6 +266,7 @@ func osChildFromMediaFile(ctx context.Context, mf model.MediaFile) *responses.Opchild.BitDepth = int32(mf.BitDepth)child.Genres = toItemGenres(mf.Genres)child.Moods = mf.Tags.Values(model.TagMood)+ child.Groupings = mf.Tags.Values(model.TagGrouping)child.DisplayArtist = mf.Artistchild.Artists = artistRefs(mf.Participants[model.RoleArtist])child.DisplayAlbumArtist = mf.AlbumArtist@@ -375,6 +376,7 @@ func osChildFromAlbum(ctx context.Context, al model.Album) *responses.OpenSubsonchild.MusicBrainzId = al.MbzAlbumIDchild.Genres = toItemGenres(al.Genres)child.Moods = al.Tags.Values(model.TagMood)+ child.Groupings = al.Tags.Values(model.TagGrouping)child.DisplayArtist = al.AlbumArtistchild.Artists = artistRefs(al.Participants[model.RoleAlbumArtist])child.DisplayAlbumArtist = al.AlbumArtistdiff --git a/server/subsonic/responses/.snapshots/Responses AlbumList with OS data should match .JSON b/server/subsonic/responses/.snapshots/Responses AlbumList with OS data should match .JSONindex 8491a577b..9d9ae2195 100644--- a/server/subsonic/responses/.snapshots/Responses AlbumList with OS data should match .JSON+++ b/server/subsonic/responses/.snapshots/Responses AlbumList with OS data should match .JSON@@ -56,7 +56,10 @@"displayAlbumArtist": "Display album artist","contributors": [],"displayComposer": "",- "explicitStatus": "explicit"+ "explicitStatus": "explicit",+ "groupings": [+ "Soundtrack"+ ]}]}diff --git a/server/subsonic/responses/.snapshots/Responses AlbumList with OS data should match .XML b/server/subsonic/responses/.snapshots/Responses AlbumList with OS data should match .XMLindex 5d9e83f96..d39fe2e7d 100644--- a/server/subsonic/responses/.snapshots/Responses AlbumList with OS data should match .XML+++ b/server/subsonic/responses/.snapshots/Responses AlbumList with OS data should match .XML@@ -9,6 +9,7 @@<artists id="artist-2" name="Artist 2"></artists><albumArtists id="album-artist-1" name="Artist 1"></albumArtists><albumArtists id="album-artist-2" name="Artist 2"></albumArtists>+ <groupings>Soundtrack</groupings></album></albumList></subsonic-response>diff --git a/server/subsonic/responses/.snapshots/Responses AlbumWithSongsID3 with data should match .JSON b/server/subsonic/responses/.snapshots/Responses AlbumWithSongsID3 with data should match .JSONindex 07678407a..a07914344 100644--- a/server/subsonic/responses/.snapshots/Responses AlbumWithSongsID3 with data should match .JSON+++ b/server/subsonic/responses/.snapshots/Responses AlbumWithSongsID3 with data should match .JSON@@ -165,7 +165,11 @@}],"displayComposer": "composer 1 \u0026 composer 2",- "explicitStatus": "clean"+ "explicitStatus": "clean",+ "groupings": [+ "Soundtrack",+ "Live"+ ]},{"id": "2",@@ -210,7 +214,8 @@"displayAlbumArtist": "","contributors": [],"displayComposer": "",- "explicitStatus": ""+ "explicitStatus": "",+ "groupings": []}]}diff --git a/server/subsonic/responses/.snapshots/Responses AlbumWithSongsID3 with data should match .XML b/server/subsonic/responses/.snapshots/Responses AlbumWithSongsID3 with data should match .XMLindex f7b23cb4e..6c96391bc 100644--- a/server/subsonic/responses/.snapshots/Responses AlbumWithSongsID3 with data should match .XML+++ b/server/subsonic/responses/.snapshots/Responses AlbumWithSongsID3 with data should match .XML@@ -32,6 +32,8 @@<contributors role="role2" subRole="subrole4"><artist id="2" name="artist2"></artist></contributors>+ <groupings>Soundtrack</groupings>+ <groupings>Live</groupings></song><song id="2" isDir="true" title="title" album="album" artist="artist" track="1" year="1985" genre="Rock" coverArt="1" size="8421341" contentType="audio/flac" suffix="flac" starred="2016-03-02T20:30:00Z" transcodedContentType="audio/mpeg" transcodedSuffix="mp3" duration="146" bitRate="320"><replayGain trackGain="0" albumGain="0" trackPeak="0" albumPeak="0" baseGain="0" fallbackGain="0"></replayGain>diff --git a/server/subsonic/responses/.snapshots/Responses Child with data should match .JSON b/server/subsonic/responses/.snapshots/Responses Child with data should match .JSONindex d20a6d48c..4c0ea6c68 100644--- a/server/subsonic/responses/.snapshots/Responses Child with data should match .JSON+++ b/server/subsonic/responses/.snapshots/Responses Child with data should match .JSON@@ -110,7 +110,11 @@}],"displayComposer": "composer 1 \u0026 composer 2",- "explicitStatus": "clean"+ "explicitStatus": "clean",+ "groupings": [+ "Soundtrack",+ "Live"+ ]},{"id": "",@@ -141,7 +145,8 @@"displayAlbumArtist": "","contributors": [],"displayComposer": "",- "explicitStatus": ""+ "explicitStatus": "",+ "groupings": []}],"id": "1",diff --git a/server/subsonic/responses/.snapshots/Responses Child with data should match .XML b/server/subsonic/responses/.snapshots/Responses Child with data should match .XMLindex 1d307b0b9..ddceb67d4 100644--- a/server/subsonic/responses/.snapshots/Responses Child with data should match .XML+++ b/server/subsonic/responses/.snapshots/Responses Child with data should match .XML@@ -24,6 +24,8 @@<contributors role="composer"><artist id="4" name="composer2"></artist></contributors>+ <groupings>Soundtrack</groupings>+ <groupings>Live</groupings></child><child id="" isDir="false" title=""><replayGain trackGain="0" albumGain="0" trackPeak="0" albumPeak="0" baseGain="0" fallbackGain="0"></replayGain>diff --git a/server/subsonic/responses/.snapshots/Responses Child without data should match OpenSubsonic .JSON b/server/subsonic/responses/.snapshots/Responses Child without data should match OpenSubsonic .JSONindex 25284295e..9a9ab1ff6 100644--- a/server/subsonic/responses/.snapshots/Responses Child without data should match OpenSubsonic .JSON+++ b/server/subsonic/responses/.snapshots/Responses Child without data should match OpenSubsonic .JSON@@ -28,7 +28,8 @@"displayAlbumArtist": "","contributors": [],"displayComposer": "",- "explicitStatus": ""+ "explicitStatus": "",+ "groupings": []}],"id": "",diff --git a/server/subsonic/responses/responses.go b/server/subsonic/responses/responses.goindex b0b2b8752..4165669df 100644--- a/server/subsonic/responses/responses.go+++ b/server/subsonic/responses/responses.go@@ -189,6 +189,7 @@ type OpenSubsonicChild struct {Contributors Array[Contributor] `xml:"contributors,omitempty" json:"contributors"`DisplayComposer string `xml:"displayComposer,attr,omitempty" json:"displayComposer"`ExplicitStatus string `xml:"explicitStatus,attr,omitempty" json:"explicitStatus"`+ Groupings Array[string] `xml:"groupings,omitempty" json:"groupings"`}type Songs struct {diff --git a/server/subsonic/responses/responses_test.go b/server/subsonic/responses/responses_test.goindex ee98a3daa..0b72fab19 100644--- a/server/subsonic/responses/responses_test.go+++ b/server/subsonic/responses/responses_test.go@@ -224,6 +224,7 @@ var _ = Describe("Responses", func() {Isrc: []string{"ISRC-1", "ISRC-2"},BPM: 127, ChannelCount: 2, SamplingRate: 44100, BitDepth: 16,Moods: []string{"happy", "sad"},+ Groupings: []string{"Soundtrack", "Live"},ReplayGain: ReplayGain{TrackGain: gg.P(1.0), AlbumGain: gg.P(2.0), TrackPeak: gg.P(3.0), AlbumPeak: gg.P(4.0), BaseGain: gg.P(5.0), FallbackGain: gg.P(6.0)},DisplayArtist: "artist 1 & artist 2",Artists: []ArtistID3Ref{@@ -320,6 +321,7 @@ var _ = Describe("Responses", func() {Comment: "a comment", MediaType: MediaTypeSong, MusicBrainzId: "4321", SortName: "sorted song",Isrc: []string{"ISRC-1"},Moods: []string{"happy", "sad"},+ Groupings: []string{"Soundtrack", "Live"},ReplayGain: ReplayGain{TrackGain: gg.P(1.0), AlbumGain: gg.P(2.0), TrackPeak: gg.P(3.0), AlbumPeak: gg.P(4.0), BaseGain: gg.P(5.0), FallbackGain: gg.P(6.0)},BPM: 127, ChannelCount: 2, SamplingRate: 44100, BitDepth: 16,DisplayArtist: "artist1 & artist2",@@ -424,6 +426,7 @@ var _ = Describe("Responses", func() {ItemGenre{Name: "Genre 2"},},Moods: []string{"mood1", "mood2"},+ Groupings: []string{"Soundtrack"},DisplayArtist: "Display artist",Artists: Array[ArtistID3Ref]{ArtistID3Ref{Id: "artist-1", Name: "Artist 1"},