Update version of bliss-rs

This commit is contained in:
Craig Drummond 2022-04-12 21:17:29 +01:00
parent f13601f1c2
commit f3903383c9
4 changed files with 14 additions and 15 deletions

8
Cargo.lock generated
View File

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

View File

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

View File

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

View File

@ -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<String>)
.progress_chars("=> "),
);
let results = analyze_paths_streaming(track_paths)?;
let mut analysed = 0;
let mut failed: Vec<String> = Vec::new();
let mut tag_error: Vec<String> = 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<String>)
Ok(())
}
pub fn analyze_cue_streaming(
pub fn analyze_cue_tracks(
tracks: Vec<cue::CueTrack>,
) -> BlissResult<Receiver<(cue::CueTrack, BlissResult<Song>)>> {
) -> mpsc::IntoIter<(cue::CueTrack, BlissResult<Song>)> {
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<Song>)>,
) = 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<String> = 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());