From ac0d597e75817e4ed52e2e6f11d379f6b6d5f0cf Mon Sep 17 00:00:00 2001 From: Paul Lietar Date: Wed, 20 Jan 2016 10:31:43 +0000 Subject: [PATCH] =?UTF-8?q?Ignore=20files=20which=20don=E2=80=99t=20have?= =?UTF-8?q?=20an=20id.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #42 --- Cargo.lock | 4 ++-- src/lib.rs | 2 +- src/metadata.rs | 2 ++ src/spirc.rs | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 56abdcf3..6cbfb0da 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -15,7 +15,7 @@ dependencies = [ "protobuf 1.0.15 (registry+https://github.com/rust-lang/crates.io-index)", "protobuf_macros 0.1.2 (git+https://github.com/plietar/rust-protobuf-macros.git)", "rand 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", - "rpassword 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rpassword 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "rust-crypto 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "shannon 0.1.1 (git+https://github.com/plietar/rust-shannon.git)", @@ -316,7 +316,7 @@ dependencies = [ [[package]] name = "rpassword" -version = "0.1.0" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "kernel32-sys 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/src/lib.rs b/src/lib.rs index 586f4336..66a8c52d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,6 @@ #![crate_name = "librespot"] -#![feature(plugin,zero_one,iter_arith,mpsc_select,clone_from_slice)] +#![feature(plugin,zero_one,iter_arith,mpsc_select)] #![plugin(protobuf_macros)] #![plugin(json_macros)] diff --git a/src/metadata.rs b/src/metadata.rs index d3ac8b00..2cdcd73e 100644 --- a/src/metadata.rs +++ b/src/metadata.rs @@ -73,6 +73,7 @@ impl MetadataTrait for Track { album: SpotifyId::from_raw(msg.get_album().get_gid()), files: msg.get_file() .iter() + .filter(|file| file.has_file_id()) .map(|file| { let mut dst = [0u8; 20]; dst.clone_from_slice(&file.get_file_id()); @@ -108,6 +109,7 @@ impl MetadataTrait for Album { covers: msg.get_cover_group() .get_image() .iter() + .filter(|image| image.has_file_id()) .map(|image| { let mut dst = [0u8; 20]; dst.clone_from_slice(&image.get_file_id()); diff --git a/src/spirc.rs b/src/spirc.rs index 9b779596..cb82934d 100644 --- a/src/spirc.rs +++ b/src/spirc.rs @@ -156,7 +156,7 @@ impl SpircManager { self.tracks = frame.get_state() .get_track() .iter() - .filter(|track| track.get_gid().len()==16) + .filter(|track| track.has_gid()) .map(|track| SpotifyId::from_raw(track.get_gid())) .collect();