Compare commits

..

3 Commits

Author SHA1 Message Date
3a61e15449 Latest lock. 2022-07-23 21:06:49 -07:00
c46ae525fc Just remove dupes, don't move them. 2022-07-23 21:06:22 -07:00
e16d899c14 Update tests to match intended behavior. 2022-07-23 21:06:03 -07:00
3 changed files with 245 additions and 255 deletions

463
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +1,6 @@
use std::collections::HashMap;
use std::error::Error;
use std::io::Write;
use std::path::Path;
use std::time::Duration;
use std::{collections::HashMap, error::Error, io::Write, path::Path, time::Duration};
use human_format::Formatter;
use human_format::Scales;
use human_format::{Formatter, Scales};
use humantime;
use lazy_static::lazy_static;
use log::info;
@ -13,9 +8,7 @@ use regex::Regex;
use structopt::StructOpt;
use tabwriter::TabWriter;
use superdeduper::clean_path_parent;
use superdeduper::CompactMetadata;
use superdeduper::MovieLibrary;
use superdeduper::{clean_path_parent, CompactMetadata, MovieLibrary};
const MOVIE_DIR: &str = "/home/wathiede/Movies";
const TO_BE_REMOVED_DIR: &str = "/home/wathiede/to-be-deleted/";
@ -71,11 +64,7 @@ fn print_dupes(lib: &MovieLibrary) {
delete_paths.sort();
let root = Path::new(&lib.root);
for path in &delete_paths {
println!(
r#"mv "{}" {}"#,
root.join(path).to_string_lossy(),
TO_BE_REMOVED_DIR
);
println!(r#"rm "{}""#, root.join(path).to_string_lossy(),);
}
if delete_paths.len() > 0 {
println!("superdeduper update-compact-metadata && superdeduper empty-dirs")
@ -154,7 +143,7 @@ fn print_videos(videos: &HashMap<String, CompactMetadata>, filter: Option<&Regex
humantime::Duration::from(Duration::from_secs(md.duration as u64)),
&name[MOVIE_DIR.len() + 1..]
);
println!("mv '{}' '{}'", name, TO_BE_REMOVED_DIR);
println!("rm '{}'", name);
}
}

View File

@ -335,7 +335,7 @@ fn test_fullmetal() -> Result<(), Box<dyn Error>> {
}
#[test]
fn test_keep_lower_res_higher_bit_rate() -> Result<(), Box<dyn Error>> {
fn test_keep_higher_res_lower_bit_rate() -> Result<(), Box<dyn Error>> {
let mut movies = Movies {
movies: vec![
build_movie(vec![(
@ -361,15 +361,17 @@ fn test_keep_lower_res_higher_bit_rate() -> Result<(), Box<dyn Error>> {
let got = movies.duplicate_candidates();
let want = vec![(
build_movie(vec![(
"X Men The Last Stand (2006)/X.Men.The.Last.Stand.2006.1080p.BluRay.x264.DTS-ES.PRoDJi.mkv",
(1920, 800),
11349705,
)]),
vec![build_movie(vec![(
"X Men The Last Stand (2006)/948f08a4ba784626ac13de77b77559dd.mkv",
(1920, 1080),
6574160,
)])],
)]),
vec![
build_movie(vec![(
"X Men The Last Stand (2006)/X.Men.The.Last.Stand.2006.1080p.BluRay.x264.DTS-ES.PRoDJi.mkv",
(1920, 800),
11349705,
)])
],
)];
validate_duplicates(got, want);
Ok(())