1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#[macro_use]
extern crate tracing;
use subtitler::types::AnyResult;
use subtitler::vtt::parse_content;
use tracing::Level;
use tracing_subscriber::FmtSubscriber;
#[tokio::main(flavor = "current_thread")]
async fn main() -> AnyResult<()> {
let subscriber = FmtSubscriber::builder()
.with_max_level(Level::INFO)
.finish();
tracing::subscriber::set_global_default(subscriber).expect("setting default subscriber failed");
let content: &str = r#"
WEBVTT
1
00:00:01.000 --> 00:00:03.500
Hi there! How have you been?
2
00:00:04.000 --> 00:00:06.500
I've been good, just busy with work.
3
00:00:07.000 --> 00:00:09.500
What project are you currently working on?
4
00:00:10.000 --> 00:00:12.500
I'm developing a new feature for our app.
5
00:00:13.000 --> 00:00:15.500
That sounds exciting! What does it do?
6
00:00:16.000 --> 00:00:18.500
It's a tool for user feedback and surveys.
7
00:00:19.000 --> 00:00:21.500
Nice! When do you think it will be ready?
8
00:00:22.000 --> 00:00:24.500
I expect to finish it by next week.
9
00:00:25.000 --> 00:00:27.500
Great! I can't wait to try it out.
10
00:00:28.000 --> 00:00:30.500
Thanks! I'm looking forward to your feedback.
"#;
let subtitle = parse_content(content)?;
info!("subtitle {:#?}", subtitle);
info!("subtitle json {}", serde_json::to_string_pretty(&subtitle)?);
Ok(())
}