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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/*!
# LRC
A pure Rust implementation of LyRiCs which is a computer file format that synchronizes song lyrics with an audio file.
## Examples
```rust
use lrc::{Lyrics, TimeTag};
let mut lyrics = Lyrics::new();
lyrics.metadata.set_title("Let's Twist Again").unwrap();
lyrics.metadata.set_album("Hits Of The 60's - Vol. 2 – Oldies").unwrap();
lyrics.add_timed_line(TimeTag::from_str("00:12.00").unwrap(), "Naku Penda Piya-Naku Taka Piya-Mpenziwe").unwrap();
lyrics.add_timed_line(TimeTag::from_str("00:15.30").unwrap(), "Some more lyrics").unwrap();
assert_eq!(
r"[al: Hits Of The 60's - Vol. 2 – Oldies]
[ti: Let's Twist Again]
[00:12.00]Naku Penda Piya-Naku Taka Piya-Mpenziwe
[00:15.30]Some more lyrics",
lyrics.to_string()
);
```
```rust
use lrc::{Lyrics, TimeTag};
let lyrics = Lyrics::from_str(r"[00:12.00][01:15.00]Naku Penda Piya-Naku Taka Piya-Mpenziwe
[00:15.30][01:18.00]Some more lyrics ...").unwrap();
assert_eq!(
Some("Naku Penda Piya-Naku Taka Piya-Mpenziwe"),
lyrics.line_at(TimeTag::from_str("00:13.00").unwrap())
);
let shifted = lyrics.shifted(1000);
assert_eq!(
Some("Naku Penda Piya-Naku Taka Piya-Mpenziwe"),
lyrics.line_at(TimeTag::from_str("00:12.00").unwrap())
);
assert_eq!(None, shifted.line_at(TimeTag::from_str("00:12.00").unwrap()));
assert_eq!(
Some("Naku Penda Piya-Naku Taka Piya-Mpenziwe"),
shifted.line_at(TimeTag::from_str("00:13.00").unwrap())
);
```
```rust
use std::io::Cursor;
use lrc::Lyrics;
let lyrics = Lyrics::from_reader(Cursor::new("[ti:Let's Twist Again]\n[00:12.00]Line")).unwrap();
assert_eq!(Some("Let's Twist Again"), lyrics.metadata.title());
let mut output = Vec::new();
lyrics.to_writer(&mut output).unwrap();
assert_eq!("[ti: Let's Twist Again]\n\n[00:12.00]Line", String::from_utf8(output).unwrap());
```
*/
/// Input and output helpers for `Lyrics`.
/// Metadata helpers and storage.
/// LRC tag types.
pub use *;
pub use *;
pub use *;
pub use *;