Print suggested empty directory cleanup and clean lint.
This commit is contained in:
parent
18108b5d44
commit
d00d49135a
13
src/lib.rs
13
src/lib.rs
@ -329,17 +329,6 @@ impl Movie {
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
fn min_resolution(&self) -> Option<Resolution> {
|
||||
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<String, CompactMetadata>), Error> {
|
||||
pub fn videos(&self) -> Result<HashMap<String, CompactMetadata>, 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);
|
||||
|
||||
@ -261,10 +261,11 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user