From d00d49135adeb3b6040d2bb42494850f32a542e1 Mon Sep 17 00:00:00 2001 From: Bill Thiede Date: Sun, 7 Jun 2020 16:38:38 -0700 Subject: [PATCH] Print suggested empty directory cleanup and clean lint. --- src/lib.rs | 13 +------------ src/main.rs | 3 ++- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 4225a63..bb9b186 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -329,17 +329,6 @@ impl Movie { })) } } - - fn min_resolution(&self) -> Option { - if self.files.is_empty() { - None - } else { - Some(self.files.iter().fold( - Resolution(usize::max_value(), usize::max_value()), - |acc, (_, cmd)| std::cmp::min(acc, cmd.largest_dimension().unwrap()), - )) - } - } } impl Display for Movie { @@ -671,7 +660,7 @@ impl MovieLibrary { Ok(movies_from_paths_compact_metadata(p_cmd)) } - pub fn videos(&self) -> Result<(HashMap), Error> { + pub fn videos(&self) -> Result, Error> { let path = Path::new(&self.root).join(COMPACT_METADATA_FILENAME); let f = File::open(&path).context(format!("open {}", path.display()))?; let r = BufReader::new(f); diff --git a/src/main.rs b/src/main.rs index 3aa176b..4e8cf3e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -261,10 +261,11 @@ fn main() -> Result<(), Box> { Command::EmptyDirs => { let lib = MovieLibrary::new(MOVIE_DIR); let dirs = lib.empty_dirs()?; + let root = Path::new(&lib.root); if !dirs.is_empty() { println!("Empty directories:"); for d in dirs { - println!(" {}", d); + println!(r#"rm -rf "{}""#, root.join(d).to_string_lossy()); } } }