use std::fs::File;
use std::io::Write;
use std::path::Path;
use crate::error::Result;
use crate::srt::captions_to_srt;
use crate::types::Caption;
pub fn write_srt(path: &Path, captions: &[Caption]) -> Result<()> {
let content = captions_to_srt(captions);
let mut file = File::create(path)?;
file.write_all(content.as_bytes())?;
Ok(())
}