From f3903383c9e546c661f64b42b498aca63cfda5e8 Mon Sep 17 00:00:00 2001 From: Craig Drummond Date: Tue, 12 Apr 2022 21:17:29 +0100 Subject: [PATCH] Update version of bliss-rs --- Cargo.lock | 8 ++++---- Cargo.toml | 2 +- ChangeLog | 1 + src/analyse.rs | 18 ++++++++---------- 4 files changed, 14 insertions(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 077e078..f386100 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -145,8 +145,8 @@ dependencies = [ [[package]] name = "bliss-audio" -version = "0.4.6" -source = "git+https://github.com/Polochon-street/bliss-rs?rev=5f366b0#5f366b0d809886265ac54398a61523431b44f8a0" +version = "0.5.0" +source = "git+https://github.com/Polochon-street/bliss-rs#c08fd3d7034c737e7645f59498dfa78b24eea182" dependencies = [ "bliss-audio-aubio-rs", "crossbeam", @@ -738,9 +738,9 @@ dependencies = [ [[package]] name = "lofty" -version = "0.6.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a944022a74ee371dbf1f36839f4a589822e8c980d1265f086eb540648c78083a" +checksum = "45967792fc531850b544d0e50065ffda8ce814a0d2142a6cbe7009961964e17c" dependencies = [ "base64", "byteorder", diff --git a/Cargo.toml b/Cargo.toml index c384fee..170daf6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ keywords = ["audio", "song", "similarity"] readme = "README.md" [dependencies] -bliss-audio = { git = "https://github.com/Polochon-street/bliss-rs", rev = "5f366b0" } +bliss-audio = { git = "https://github.com/Polochon-street/bliss-rs" } argparse = "0.2.2" anyhow = "1.0.40" rusqlite = { version = "0.25.0", features = ["bundled"] } diff --git a/ChangeLog b/ChangeLog index 49730a9..06cec5b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,7 @@ 1. Tidy up code, thanks to Serial-ATA 2. Update version of tag reader library, should now support ID3v2 in FLAC. 3. Show error message if can't open, or create, database file. +4. Update version of bliss-rs. 0.1.0 ----- diff --git a/src/analyse.rs b/src/analyse.rs index 8aed45e..3978352 100644 --- a/src/analyse.rs +++ b/src/analyse.rs @@ -9,7 +9,7 @@ use crate::tags; * **/ use anyhow::Result; -use bliss_audio::{library::analyze_paths_streaming, BlissResult, Song}; +use bliss_audio::{analyze_paths, BlissResult, Song}; use hhmmss::Hhmmss; use if_chain::if_chain; use indicatif::{ProgressBar, ProgressStyle}; @@ -114,13 +114,12 @@ pub fn analyse_new_files(db: &db::Db, mpath: &PathBuf, track_paths: Vec) .progress_chars("=> "), ); - let results = analyze_paths_streaming(track_paths)?; let mut analysed = 0; let mut failed: Vec = Vec::new(); let mut tag_error: Vec = Vec::new(); log::info!("Analysing new tracks"); - for (path, result) in results { + for (path, result) in analyze_paths(track_paths) { let pbuff = PathBuf::from(&path); let stripped = pbuff.strip_prefix(mpath).unwrap(); let spbuff = stripped.to_path_buf(); @@ -177,9 +176,9 @@ pub fn analyse_new_files(db: &db::Db, mpath: &PathBuf, track_paths: Vec) Ok(()) } -pub fn analyze_cue_streaming( +pub fn analyze_cue_tracks( tracks: Vec, -) -> BlissResult)>> { +) -> mpsc::IntoIter<(cue::CueTrack, BlissResult)> { let num_cpus = num_cpus::get(); let last_track_duration = Duration::new(cue::LAST_TRACK_DURATION, 0); @@ -189,7 +188,7 @@ pub fn analyze_cue_streaming( Receiver<(cue::CueTrack, BlissResult)>, ) = mpsc::channel(); if tracks.is_empty() { - return Ok(rx); + return rx.into_iter(); } let mut handles = Vec::new(); @@ -249,7 +248,7 @@ pub fn analyze_cue_streaming( if tmp_file.exists() { log::debug!("Analyzing '{}'", track_path); - let song = Song::new(&tmp_file); + let song = Song::from_path(&tmp_file); if cue_track.duration >= last_track_duration { // Last track, so read duration from temp file let meta = tags::read(&String::from(tmp_file.to_string_lossy())); @@ -266,7 +265,7 @@ pub fn analyze_cue_streaming( handles.push(child); } - Ok(rx) + rx.into_iter() } pub fn analyse_new_cue_tracks( @@ -281,12 +280,11 @@ pub fn analyse_new_cue_tracks( .progress_chars("=> "), ); - let results = analyze_cue_streaming(cue_tracks)?; let mut analysed = 0; let mut failed: Vec = Vec::new(); log::info!("Analysing new cue tracks"); - for (track, result) in results { + for (track, result) in analyze_cue_tracks(cue_tracks) { let stripped = track.track_path.strip_prefix(mpath).unwrap(); let spbuff = stripped.to_path_buf(); let sname = String::from(spbuff.to_string_lossy());