[bugfix]: support final lyric with no newline (#240)
This commit is contained in:
parent
4e5e3bc9a1
commit
c90a56811d
1 changed files with 2 additions and 2 deletions
|
@ -18,11 +18,11 @@ const lyricsIpc = isElectron() ? window.electron.lyrics : null;
|
|||
|
||||
// Match LRC lyrics format by https://github.com/ustbhuangyi/lyric-parser
|
||||
// [mm:ss.SSS] text
|
||||
const timeExp = /\[(\d{2,}):(\d{2})(?:\.(\d{2,3}))?]([^\n]+)\n/g;
|
||||
const timeExp = /\[(\d{2,}):(\d{2})(?:\.(\d{2,3}))?]([^\n]+)(\n|$)/g;
|
||||
|
||||
// Match karaoke lyrics format returned by NetEase
|
||||
// [SSS,???] text
|
||||
const alternateTimeExp = /\[(\d*),(\d*)]([^\n]+)\n/g;
|
||||
const alternateTimeExp = /\[(\d*),(\d*)]([^\n]+)(\n|$)/g;
|
||||
|
||||
const formatLyrics = (lyrics: string) => {
|
||||
const synchronizedLines = lyrics.matchAll(timeExp);
|
||||
|
|
Reference in a new issue