From c90a56811d5d64243aea142ed4717a4c16dc4a88 Mon Sep 17 00:00:00 2001 From: Kendall Garner <17521368+kgarner7@users.noreply.github.com> Date: Sun, 10 Sep 2023 22:07:21 +0000 Subject: [PATCH] [bugfix]: support final lyric with no newline (#240) --- src/renderer/features/lyrics/queries/lyric-query.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/renderer/features/lyrics/queries/lyric-query.ts b/src/renderer/features/lyrics/queries/lyric-query.ts index b7ab064b..599c5857 100644 --- a/src/renderer/features/lyrics/queries/lyric-query.ts +++ b/src/renderer/features/lyrics/queries/lyric-query.ts @@ -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);