From ef8ad36d98b099da9a6b00a186d3f9e189c113fa Mon Sep 17 00:00:00 2001 From: Polochon_street Date: Sun, 22 Sep 2024 16:51:34 +0200 Subject: [PATCH] Add `blissify list-errors` --- Cargo.lock | 5 ++--- Cargo.toml | 2 +- src/main.rs | 13 ++++++++++++- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e1f7ffa..539ab74 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -101,9 +101,8 @@ checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "bliss-audio" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa9fdef7455f9ba48e51aac3eb8ab8863404c333a968710e4750a003a12c7d49" +version = "0.9.2" +source = "git+https://github.com/Polochon-street/bliss-rs/?branch=add-list-errors-library#45c0ab2051495677b296c0bc7c7ce000270aeb3e" dependencies = [ "adler32", "anyhow", diff --git a/Cargo.toml b/Cargo.toml index 5c7b9e3..09671ac 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,7 @@ default = ["bliss-audio/library"] rpi = ["bliss-audio/rpi"] [dependencies] -bliss-audio = "0.9.1" +bliss-audio = {git = "https://github.com/Polochon-street/bliss-rs/", branch = "add-list-errors-library"} mpd = "0.1.0" dirs = "3.0.1" tempdir = "0.3.7" diff --git a/src/main.rs b/src/main.rs index 4289c83..a5b7a4d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,7 +7,7 @@ //! Playlists can then subsequently be made from the current song using //! --playlist. use anyhow::{bail, Context, Result}; -use bliss_audio::library::{AppConfigTrait, BaseConfig, Library, LibrarySong}; +use bliss_audio::library::{AppConfigTrait, BaseConfig, Library, LibrarySong, ProcessingError}; use bliss_audio::playlist::{ closest_to_songs, cosine_distance, euclidean_distance, mahalanobis_distance_builder, song_to_song, DistanceMetricBuilder, @@ -827,6 +827,10 @@ fn main() -> Result<()> { .help("Display analyzed song paths, as well as the corresponding analysis.") ) ) + .subcommand( + SubCommand::with_name("list-errors") + .about("Print songs which could not be analyzed correctly, as well as the associated errors.") + ) .subcommand( SubCommand::with_name("init") .about("Initializes an MPD library") @@ -981,6 +985,13 @@ Defaults to 3, cannot be more than 9." println!("{}", song.bliss_song.path.display()); } } + } else if let Some(_) = matches.subcommand_matches("list-errors") { + let library = MPDLibrary::from_config_path(config_path)?; + let mut failed_songs: Vec = library.library.get_failed_songs()?; + failed_songs.sort_by_key(|x| x.song_path.clone()); + for error in failed_songs { + println!("{}: {}", error.song_path.display(), error.error); + } } else if let Some(sub_m) = matches.subcommand_matches("init") { let database_path = sub_m.value_of("database-path").map(PathBuf::from); let number_cores = parse_number_cores(sub_m)?;