开放API 添加歌词翻译字段

This commit is contained in:
lyswhut
2024-04-16 16:18:07 +08:00
parent c54b38a068
commit 32f47aaa34
8 changed files with 44 additions and 23 deletions
+1 -1
View File
@@ -87,7 +87,7 @@ export const init = () => {
onPlay(line, text) {
setText(text, Math.max(line, 0))
setStatusText(text)
window.app_event.lyricLinePlay(text)
window.app_event.lyricLinePlay(text, line)
// console.log(line, text)
},
onSetLyric(lines, offset) { // listening lyrics seting event
@@ -9,6 +9,7 @@ import { throttle } from '@common/utils'
import { pause, play, playNext, playPrev } from '@renderer/core/player'
import { playProgress } from '@renderer/store/player/playProgress'
import { appSetting } from '@renderer/store/setting'
import { lyric } from '@renderer/store/player/lyric'
export default () => {
// const setVisibleDesktopLyric = useCommit('setVisibleDesktopLyric')
@@ -58,9 +59,11 @@ export default () => {
picUrl: musicInfo.pic ?? '',
})
}
const handleSetLyricLine = (text: string) => {
const handleSetLyricLine = (text: string, line: number) => {
let curLine = lyric.lines[line]?.extendedLyrics.join('\n') ?? ''
sendPlayerStatus({
lyricLineText: text,
lyricLineAllText: curLine ? text + '\n' + curLine : text,
})
}
// const handleSetTaskbarThumbnailClip = (clip) => {