Bump metaflac to 0.2

This commit is contained in:
Laurențiu Nicola 2019-10-20 11:06:56 +03:00
parent 890ba87fee
commit dc903ea29e
3 changed files with 7 additions and 7 deletions

6
Cargo.lock generated
View file

@ -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"

View file

@ -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"

View file

@ -156,9 +156,9 @@ fn read_flac(path: &Path) -> Result<SongTags> {
.get("DISCNUMBER")
.and_then(|d| d[0].parse::<u32>().ok());
let year = vorbis.get("DATE").and_then(|d| d[0].parse::<i32>().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,