Various changes following review

This commit is contained in:
HEnquist 2019-09-22 21:21:44 +02:00 committed by henenq
parent e2e52c78c0
commit 4f0033e81c
2 changed files with 13 additions and 6 deletions

View file

@ -1,3 +1,6 @@
#[macro_use]
extern crate log;
extern crate byteorder; extern crate byteorder;
extern crate futures; extern crate futures;
extern crate linear_map; extern crate linear_map;
@ -192,8 +195,8 @@ pub struct Show {
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct Playlist { pub struct Playlist {
pub revision: Vec<u8>,
pub user: String, pub user: String,
pub length: i32,
pub name: String, pub name: String,
pub tracks: Vec<SpotifyId>, pub tracks: Vec<SpotifyId>,
} }
@ -315,9 +318,13 @@ impl Metadata for Playlist {
}) })
.collect::<Vec<_>>(); .collect::<Vec<_>>();
if tracks.len() != msg.get_length() as usize {
warn!("Got {} tracks, but the playlist should contain {} tracks.", tracks.len(), msg.get_length());
}
Playlist { Playlist {
revision: msg.get_revision().to_vec(),
name: msg.get_attributes().get_name().to_owned(), name: msg.get_attributes().get_name().to_owned(),
length: msg.get_length(),
tracks: tracks, tracks: tracks,
user: msg.get_owner_username().to_string(), user: msg.get_owner_username().to_string(),
} }

View file

@ -6,9 +6,9 @@ pub mod keyexchange;
pub mod mercury; pub mod mercury;
pub mod metadata; pub mod metadata;
pub mod playlist4changes; pub mod playlist4changes;
pub mod playlist4content; mod playlist4content;
pub mod playlist4issues; mod playlist4issues;
pub mod playlist4meta; mod playlist4meta;
pub mod playlist4ops; mod playlist4ops;
pub mod pubsub; pub mod pubsub;
pub mod spirc; pub mod spirc;