From 4f0033e81ca7d5e153051ab7063e85cd0e34bc5e Mon Sep 17 00:00:00 2001 From: HEnquist Date: Sun, 22 Sep 2019 21:21:44 +0200 Subject: [PATCH] Various changes following review --- metadata/src/lib.rs | 11 +++++++++-- protocol/src/lib.rs | 8 ++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/metadata/src/lib.rs b/metadata/src/lib.rs index 7a8c6971..d1ee7c90 100644 --- a/metadata/src/lib.rs +++ b/metadata/src/lib.rs @@ -1,3 +1,6 @@ +#[macro_use] +extern crate log; + extern crate byteorder; extern crate futures; extern crate linear_map; @@ -192,8 +195,8 @@ pub struct Show { #[derive(Debug, Clone)] pub struct Playlist { + pub revision: Vec, pub user: String, - pub length: i32, pub name: String, pub tracks: Vec, } @@ -315,9 +318,13 @@ impl Metadata for Playlist { }) .collect::>(); + if tracks.len() != msg.get_length() as usize { + warn!("Got {} tracks, but the playlist should contain {} tracks.", tracks.len(), msg.get_length()); + } + Playlist { + revision: msg.get_revision().to_vec(), name: msg.get_attributes().get_name().to_owned(), - length: msg.get_length(), tracks: tracks, user: msg.get_owner_username().to_string(), } diff --git a/protocol/src/lib.rs b/protocol/src/lib.rs index 6bc290cb..d2dcca24 100644 --- a/protocol/src/lib.rs +++ b/protocol/src/lib.rs @@ -6,9 +6,9 @@ pub mod keyexchange; pub mod mercury; pub mod metadata; pub mod playlist4changes; -pub mod playlist4content; -pub mod playlist4issues; -pub mod playlist4meta; -pub mod playlist4ops; +mod playlist4content; +mod playlist4issues; +mod playlist4meta; +mod playlist4ops; pub mod pubsub; pub mod spirc;