async clipify
This commit is contained in:
@@ -207,18 +207,16 @@ async fn analyze(file: String) -> Analysis {
|
||||
|
||||
async fn clipify(file: String, content_spans: Vec<lib::video::ContentSpan>) -> String {
|
||||
let d = format!("{}.d", &file);
|
||||
match content_spans.iter()
|
||||
.map(|content_span| {
|
||||
lib::video::clip(
|
||||
&format!("{}/{}.mp4", &d, content_span.start),
|
||||
&file,
|
||||
*content_span,
|
||||
)
|
||||
})
|
||||
.filter(|x| x.is_err())
|
||||
.map(|x| x.err().unwrap())
|
||||
.nth(0) {
|
||||
Some(err_msg) => err_msg,
|
||||
let mut last_err = None;
|
||||
for content_span in content_spans.iter() {
|
||||
let output = format!("{}/{}.mp4", &d, content_span.start);
|
||||
let cur = lib::video::clip_async(&output, &file, *content_span).await;
|
||||
if cur.is_err() {
|
||||
last_err = Some(format!("failed to clipify {} at {}..{}: {}", &file, &content_span.start, &content_span.stop, cur.err().unwrap()));
|
||||
}
|
||||
}
|
||||
match last_err {
|
||||
Some(msg) => msg,
|
||||
None => {
|
||||
match opener::open(d.clone()) {
|
||||
Ok(_) => d,
|
||||
|
||||
Reference in New Issue
Block a user