Skip to content

Commit

Permalink
add separate cli option for genre statistics
Browse files Browse the repository at this point in the history
  • Loading branch information
Esgrove committed May 5, 2024
1 parent deea467 commit 4e3503e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/cli_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pub struct CliConfig {
pub log_failures: bool,
pub convert_failed: bool,
pub write_all_tags: bool,
pub genre_statistics: bool,
}

impl CliConfig {
Expand All @@ -36,6 +37,7 @@ impl CliConfig {
log_failures: args.log,
convert_failed: args.convert,
write_all_tags: args.all_tags,
genre_statistics: args.genre,
}
}

Expand Down
4 changes: 4 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ pub struct RenamerArgs {
#[arg(short, long)]
convert: bool,

/// Collect and save genre statistics
#[arg(short, long)]
genre: bool,

/// Enable debug prints
#[arg(short, long)]
debug: bool,
Expand Down
2 changes: 1 addition & 1 deletion src/renamer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ impl Renamer {
utils::write_log_for_failed_files(&failed_files)?;
}

if self.config.verbose {
if self.config.genre_statistics {
println!("Genres ({}):", genres.len());
let mut genre_list: Vec<(String, usize)> = genres.into_iter().collect();
genre_list.sort_by(|a, b| b.1.cmp(&a.1));
Expand Down

0 comments on commit 4e3503e

Please sign in to comment.