修复歌词解析问题

pull/930/merge
lyswhut 2022-03-14 19:38:48 +08:00
parent 916975b0a9
commit 04858cc42c
3 changed files with 5 additions and 5 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "lx-music-desktop", "name": "lx-music-desktop",
"version": "1.19.0-beta4", "version": "1.19.0-beta6",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -1,6 +1,6 @@
{ {
"name": "lx-music-desktop", "name": "lx-music-desktop",
"version": "1.19.0-beta5", "version": "1.19.0-beta6",
"description": "一个免费的音乐查找助手", "description": "一个免费的音乐查找助手",
"main": "./dist/electron/main.js", "main": "./dist/electron/main.js",
"productName": "lx-music-desktop", "productName": "lx-music-desktop",

View File

@ -40,9 +40,7 @@ module.exports = class LinePlayer {
} }
_initTag() { _initTag() {
this.tags = { this.tags = {}
offset: 0,
}
for (let tag in tagRegMap) { for (let tag in tagRegMap) {
const matches = this.lyric.match(new RegExp(`\\[${tagRegMap[tag]}:([^\\]]*)]`, 'i')) const matches = this.lyric.match(new RegExp(`\\[${tagRegMap[tag]}:([^\\]]*)]`, 'i'))
this.tags[tag] = (matches && matches[1]) || '' this.tags[tag] = (matches && matches[1]) || ''
@ -50,6 +48,8 @@ module.exports = class LinePlayer {
if (this.tags.offset) { if (this.tags.offset) {
let offset = parseInt(this.tags.offset) let offset = parseInt(this.tags.offset)
this.tags.offset = Number.isNaN(offset) ? 0 : offset this.tags.offset = Number.isNaN(offset) ? 0 : offset
} else {
this.tags.offset = 0
} }
} }