From dcf6ab0792d91fe691ae90e4046063064f3b00b6 Mon Sep 17 00:00:00 2001 From: lyswhut Date: Sat, 20 Mar 2021 19:52:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B8=85=E7=90=86=E5=88=97=E8=A1=A8=E7=BC=93?= =?UTF-8?q?=E5=AD=98=E5=B0=86=E5=90=8C=E6=97=B6=E6=B8=85=E7=90=86=E6=AD=8C?= =?UTF-8?q?=E8=AF=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/store/modules/list.js | 4 +++- src/renderer/utils/music/wy/lyric.js | 34 ++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/src/renderer/store/modules/list.js b/src/renderer/store/modules/list.js index 3d5bea7f..392c367b 100644 --- a/src/renderer/store/modules/list.js +++ b/src/renderer/store/modules/list.js @@ -207,7 +207,9 @@ const mutations = { if (item.typeUrl['320k']) delete item.typeUrl['320k'] if (item.typeUrl.flac) delete item.typeUrl.flac if (item.typeUrl.wav) delete item.typeUrl.wav - // if (item.lxlrc == '') item.lxlrc = null + if (item.lxlrc) item.lxlrc = null + if (item.lrc) item.lrc = null + if (item.tlrc) item.tlrc = null } } }, diff --git a/src/renderer/utils/music/wy/lyric.js b/src/renderer/utils/music/wy/lyric.js index 6ae95d34..301a2bb4 100644 --- a/src/renderer/utils/music/wy/lyric.js +++ b/src/renderer/utils/music/wy/lyric.js @@ -1,5 +1,38 @@ import { httpFetch } from '../../request' import { linuxapi } from './utils/crypto' +// import { decodeName } from '../..' + +// const parseLyric = (str, lrc) => { +// if (!str) return '' + +// str = str.replace(/\r/g, '') + +// let lxlyric = str.replace(/\[((\d+),\d+)\].*/g, str => { +// let result = str.match(/\[((\d+),\d+)\].*/) +// let time = parseInt(result[2]) +// let ms = time % 1000 +// time /= 1000 +// let m = parseInt(time / 60).toString().padStart(2, '0') +// time %= 60 +// let s = parseInt(time).toString().padStart(2, '0') +// time = `${m}:${s}.${ms}` +// str = str.replace(result[1], time) + +// let startTime = 0 +// str = str.replace(/\(0,1\) /g, ' ').replace(/\(\d+,\d+\)/g, time => { +// const [start, end] = time.replace(/^\((\d+,\d+)\)$/, '$1').split(',') + +// time = `<${parseInt(startTime + parseInt(start))},${end}>` +// startTime = parseInt(startTime + parseInt(end)) +// return time +// }) + +// return str +// }) + +// lxlyric = decodeName(lxlyric) +// return lxlyric.trim() +// } export default songmid => { const requestObj = httpFetch('https://music.163.com/api/linux/forward', { @@ -21,6 +54,7 @@ export default songmid => { return { lyric: body.lrc.lyric, tlyric: body.tlyric.lyric, + // lxlyric: parseLyric(body.klyric.lyric), } }) return requestObj