Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add blissify list-errors #76

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
13 changes: 12 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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<ProcessingError> = 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)?;
Expand Down
Loading