pub fn to_mp3_file<P: AsRef<Path>>(
src_path: P,
dst_path: P,
chapters: &[Chapter],
) -> Result<(), String>Expand description
Writes chapters to MP3 file’s ID3 tag frames.
If the file already has chapters, they will be replaced.
§Example:
let chapters = vec![
Chapter {
start: Duration::seconds(0),
title: Some("Introduction".to_string()),
link: Some(Link{
url: url::Url::parse("https://www.rice.edu").unwrap(),
title: None,
}),
..Default::default()
},
Chapter {
start: Duration::seconds(42),
title: Some("Status quo".to_string()),
..Default::default()
},
Chapter {
start: chrono::Duration::minutes(5) + chrono::Duration::seconds(8),
title: Some(String::from("On being first")),
link: Some(Link{
url: url::Url::parse("https://www.osti.gov/opennet/manhattan-project-history/Events/1945/trinity.htm").unwrap(),
title: Some(String::from("The Trinity Test")),
}),
..Default::default()
},
];
chapters::to_mp3_file(src_filepath, dst_filepath, &chapters).expect("Failed to write chapters");