Function parse

Source
pub fn parse(text: &str) -> Vec<Line>
Expand description

Reads lyrics text, timed or not.

One parser for both, because a tag can perfectly well hold LRC — plenty of taggers write the synced text straight into LYRICS, and a reader that only understood plain text would show a page of [00:12.34] to the user.

The .lrc metadata headers ([ar:…], [ti:…], [by:…]) are dropped: they repeat what the tags already say, and this file is not where the artist’s name is settled. [offset:…] is applied, since it exists precisely to shift a file that was timed against another encoding. An unrepresentable timestamp remains literal, untimed text rather than hiding the line or overflowing. Timed blank lines are kept, including at the end, so a player can clear the preceding verse. Only untimed blank edges and an initial UTF-8 BOM are removed.

Repeated timestamps share a text budget of max(1 MiB, 4 * text.len()) bytes across the entire result. A line that cannot fit its expanded copies remains one untimed literal line, preserving its words and timestamps.