From 959df65e0a86bd1d008244fa16ee463740cb7a94 Mon Sep 17 00:00:00 2001 From: lyswhut Date: Sat, 10 Dec 2022 15:42:26 +0800 Subject: [PATCH] update match --- src/common/utils/lyric-font-player/line-player.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/common/utils/lyric-font-player/line-player.js b/src/common/utils/lyric-font-player/line-player.js index fb8e7920..ad56083a 100644 --- a/src/common/utils/lyric-font-player/line-player.js +++ b/src/common/utils/lyric-font-player/line-player.js @@ -23,8 +23,9 @@ const parseExtendedLyric = (lrcLinesMap, extendedLyric) => { if (text) { const times = timeField.match(timeExp) if (times == null) continue - for (const time of times) { - const timeStr = time.replace(/(?:\.0+|(\.\d+?)0+)$/, '$1') + for (let time of times) { + if (!time.includes('.')) time += '.0' + const timeStr = time.replace(/(?:\.0+|0+)$/, '') const targetLine = lrcLinesMap[timeStr] if (targetLine) targetLine.extendedLyrics.push(text) } @@ -82,8 +83,9 @@ module.exports = class LinePlayer { if (text) { const times = timeField.match(timeExp) if (times == null) continue - for (const time of times) { - const timeStr = time.replace(/(?:\.0+|(\.\d+?)0+)$/, '$1') + for (let time of times) { + if (!time.includes('.')) time += '.0' + const timeStr = time.replace(/(?:\.0+|0+)$/, '') if (linesMap[timeStr]) { linesMap[timeStr].extendedLyrics.push(text) continue