Add samplingRate to OpenSubsonic responses

This commit is contained in:
Deluan 2024-05-11 17:44:24 -04:00 committed by Deluan Quintão
parent f3bb022238
commit 3a2a5e961b
25 changed files with 40 additions and 25 deletions

View File

@ -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
}

View File

@ -18,7 +18,8 @@
"musicBrainzId": "",
"genres": [],
"replayGain": {},
"channelCount": 0
"channelCount": 0,
"samplingRate": 0
}
]
}

View File

@ -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>

View File

@ -86,7 +86,8 @@
"baseGain": 5,
"fallbackGain": 6
},
"channelCount": 0
"channelCount": 0,
"samplingRate": 0
}
]
}

View File

@ -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>

View File

@ -19,7 +19,8 @@
"musicBrainzId": "",
"genres": [],
"replayGain": {},
"channelCount": 0
"channelCount": 0,
"samplingRate": 0
},
"position": 123,
"username": "user2",

View File

@ -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>

View File

@ -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",

View File

@ -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>

View File

@ -17,7 +17,8 @@
"musicBrainzId": "",
"genres": [],
"replayGain": {},
"channelCount": 0
"channelCount": 0,
"samplingRate": 0
}
],
"id": "",

View File

@ -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>

View File

@ -18,7 +18,8 @@
"musicBrainzId": "",
"genres": [],
"replayGain": {},
"channelCount": 0
"channelCount": 0,
"samplingRate": 0
}
],
"id": "1",

View File

@ -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>

View File

@ -18,7 +18,8 @@
"musicBrainzId": "",
"genres": [],
"replayGain": {},
"channelCount": 0
"channelCount": 0,
"samplingRate": 0
}
],
"current": "111",

View File

@ -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>

View File

@ -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",

View File

@ -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>

View File

@ -18,7 +18,8 @@
"musicBrainzId": "",
"genres": [],
"replayGain": {},
"channelCount": 0
"channelCount": 0,
"samplingRate": 0
}
]
}

View File

@ -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>

View File

@ -18,7 +18,8 @@
"musicBrainzId": "",
"genres": [],
"replayGain": {},
"channelCount": 0
"channelCount": 0,
"samplingRate": 0
}
]
}

View File

@ -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>

View File

@ -18,7 +18,8 @@
"musicBrainzId": "",
"genres": [],
"replayGain": {},
"channelCount": 0
"channelCount": 0,
"samplingRate": 0
}
]
}

View File

@ -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>

View File

@ -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 {

View File

@ -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