🎧 Your Personal Streaming Service
Go airsonicmadsonicmedia-servermusicmusic-servernavidromeopensubsonicraspberry-piself-hostedstreamerstreaming-apistreaming-audiosubsonicsubsonic-server
Add samplingRate to OpenSubsonic responses
Deluan3a2a5e961ba3
diff --git a/server/subsonic/helpers.go b/server/subsonic/helpers.goindex 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.ChildAlbumPeak: 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 .JSONindex 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 .XMLindex 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 @@<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.8.0" type="navidrome" serverVersion="v0.0.0" openSubsonic="true"><albumList>- <album id="1" isDir="false" title="title" isVideo="false" bpm="0" comment="" sortName="" mediaType="" musicBrainzId="" channelCount="0">+ <album id="1" isDir="false" title="title" isVideo="false" bpm="0" comment="" sortName="" mediaType="" musicBrainzId="" channelCount="0" samplingRate="0"><replayGain></replayGain></album></albumList>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 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 .XMLindex 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 @@<discTitles disc="3" title=""></discTitles><originalReleaseDate year="1994" month="2" day="4"></originalReleaseDate><releaseDate year="2000" month="5" day="10"></releaseDate>- <song id="1" 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" isVideo="false" bpm="127" comment="a comment" sortName="sorted song" mediaType="song" musicBrainzId="4321" channelCount="0">+ <song id="1" 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" isVideo="false" bpm="127" comment="a comment" sortName="sorted song" mediaType="song" musicBrainzId="4321" channelCount="0" samplingRate="0"><genres name="rock"></genres><genres name="progressive"></genres><replayGain trackGain="1" albumGain="2" trackPeak="3" albumPeak="4" baseGain="5" fallbackGain="6"></replayGain>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 .JSONindex 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 .XMLindex 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 @@<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.8.0" type="navidrome" serverVersion="v0.0.0" openSubsonic="true"><bookmarks><bookmark position="123" username="user2" comment="a comment" created="0001-01-01T00:00:00Z" changed="0001-01-01T00:00:00Z">- <entry id="1" isDir="false" title="title" isVideo="false" bpm="0" comment="" sortName="" mediaType="" musicBrainzId="" channelCount="0">+ <entry id="1" isDir="false" title="title" isVideo="false" bpm="0" comment="" sortName="" mediaType="" musicBrainzId="" channelCount="0" samplingRate="0"><replayGain></replayGain></entry></bookmark>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 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 .XMLindex 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 @@<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.8.0" type="navidrome" serverVersion="v0.0.0" openSubsonic="true"><directory id="1" name="N">- <child id="1" 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" isVideo="false" bpm="127" comment="a comment" sortName="" mediaType="song" musicBrainzId="4321" channelCount="2">+ <child id="1" 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" isVideo="false" bpm="127" comment="a comment" sortName="sorted title" mediaType="song" musicBrainzId="4321" channelCount="2" samplingRate="44100"><genres name="rock"></genres><genres name="progressive"></genres><replayGain trackGain="1" albumGain="2" trackPeak="3" albumPeak="4" baseGain="5" fallbackGain="6"></replayGain>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 .JSONindex 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 .XMLindex 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 @@<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.8.0" type="navidrome" serverVersion="v0.0.0" openSubsonic="true"><directory id="" name="">- <child id="1" isDir="false" isVideo="false" bpm="0" comment="" sortName="" mediaType="" musicBrainzId="" channelCount="0">+ <child id="1" isDir="false" isVideo="false" bpm="0" comment="" sortName="" mediaType="" musicBrainzId="" channelCount="0" samplingRate="0"><replayGain></replayGain></child></directory>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 .JSONindex 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 .XMLindex 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 @@<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.8.0" type="navidrome" serverVersion="v0.0.0" openSubsonic="true"><directory id="1" name="N">- <child id="1" isDir="false" title="title" isVideo="false" bpm="0" comment="" sortName="" mediaType="" musicBrainzId="" channelCount="0">+ <child id="1" isDir="false" title="title" isVideo="false" bpm="0" comment="" sortName="" mediaType="" musicBrainzId="" channelCount="0" samplingRate="0"><replayGain></replayGain></child></directory>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 .JSONindex 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 .XMLindex 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 @@<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.8.0" type="navidrome" serverVersion="v0.0.0" openSubsonic="true"><playQueue current="111" position="243" username="user1" changed="0001-01-01T00:00:00Z" changedBy="a_client">- <entry id="1" isDir="false" title="title" isVideo="false" bpm="0" comment="" sortName="" mediaType="" musicBrainzId="" channelCount="0">+ <entry id="1" isDir="false" title="title" isVideo="false" bpm="0" comment="" sortName="" mediaType="" musicBrainzId="" channelCount="0" samplingRate="0"><replayGain></replayGain></entry></playQueue>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 .JSONindex 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 .XMLindex 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 @@<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.8.0" type="navidrome" serverVersion="v0.0.0" openSubsonic="true"><shares><share id="ABC123" url="http://localhost/p/ABC123" description="Check it out!" username="deluan" created="0001-01-01T00:00:00Z" expires="0001-01-01T00:00:00Z" lastVisited="0001-01-01T00:00:00Z" visitCount="2">- <entry id="1" isDir="false" title="title" album="album" artist="artist" duration="120" isVideo="false" bpm="0" comment="" sortName="" mediaType="" musicBrainzId="" channelCount="0">+ <entry id="1" isDir="false" title="title" album="album" artist="artist" duration="120" isVideo="false" bpm="0" comment="" sortName="" mediaType="" musicBrainzId="" channelCount="0" samplingRate="0"><replayGain></replayGain></entry>- <entry id="2" isDir="false" title="title 2" album="album" artist="artist" duration="300" isVideo="false" bpm="0" comment="" sortName="" mediaType="" musicBrainzId="" channelCount="0">+ <entry id="2" isDir="false" title="title 2" album="album" artist="artist" duration="300" isVideo="false" bpm="0" comment="" sortName="" mediaType="" musicBrainzId="" channelCount="0" samplingRate="0"><replayGain></replayGain></entry></share>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 .JSONindex 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 .XMLindex 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 @@<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.8.0" type="navidrome" serverVersion="v0.0.0" openSubsonic="true"><similarSongs>- <song id="1" isDir="false" title="title" isVideo="false" bpm="0" comment="" sortName="" mediaType="" musicBrainzId="" channelCount="0">+ <song id="1" isDir="false" title="title" isVideo="false" bpm="0" comment="" sortName="" mediaType="" musicBrainzId="" channelCount="0" samplingRate="0"><replayGain></replayGain></song></similarSongs>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 .JSONindex 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 .XMLindex 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 @@<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.8.0" type="navidrome" serverVersion="v0.0.0" openSubsonic="true"><similarSongs2>- <song id="1" isDir="false" title="title" isVideo="false" bpm="0" comment="" sortName="" mediaType="" musicBrainzId="" channelCount="0">+ <song id="1" isDir="false" title="title" isVideo="false" bpm="0" comment="" sortName="" mediaType="" musicBrainzId="" channelCount="0" samplingRate="0"><replayGain></replayGain></song></similarSongs2>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 .JSONindex 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 .XMLindex 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 @@<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.8.0" type="navidrome" serverVersion="v0.0.0" openSubsonic="true"><topSongs>- <song id="1" isDir="false" title="title" isVideo="false" bpm="0" comment="" sortName="" mediaType="" musicBrainzId="" channelCount="0">+ <song id="1" isDir="false" title="title" isVideo="false" bpm="0" comment="" sortName="" mediaType="" musicBrainzId="" channelCount="0" samplingRate="0"><replayGain></replayGain></song></topSongs>diff --git a/server/subsonic/responses/responses.go b/server/subsonic/responses/responses.goindex 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.goindex 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