diff --git a/server/subsonic/helpers.go b/server/subsonic/helpers.go index 54baecb9a..c5417d523 100644 --- a/server/subsonic/helpers.go +++ b/server/subsonic/helpers.go @@ -184,6 +184,7 @@ func childFromMediaFile(ctx context.Context, mf model.MediaFile) responses.Child AlbumPeak: mf.RgAlbumPeak, } child.ChannelCount = int32(mf.Channels) + child.SamplingRate = int32(mf.SampleRate) return child } diff --git a/server/subsonic/responses/.snapshots/Responses AlbumList with data should match .JSON b/server/subsonic/responses/.snapshots/Responses AlbumList with data should match .JSON index 6a2e1839a..063fd84c3 100644 --- a/server/subsonic/responses/.snapshots/Responses AlbumList with data should match .JSON +++ b/server/subsonic/responses/.snapshots/Responses AlbumList with data should match .JSON @@ -18,7 +18,8 @@ "musicBrainzId": "", "genres": [], "replayGain": {}, - "channelCount": 0 + "channelCount": 0, + "samplingRate": 0 } ] } diff --git a/server/subsonic/responses/.snapshots/Responses AlbumList with data should match .XML b/server/subsonic/responses/.snapshots/Responses AlbumList with data should match .XML index bc453309e..df208a48b 100644 --- a/server/subsonic/responses/.snapshots/Responses AlbumList with data should match .XML +++ b/server/subsonic/responses/.snapshots/Responses AlbumList with data should match .XML @@ -1,6 +1,6 @@ - + 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 .JSON index 3c4ade733..7c6ae548b 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 @@ -86,7 +86,8 @@ "baseGain": 5, "fallbackGain": 6 }, - "channelCount": 0 + "channelCount": 0, + "samplingRate": 0 } ] } 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 .XML index 6ef1897f7..1c3674cd5 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 @@ -7,7 +7,7 @@ - + diff --git a/server/subsonic/responses/.snapshots/Responses Bookmarks with data should match .JSON b/server/subsonic/responses/.snapshots/Responses Bookmarks with data should match .JSON index 18ddd2ad0..062226b07 100644 --- a/server/subsonic/responses/.snapshots/Responses Bookmarks with data should match .JSON +++ b/server/subsonic/responses/.snapshots/Responses Bookmarks with data should match .JSON @@ -19,7 +19,8 @@ "musicBrainzId": "", "genres": [], "replayGain": {}, - "channelCount": 0 + "channelCount": 0, + "samplingRate": 0 }, "position": 123, "username": "user2", diff --git a/server/subsonic/responses/.snapshots/Responses Bookmarks with data should match .XML b/server/subsonic/responses/.snapshots/Responses Bookmarks with data should match .XML index 289d47a71..3c82825df 100644 --- a/server/subsonic/responses/.snapshots/Responses Bookmarks with data should match .XML +++ b/server/subsonic/responses/.snapshots/Responses Bookmarks with data should match .XML @@ -1,7 +1,7 @@ - + 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 .JSON index 3b9727837..05c523fac 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 @@ -27,7 +27,7 @@ "isVideo": false, "bpm": 127, "comment": "a comment", - "sortName": "", + "sortName": "sorted title", "mediaType": "song", "musicBrainzId": "4321", "genres": [ @@ -46,7 +46,8 @@ "baseGain": 5, "fallbackGain": 6 }, - "channelCount": 2 + "channelCount": 2, + "samplingRate": 44100 } ], "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 .XML index dce540063..fb07823b6 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 @@ -1,6 +1,6 @@ - + diff --git a/server/subsonic/responses/.snapshots/Responses Child without data should match .JSON b/server/subsonic/responses/.snapshots/Responses Child without data should match .JSON index 7b77a24ce..c57dc283d 100644 --- a/server/subsonic/responses/.snapshots/Responses Child without data should match .JSON +++ b/server/subsonic/responses/.snapshots/Responses Child without data should match .JSON @@ -17,7 +17,8 @@ "musicBrainzId": "", "genres": [], "replayGain": {}, - "channelCount": 0 + "channelCount": 0, + "samplingRate": 0 } ], "id": "", diff --git a/server/subsonic/responses/.snapshots/Responses Child without data should match .XML b/server/subsonic/responses/.snapshots/Responses Child without data should match .XML index fa5f3b1dc..15f3bbbe7 100644 --- a/server/subsonic/responses/.snapshots/Responses Child without data should match .XML +++ b/server/subsonic/responses/.snapshots/Responses Child without data should match .XML @@ -1,6 +1,6 @@ - + diff --git a/server/subsonic/responses/.snapshots/Responses Directory with data should match .JSON b/server/subsonic/responses/.snapshots/Responses Directory with data should match .JSON index cdd600751..b8512c216 100644 --- a/server/subsonic/responses/.snapshots/Responses Directory with data should match .JSON +++ b/server/subsonic/responses/.snapshots/Responses Directory with data should match .JSON @@ -18,7 +18,8 @@ "musicBrainzId": "", "genres": [], "replayGain": {}, - "channelCount": 0 + "channelCount": 0, + "samplingRate": 0 } ], "id": "1", diff --git a/server/subsonic/responses/.snapshots/Responses Directory with data should match .XML b/server/subsonic/responses/.snapshots/Responses Directory with data should match .XML index 79bdca646..e04769e87 100644 --- a/server/subsonic/responses/.snapshots/Responses Directory with data should match .XML +++ b/server/subsonic/responses/.snapshots/Responses Directory with data should match .XML @@ -1,6 +1,6 @@ - + diff --git a/server/subsonic/responses/.snapshots/Responses PlayQueue with data should match .JSON b/server/subsonic/responses/.snapshots/Responses PlayQueue with data should match .JSON index 05c1761bf..db30fe2c6 100644 --- a/server/subsonic/responses/.snapshots/Responses PlayQueue with data should match .JSON +++ b/server/subsonic/responses/.snapshots/Responses PlayQueue with data should match .JSON @@ -18,7 +18,8 @@ "musicBrainzId": "", "genres": [], "replayGain": {}, - "channelCount": 0 + "channelCount": 0, + "samplingRate": 0 } ], "current": "111", diff --git a/server/subsonic/responses/.snapshots/Responses PlayQueue with data should match .XML b/server/subsonic/responses/.snapshots/Responses PlayQueue with data should match .XML index 6120b859d..db0d2e643 100644 --- a/server/subsonic/responses/.snapshots/Responses PlayQueue with data should match .XML +++ b/server/subsonic/responses/.snapshots/Responses PlayQueue with data should match .XML @@ -1,6 +1,6 @@ - + diff --git a/server/subsonic/responses/.snapshots/Responses Shares with data should match .JSON b/server/subsonic/responses/.snapshots/Responses Shares with data should match .JSON index 71c154f29..21e603d91 100644 --- a/server/subsonic/responses/.snapshots/Responses Shares with data should match .JSON +++ b/server/subsonic/responses/.snapshots/Responses Shares with data should match .JSON @@ -23,7 +23,8 @@ "musicBrainzId": "", "genres": [], "replayGain": {}, - "channelCount": 0 + "channelCount": 0, + "samplingRate": 0 }, { "id": "2", @@ -40,7 +41,8 @@ "musicBrainzId": "", "genres": [], "replayGain": {}, - "channelCount": 0 + "channelCount": 0, + "samplingRate": 0 } ], "id": "ABC123", diff --git a/server/subsonic/responses/.snapshots/Responses Shares with data should match .XML b/server/subsonic/responses/.snapshots/Responses Shares with data should match .XML index 527aa486d..a53e74114 100644 --- a/server/subsonic/responses/.snapshots/Responses Shares with data should match .XML +++ b/server/subsonic/responses/.snapshots/Responses Shares with data should match .XML @@ -1,10 +1,10 @@ - + - + diff --git a/server/subsonic/responses/.snapshots/Responses SimilarSongs with data should match .JSON b/server/subsonic/responses/.snapshots/Responses SimilarSongs with data should match .JSON index e743905bc..e41223d4f 100644 --- a/server/subsonic/responses/.snapshots/Responses SimilarSongs with data should match .JSON +++ b/server/subsonic/responses/.snapshots/Responses SimilarSongs with data should match .JSON @@ -18,7 +18,8 @@ "musicBrainzId": "", "genres": [], "replayGain": {}, - "channelCount": 0 + "channelCount": 0, + "samplingRate": 0 } ] } diff --git a/server/subsonic/responses/.snapshots/Responses SimilarSongs with data should match .XML b/server/subsonic/responses/.snapshots/Responses SimilarSongs with data should match .XML index 2bf633e4a..7a3dffded 100644 --- a/server/subsonic/responses/.snapshots/Responses SimilarSongs with data should match .XML +++ b/server/subsonic/responses/.snapshots/Responses SimilarSongs with data should match .XML @@ -1,6 +1,6 @@ - + diff --git a/server/subsonic/responses/.snapshots/Responses SimilarSongs2 with data should match .JSON b/server/subsonic/responses/.snapshots/Responses SimilarSongs2 with data should match .JSON index ac1659f6c..20f18360b 100644 --- a/server/subsonic/responses/.snapshots/Responses SimilarSongs2 with data should match .JSON +++ b/server/subsonic/responses/.snapshots/Responses SimilarSongs2 with data should match .JSON @@ -18,7 +18,8 @@ "musicBrainzId": "", "genres": [], "replayGain": {}, - "channelCount": 0 + "channelCount": 0, + "samplingRate": 0 } ] } diff --git a/server/subsonic/responses/.snapshots/Responses SimilarSongs2 with data should match .XML b/server/subsonic/responses/.snapshots/Responses SimilarSongs2 with data should match .XML index 683a4626e..12aebc6a7 100644 --- a/server/subsonic/responses/.snapshots/Responses SimilarSongs2 with data should match .XML +++ b/server/subsonic/responses/.snapshots/Responses SimilarSongs2 with data should match .XML @@ -1,6 +1,6 @@ - + diff --git a/server/subsonic/responses/.snapshots/Responses TopSongs with data should match .JSON b/server/subsonic/responses/.snapshots/Responses TopSongs with data should match .JSON index c9038e132..7ce7049de 100644 --- a/server/subsonic/responses/.snapshots/Responses TopSongs with data should match .JSON +++ b/server/subsonic/responses/.snapshots/Responses TopSongs with data should match .JSON @@ -18,7 +18,8 @@ "musicBrainzId": "", "genres": [], "replayGain": {}, - "channelCount": 0 + "channelCount": 0, + "samplingRate": 0 } ] } diff --git a/server/subsonic/responses/.snapshots/Responses TopSongs with data should match .XML b/server/subsonic/responses/.snapshots/Responses TopSongs with data should match .XML index bbd2d5b45..75b47f4f9 100644 --- a/server/subsonic/responses/.snapshots/Responses TopSongs with data should match .XML +++ b/server/subsonic/responses/.snapshots/Responses TopSongs with data should match .XML @@ -1,6 +1,6 @@ - + diff --git a/server/subsonic/responses/responses.go b/server/subsonic/responses/responses.go index a5ebc5a3f..fb577cad3 100644 --- a/server/subsonic/responses/responses.go +++ b/server/subsonic/responses/responses.go @@ -164,6 +164,7 @@ type Child struct { Genres ItemGenres `xml:"genres" json:"genres"` ReplayGain ReplayGain `xml:"replayGain" json:"replayGain"` ChannelCount int32 `xml:"channelCount,attr" json:"channelCount"` + SamplingRate int32 `xml:"samplingRate,attr" json:"samplingRate"` } type Songs struct { diff --git a/server/subsonic/responses/responses_test.go b/server/subsonic/responses/responses_test.go index cdc614090..88fb74050 100644 --- a/server/subsonic/responses/responses_test.go +++ b/server/subsonic/responses/responses_test.go @@ -143,6 +143,7 @@ var _ = Describe("Responses", func() { Suffix: "flac", TranscodedContentType: "audio/mpeg", TranscodedSuffix: "mp3", Duration: 146, BitRate: 320, Starred: &t, Genres: []ItemGenre{{Name: "rock"}, {Name: "progressive"}}, Comment: "a comment", Bpm: 127, MediaType: MediaTypeSong, MusicBrainzId: "4321", ChannelCount: 2, + SamplingRate: 44100, SortName: "sorted title", ReplayGain: ReplayGain{TrackGain: 1, AlbumGain: 2, TrackPeak: 3, AlbumPeak: 4, BaseGain: 5, FallbackGain: 6}, } response.Directory.Child = child