Print movie length in human friendly time.

This commit is contained in:
2019-11-04 20:23:45 -08:00
parent 297124eedb
commit b77d61bbe6
3 changed files with 26 additions and 8 deletions

View File

@@ -2,6 +2,7 @@ use std::collections::HashMap;
use std::error::Error;
use std::path::Path;
use std::path::PathBuf;
use std::time::Duration;
use human_format::Formatter;
use human_format::Scales;
@@ -45,7 +46,7 @@ fn print_video_groups(video_groups: &HashMap<PathBuf, Vec<(String, CompactMetada
" {:>9} {:>9} {} {}",
md.largest_dimension().unwrap(),
fmtr.format(md.size as f64),
md.duration,
humantime::Duration::from(Duration::from_secs(md.duration as u64)),
&p[p.rfind("/").unwrap() + 1..]
);
}
@@ -69,7 +70,7 @@ fn print_videos(videos: &HashMap<String, CompactMetadata>, filter: Option<&Regex
"{:>9} {:>8} {} {}",
md.largest_dimension().unwrap(),
fmtr.format(md.size as f64),
md.duration,
humantime::Duration::from(Duration::from_secs(md.duration as u64)),
&name[MOVIE_DIR.len() + 1..]
);
println!("mv '{}' '{}'", name, TO_BE_REMOVED_DIR);