From dc903ea29e3ba4da28273cf9b8541b55af305392 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?= Date: Sun, 20 Oct 2019 11:06:56 +0300 Subject: [PATCH] Bump metaflac to 0.2 --- Cargo.lock | 6 +++--- Cargo.toml | 2 +- src/metadata.rs | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 082e127..fc26b6a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1045,7 +1045,7 @@ dependencies = [ [[package]] name = "metaflac" -version = "0.1.10" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1442,7 +1442,7 @@ dependencies = [ "lewton 0.9.4 (registry+https://github.com/rust-lang/crates.io-index)", "libsqlite3-sys 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "metaflac 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", + "metaflac 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "mp3-duration 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "pbkdf2 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2702,7 +2702,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" "checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e" "checksum memoffset 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ce6075db033bbbb7ee5a0bbd3a3186bbae616f57fb001c485c7ff77955f8177f" -"checksum metaflac 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "71bfae9773ae1d826c8f23de4d8cf4d165d5d687d8314fe59d3027eb2dbd80d0" +"checksum metaflac 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f9e5ff1b157cff0c5e89f10950eb02ae92278c079d8e8d54befb3d2cbd3e5446" "checksum migrations_internals 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8089920229070f914b9ce9b07ef60e175b2b9bc2d35c3edd8bf4433604e863b9" "checksum migrations_macros 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "719ef0bc7f531428764c9b70661c14abd50a7f3d21f355752d9985aa21251c9e" "checksum mime 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ba626b8a6de5da682e1caa06bdb42a335aee5a84db8e5046a3e8ab17ba0a3ae0" diff --git a/Cargo.toml b/Cargo.toml index 9563967..59ba9b0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,7 +24,7 @@ libsqlite3-sys = { version = "0.16", features = ["bundled-windows"] } rustfm-scrobble = "0.9.2" lewton = "0.9.1" log = "0.4.5" -metaflac = "0.1" +metaflac = "0.2" mp3-duration = "0.1.0" pbkdf2 = "0.3" rand = "0.7" diff --git a/src/metadata.rs b/src/metadata.rs index 8c83ca6..65e3bcd 100644 --- a/src/metadata.rs +++ b/src/metadata.rs @@ -156,9 +156,9 @@ fn read_flac(path: &Path) -> Result { .get("DISCNUMBER") .and_then(|d| d[0].parse::().ok()); let year = vorbis.get("DATE").and_then(|d| d[0].parse::().ok()); - let streaminfo = tag.get_blocks(metaflac::BlockType::StreamInfo); - let duration = match streaminfo.first() { - Some(&&metaflac::Block::StreamInfo(ref s)) => { + let mut streaminfo = tag.get_blocks(metaflac::BlockType::StreamInfo); + let duration = match streaminfo.next() { + Some(&metaflac::Block::StreamInfo(ref s)) => { Some((s.total_samples as u32 / s.sample_rate) as u32) } _ => None,