Skip to content

Support Enhanced LRC format + additional QOL features (Part I)#5

Merged
mebtte merged 22 commits intomebtte:masterfrom
Nafeij:master
May 8, 2023
Merged

Support Enhanced LRC format + additional QOL features (Part I)#5
mebtte merged 22 commits intomebtte:masterfrom
Nafeij:master

Conversation

@Nafeij
Copy link
Copy Markdown
Contributor

@Nafeij Nafeij commented Apr 16, 2023

Enhanced LRC is an extension of Simple LRC Format developed for the A2 Media Player. This supports adding an optional timestamp for words, syllables, or otherwise parts of a line. It takes the format: <mm:ss.xx>.

Enhanced LRC support

  • Add functionality to parse Enhanced LRC
  • Add additional interfaces and functions

20/4/23

  • Add options:
    • enhanced: parse entire input as Simple or Enhanced LRC. default false.
    • strip: ignore empty lines. default false.
  • Parser will now support repeating times for Enhanced LRC
    • Will pre-calculate timing offsets for syllables based on the line's start time.
  • Added relevant types.

25/4/23

  • Add functions:
    • toString: inverse of parse; returns valid lrc for given list of Line objects.
    • expand: alias for toString(parse(lrc: string))
      The use case for this is to 'unroll' or 'expand' lines with repeat-timestamps into separate lines. This is straightforward to implement as parse already does this when building the Lrc list. This is especially useful for Enhanced Lrc as repeating timestamps are not supported by the specification.
  • Add playground options to reflect the features listed above.

Misc

This should be backwards-compatible with previous versions.

Note: This PR is required before merging Part II.

@Nafeij Nafeij changed the title Support Enhanced LRC format Support Enhanced LRC format (Part 1) Apr 16, 2023
@Nafeij Nafeij changed the title Support Enhanced LRC format (Part 1) Support Enhanced LRC format (Part I) Apr 16, 2023
@mebtte
Copy link
Copy Markdown
Owner

mebtte commented Apr 19, 2023

@Nafeij Thanks for contributing.

Supporting enhanced format is a good idea, but i think it's usage may be less than simple format and compatibility with enhanced format will be slow down parse function, so adding a new function like parseEnhanced or adding a option like parse(lrc, { enhanced: true }) is a better choice?

@mebtte
Copy link
Copy Markdown
Owner

mebtte commented Apr 19, 2023

And there is a issue, [00:32.79][00:56.00]Little <00:33.58>jagged <00:34.14>edge<00:35.25> should be generate two items, but only one in the result.
image

@Nafeij
Copy link
Copy Markdown
Contributor Author

Nafeij commented Apr 20, 2023

@mebtte

20/4/23

  • Add options:
    • enhanced: parse entire input as Enhanced LRC, instead of Simple LRC. default false.
    • strip: ignore empty lines. default false.
  • Parser will now support repeating times for Enhanced LRC lines
    • Will pre-calculate timing offsets for syllables based on the line's start time.
  • Added relevant types.

@mebtte
Copy link
Copy Markdown
Owner

mebtte commented Apr 25, 2023

I think strip is unnecessary and it will make developer confusing with empty line and empty content.

@Nafeij Nafeij changed the title Support Enhanced LRC format (Part I) Support Enhanced LRC format + additional QOL features (Part I) Apr 25, 2023
@mebtte
Copy link
Copy Markdown
Owner

mebtte commented Apr 27, 2023

expand is verbose and it's unnecessary.

@mebtte
Copy link
Copy Markdown
Owner

mebtte commented Apr 27, 2023

According to wiki, word is better than syllable .

@mebtte
Copy link
Copy Markdown
Owner

mebtte commented Apr 27, 2023

Rewrite parse(lrc, { enhanced: true }) to parseEnhanced(lrc), it can reuse parse and has better typescript return type.

@mebtte
Copy link
Copy Markdown
Owner

mebtte commented Apr 27, 2023

I think stringify is better than toString.

@mebtte
Copy link
Copy Markdown
Owner

mebtte commented Apr 27, 2023

From the wiki, enhanced lrc format is [time]<time>content<time>content, not [time]content<time>content<time>.

@mebtte
Copy link
Copy Markdown
Owner

mebtte commented May 8, 2023

It seems stringify doesn't do much, because array of Line is more complex than lrc string itself.

@mebtte mebtte merged commit 189c638 into mebtte:master May 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants