feat(lib): carry audio attributes in browse and folder listings

A browse listed each file as a name and a size, so a searcher who saw a
bitrate in a search reply lost it the moment they opened the sharer's
files. Listings (codes 5 and 37) now carry each file's attributes the
way Nicotine+ sends them, as a SharedFileEntry with name, size and
attributes in place of the (name, size) pair; the CLI's browse record
gains bitrate and duration, and the daemon protocol moves to version 2
for the new listing shape.
This commit is contained in:
Michel de Graaf
2026-09-08 01:44:49 +02:00
parent 5a20d69056
commit f6423a2ed6
20 changed files with 307 additions and 95 deletions
+6 -2
View File
@@ -13,7 +13,7 @@
/// Bumped when a change would break a client written against the old shape.
/// Sent in the `auth` reply so a mismatch is caught at connect time rather
/// than as a confusing failure three calls later.
pub const PROTOCOL_VERSION: u32 = 1;
pub const PROTOCOL_VERSION: u32 = 2;
/// The OpenRPC document, served by `rpc.discover` so a generator can point at
/// a running daemon instead of needing this repository.
@@ -322,7 +322,11 @@ mod tests {
fn a_shared_listing_survives_the_round_trip() {
let directory = SharedDirectory {
name: "@@x\\Music".into(),
files: vec![("a.mp3".into(), 4096)],
files: vec![soulseek_rs::SharedFileEntry {
name: "a.mp3".into(),
size: 4096,
attributes: vec![(0, 320)],
}],
};
let json = serde_json::to_string(&SharedDirectoryDto::from(&directory))
.unwrap();