https://github.com/magiclen/lrc
A pure Rust implementation of LyRiCs which is a computer file format that synchronizes song lyrics with an audio file.
https://github.com/magiclen/lrc
lyrics rust
Last synced: about 1 year ago
JSON representation
A pure Rust implementation of LyRiCs which is a computer file format that synchronizes song lyrics with an audio file.
- Host: GitHub
- URL: https://github.com/magiclen/lrc
- Owner: magiclen
- License: mit
- Created: 2020-04-06T10:31:19.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2024-04-06T11:44:33.000Z (about 2 years ago)
- Last Synced: 2025-03-24T17:55:17.310Z (about 1 year ago)
- Topics: lyrics, rust
- Language: Rust
- Homepage:
- Size: 34.2 KB
- Stars: 7
- Watchers: 2
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
LRC
====================
[](https://github.com/magiclen/lrc/actions/workflows/ci.yml)
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, IDTag, TimeTag};
let mut lyrics = Lyrics::new();
let metadata = &mut lyrics.metadata;
metadata.insert(IDTag::from_string("ti", "Let's Twist Again").unwrap());
metadata.insert(IDTag::from_string("al", "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();
if let Some(index) = lyrics.find_timed_line_index(TimeTag::from_str("00:13.00").unwrap()) {
let timed_lines = lyrics.get_timed_lines();
assert_eq!((TimeTag::from_str("00:12.00").unwrap(), "Naku Penda Piya-Naku Taka Piya-Mpenziwe".into()), timed_lines[index]);
} else {
unreachable!();
}
```
## Crates.io
https://crates.io/crates/lrc
## Documentation
https://docs.rs/lrc
## License
[MIT](LICENSE)