diff --git a/src/video.rs b/src/video.rs index 5ac753a..98027b9 100644 --- a/src/video.rs +++ b/src/video.rs @@ -26,11 +26,16 @@ pub fn create_playlist(video_path: &str, playlist_file: &str) { .arg("-vf") .arg("scale=1080:-2,setsar=1:1") .arg(playlist_file) - .output() - .expect("Expected this to work.."); + .spawn(); - println!("{:?}", result); - println!("Status: {}", String::from_utf8(result.stdout).unwrap()) + let start_time = std::time::Instant::now(); + loop { + std::thread::sleep(std::time::Duration::from_secs(1)); + + if Path::new(playlist_file).exists() || std::time::Instant::now() - start_time > std::time::Duration::from_secs(5) { + break; + } + } } pub fn generate_video_thumbnail(path: &Path, destination: &Path) {