|
@@ -1,7 +1,7 @@
|
|
|
import { MUSIC_CARD_EMPTY_ARTIST, MUSIC_CARD_EMPTY_TITLE } from './MusicCardConstants'
|
|
import { MUSIC_CARD_EMPTY_ARTIST, MUSIC_CARD_EMPTY_TITLE } from './MusicCardConstants'
|
|
|
|
|
|
|
|
const DEFAULT_TIME_TEXT = '00:00'
|
|
const DEFAULT_TIME_TEXT = '00:00'
|
|
|
-const LYRIC_TIMESTAMP_PATTERN = /\[(\d{2}):(\d{2})\.(\d{2,3})\]/g
|
|
|
|
|
|
|
+const LYRIC_TIMESTAMP_PATTERN = /\[(\d{2}):(\d{2})(?:\.(\d{2,3}))?\]/g
|
|
|
|
|
|
|
|
const isNonEmpty = (value?: string): boolean => {
|
|
const isNonEmpty = (value?: string): boolean => {
|
|
|
return !!value && value.trim() !== ''
|
|
return !!value && value.trim() !== ''
|
|
@@ -101,8 +101,10 @@ export function resolveMusicCardLyricLines(
|
|
|
const minutes = parseInt(match[1], 10)
|
|
const minutes = parseInt(match[1], 10)
|
|
|
const seconds = parseInt(match[2], 10)
|
|
const seconds = parseInt(match[2], 10)
|
|
|
const msPart = match[3]
|
|
const msPart = match[3]
|
|
|
- const msValue =
|
|
|
|
|
- msPart.length === 2 ? parseInt(msPart, 10) * 10 : parseInt(msPart, 10)
|
|
|
|
|
|
|
+ let msValue = 0
|
|
|
|
|
+ if (msPart) {
|
|
|
|
|
+ msValue = msPart.length === 2 ? parseInt(msPart, 10) * 10 : parseInt(msPart, 10)
|
|
|
|
|
+ }
|
|
|
const timeMs = minutes * 60 * 1000 + seconds * 1000 + msValue
|
|
const timeMs = minutes * 60 * 1000 + seconds * 1000 + msValue
|
|
|
|
|
|
|
|
timestamps.push({ timeMs })
|
|
timestamps.push({ timeMs })
|