[web] Fix last line of timed lyrics

This commit is contained in:
Alain Nussbaumer
2025-05-12 20:56:07 +02:00
parent 775eac28a5
commit 136732b024
5 changed files with 48 additions and 50 deletions

View File

@@ -32,7 +32,7 @@
"eslint-config-prettier": "^10.1.5",
"eslint-plugin-vue": "^10.1.0",
"prettier": "^3.5.3",
"sass": "^1.87.0",
"sass": "^1.88.0",
"vite": "^6.3.5"
}
},
@@ -4379,9 +4379,9 @@
"license": "MIT"
},
"node_modules/sass": {
"version": "1.87.0",
"resolved": "https://registry.npmjs.org/sass/-/sass-1.87.0.tgz",
"integrity": "sha512-d0NoFH4v6SjEK7BoX810Jsrhj7IQSYHAHLi/iSpgqKc7LaIDshFRlSg5LOymf9FqQhxEHs2W5ZQXlvy0KD45Uw==",
"version": "1.88.0",
"resolved": "https://registry.npmjs.org/sass/-/sass-1.88.0.tgz",
"integrity": "sha512-sF6TWQqjFvr4JILXzG4ucGOLELkESHL+I5QJhh7CNaE+Yge0SI+ehCatsXhJ7ymU1hAFcIS3/PBpjdIbXoyVbg==",
"dev": true,
"license": "MIT",
"dependencies": {

View File

@@ -36,7 +36,7 @@
"eslint-config-prettier": "^10.1.5",
"eslint-plugin-vue": "^10.1.0",
"prettier": "^3.5.3",
"sass": "^1.87.0",
"sass": "^1.88.0",
"vite": "^6.3.5"
}
}

View File

@@ -110,17 +110,15 @@ export default {
/\[(?<minutes>\d+):(?<seconds>\d+)(?:\.(?<hundredths>\d+))?\] ?(?<text>.*)/u
this.playerStore.lyricsContent.split('\n').forEach((line) => {
const match = regex.exec(line)
if (match?.groups?.text) {
if (match) {
const { text, minutes, seconds, hundredths } = match.groups
const verse = {
text,
time:
const verse = text.trim()
if (verse) {
const time =
(Number(minutes) * 60 + Number(`${seconds}.${hundredths ?? 0}`)) *
1000
verses.push({ text: verse, time })
}
verses.push(verse)
} else {
verses.push({ text: line.trim() })
}
})
verses.forEach((verse, index, lyrics) => {