Print suggested 'delete' command for removing dupes.

This commit is contained in:
Bill Thiede 2019-11-25 08:53:58 -08:00
parent 150bdfddef
commit a2f17ed511

View File

@ -38,6 +38,7 @@ fn print_dupes(lib: &MovieLibrary) {
let mut fmtr = Formatter::new(); let mut fmtr = Formatter::new();
fmtr.with_separator(""); fmtr.with_separator("");
fmtr.with_scales(Scales::Binary()); fmtr.with_scales(Scales::Binary());
let mut delete_paths = Vec::new();
for (keep, deletes) in videos.duplicate_candidates() { for (keep, deletes) in videos.duplicate_candidates() {
let p = &keep.files.first().unwrap().0; let p = &keep.files.first().unwrap().0;
println!("{}", &p[..p.find("/").unwrap()]); println!("{}", &p[..p.find("/").unwrap()]);
@ -54,6 +55,7 @@ fn print_dupes(lib: &MovieLibrary) {
println!(" Need to remove:"); println!(" Need to remove:");
for delete in &deletes { for delete in &deletes {
for (p, md) in &delete.files { for (p, md) in &delete.files {
delete_paths.push(p);
println!( println!(
" {:>9} {:>9} {} {}", " {:>9} {:>9} {} {}",
md.largest_dimension().unwrap(), md.largest_dimension().unwrap(),
@ -65,6 +67,10 @@ fn print_dupes(lib: &MovieLibrary) {
} }
println!(); println!();
} }
delete_paths.sort();
for path in &delete_paths {
println!("mv '{}' /storage/media/to-be-deleted/", path);
}
} }
fn print_all(videos: HashMap<String, CompactMetadata>) { fn print_all(videos: HashMap<String, CompactMetadata>) {