新增显示歌词翻译设置,默认开启
This commit is contained in:
@@ -177,7 +177,7 @@ const saveMeta = (downloadInfo, filePath, isEmbedPic, isEmbedLyric) => {
|
||||
: Promise.resolve(),
|
||||
isEmbedLyric
|
||||
? downloadInfo.musicInfo.lrc
|
||||
? Promise.resolve(downloadInfo.musicInfo.lrc)
|
||||
? Promise.resolve({ lyric: downloadInfo.musicInfo.lrc, tlyric: downloadInfo.musicInfo.tlrc || '' })
|
||||
: music[downloadInfo.musicInfo.source].getLyric(downloadInfo.musicInfo).promise.catch(err => {
|
||||
console.log(err)
|
||||
return null
|
||||
@@ -190,7 +190,7 @@ const saveMeta = (downloadInfo, filePath, isEmbedPic, isEmbedLyric) => {
|
||||
artist: downloadInfo.musicInfo.singer,
|
||||
album: downloadInfo.musicInfo.albumName,
|
||||
APIC: imgUrl,
|
||||
lyrics,
|
||||
lyrics: lyrics.lyric,
|
||||
})
|
||||
})
|
||||
}
|
||||
@@ -202,10 +202,10 @@ const saveMeta = (downloadInfo, filePath, isEmbedPic, isEmbedLyric) => {
|
||||
*/
|
||||
const downloadLyric = (downloadInfo, filePath) => {
|
||||
const promise = downloadInfo.musicInfo.lrc
|
||||
? Promise.resolve(downloadInfo.musicInfo.lrc)
|
||||
? Promise.resolve({ lyric: downloadInfo.musicInfo.lrc, tlyric: downloadInfo.musicInfo.tlrc || '' })
|
||||
: music[downloadInfo.musicInfo.source].getLyric(downloadInfo.musicInfo).promise
|
||||
promise.then(lrc => {
|
||||
if (lrc) saveLrc(filePath.replace(/(mp3|flac|ape|wav)$/, 'lrc'), lrc)
|
||||
promise.then(lrcs => {
|
||||
if (lrcs.lyric) saveLrc(filePath.replace(/(mp3|flac|ape|wav)$/, 'lrc'), lrcs.lyric)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -60,9 +60,9 @@ const actions = {
|
||||
getLrc({ commit, state }, musicInfo) {
|
||||
if (lrcRequest && lrcRequest.cancelHttp) lrcRequest.cancelHttp()
|
||||
lrcRequest = music[musicInfo.source].getLyric(musicInfo)
|
||||
return lrcRequest.promise.then(lrc => {
|
||||
return lrcRequest.promise.then(({ lyric, tlyric }) => {
|
||||
lrcRequest = null
|
||||
commit('setLrc', { musicInfo, lrc })
|
||||
commit('setLrc', { musicInfo, lyric, tlyric })
|
||||
}).catch(err => {
|
||||
lrcRequest = null
|
||||
return Promise.reject(err)
|
||||
@@ -80,7 +80,8 @@ const mutations = {
|
||||
datas.musicInfo.img = datas.url
|
||||
},
|
||||
setLrc(state, datas) {
|
||||
datas.musicInfo.lrc = datas.lrc
|
||||
datas.musicInfo.lrc = datas.lyric
|
||||
datas.musicInfo.tlrc = datas.tlyric
|
||||
},
|
||||
setList(state, { list, index }) {
|
||||
state.listInfo = list
|
||||
|
||||
Reference in New Issue
Block a user