Compare commits
No commits in common. "3a61e15449766f06fa2f549b988f39c647661dd6" and "e06d2419e565954f1dd6a1712ec5a2528d35d00c" have entirely different histories.
3a61e15449
...
e06d2419e5
463
Cargo.lock
generated
463
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
21
src/main.rs
21
src/main.rs
@ -1,6 +1,11 @@
|
|||||||
use std::{collections::HashMap, error::Error, io::Write, path::Path, time::Duration};
|
use std::collections::HashMap;
|
||||||
|
use std::error::Error;
|
||||||
|
use std::io::Write;
|
||||||
|
use std::path::Path;
|
||||||
|
use std::time::Duration;
|
||||||
|
|
||||||
use human_format::{Formatter, Scales};
|
use human_format::Formatter;
|
||||||
|
use human_format::Scales;
|
||||||
use humantime;
|
use humantime;
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use log::info;
|
use log::info;
|
||||||
@ -8,7 +13,9 @@ use regex::Regex;
|
|||||||
use structopt::StructOpt;
|
use structopt::StructOpt;
|
||||||
use tabwriter::TabWriter;
|
use tabwriter::TabWriter;
|
||||||
|
|
||||||
use superdeduper::{clean_path_parent, CompactMetadata, MovieLibrary};
|
use superdeduper::clean_path_parent;
|
||||||
|
use superdeduper::CompactMetadata;
|
||||||
|
use superdeduper::MovieLibrary;
|
||||||
|
|
||||||
const MOVIE_DIR: &str = "/home/wathiede/Movies";
|
const MOVIE_DIR: &str = "/home/wathiede/Movies";
|
||||||
const TO_BE_REMOVED_DIR: &str = "/home/wathiede/to-be-deleted/";
|
const TO_BE_REMOVED_DIR: &str = "/home/wathiede/to-be-deleted/";
|
||||||
@ -64,7 +71,11 @@ fn print_dupes(lib: &MovieLibrary) {
|
|||||||
delete_paths.sort();
|
delete_paths.sort();
|
||||||
let root = Path::new(&lib.root);
|
let root = Path::new(&lib.root);
|
||||||
for path in &delete_paths {
|
for path in &delete_paths {
|
||||||
println!(r#"rm "{}""#, root.join(path).to_string_lossy(),);
|
println!(
|
||||||
|
r#"mv "{}" {}"#,
|
||||||
|
root.join(path).to_string_lossy(),
|
||||||
|
TO_BE_REMOVED_DIR
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if delete_paths.len() > 0 {
|
if delete_paths.len() > 0 {
|
||||||
println!("superdeduper update-compact-metadata && superdeduper empty-dirs")
|
println!("superdeduper update-compact-metadata && superdeduper empty-dirs")
|
||||||
@ -143,7 +154,7 @@ fn print_videos(videos: &HashMap<String, CompactMetadata>, filter: Option<&Regex
|
|||||||
humantime::Duration::from(Duration::from_secs(md.duration as u64)),
|
humantime::Duration::from(Duration::from_secs(md.duration as u64)),
|
||||||
&name[MOVIE_DIR.len() + 1..]
|
&name[MOVIE_DIR.len() + 1..]
|
||||||
);
|
);
|
||||||
println!("rm '{}'", name);
|
println!("mv '{}' '{}'", name, TO_BE_REMOVED_DIR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -335,7 +335,7 @@ fn test_fullmetal() -> Result<(), Box<dyn Error>> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_keep_higher_res_lower_bit_rate() -> Result<(), Box<dyn Error>> {
|
fn test_keep_lower_res_higher_bit_rate() -> Result<(), Box<dyn Error>> {
|
||||||
let mut movies = Movies {
|
let mut movies = Movies {
|
||||||
movies: vec![
|
movies: vec![
|
||||||
build_movie(vec![(
|
build_movie(vec![(
|
||||||
@ -360,18 +360,16 @@ fn test_keep_higher_res_lower_bit_rate() -> Result<(), Box<dyn Error>> {
|
|||||||
});
|
});
|
||||||
let got = movies.duplicate_candidates();
|
let got = movies.duplicate_candidates();
|
||||||
let want = vec![(
|
let want = vec![(
|
||||||
build_movie(vec![(
|
|
||||||
"X Men The Last Stand (2006)/948f08a4ba784626ac13de77b77559dd.mkv",
|
|
||||||
(1920, 1080),
|
|
||||||
6574160,
|
|
||||||
)]),
|
|
||||||
vec![
|
|
||||||
build_movie(vec![(
|
build_movie(vec![(
|
||||||
"X Men The Last Stand (2006)/X.Men.The.Last.Stand.2006.1080p.BluRay.x264.DTS-ES.PRoDJi.mkv",
|
"X Men The Last Stand (2006)/X.Men.The.Last.Stand.2006.1080p.BluRay.x264.DTS-ES.PRoDJi.mkv",
|
||||||
(1920, 800),
|
(1920, 800),
|
||||||
11349705,
|
11349705,
|
||||||
)])
|
)]),
|
||||||
],
|
vec![build_movie(vec![(
|
||||||
|
"X Men The Last Stand (2006)/948f08a4ba784626ac13de77b77559dd.mkv",
|
||||||
|
(1920, 1080),
|
||||||
|
6574160,
|
||||||
|
)])],
|
||||||
)];
|
)];
|
||||||
validate_duplicates(got, want);
|
validate_duplicates(got, want);
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user