| Crates.io | ssa_parser |
| lib.rs | ssa_parser |
| version | 0.1.0 |
| created_at | 2024-11-12 14:13:44.67826+00 |
| updated_at | 2024-11-12 14:13:44.67826+00 |
| description | A ssa subtitle parsing library |
| homepage | |
| repository | https://github.com/mikai233/subtitle_parser |
| max_upload_size | |
| id | 1444998 |
| size | 70,293 |
fn main() -> anyhow::Result<()> {
let path = "your .ass file path here";
let mut file = ssa_parser::file::File::from_file(path)?;
let offset_duration = Duration::from_secs(1);
for event in file.events.iter_mut() {
if let Some(start) = event
.get_mut(EventFormat::Start)
.and_then(Value::as_duration_mut)
{
*start += offset_duration;
}
if let Some(end) = event
.get_mut(EventFormat::End)
.and_then(Value::as_duration_mut)
{
*end += offset_duration;
}
}
Ok(())
}