根据歌词翻译、罗马音设置决定是否将其写入歌词标签

This commit is contained in:
lyswhut 2023-12-23 18:36:34 +08:00
parent e3f2121080
commit 125310bfdd

View File

@ -10,6 +10,7 @@ import ParseName from './ParseName'
import { downloadFile, mkdir, stat } from '@/utils/fs' import { downloadFile, mkdir, stat } from '@/utils/fs'
import { useUnmounted } from '@/utils/hooks' import { useUnmounted } from '@/utils/hooks'
import { getLyricInfo, getPicUrl } from '@/core/music/local' import { getLyricInfo, getPicUrl } from '@/core/music/local'
import settingState from '@/store/setting/state'
export interface Metadata { export interface Metadata {
name: string // 歌曲名 name: string // 歌曲名
@ -146,11 +147,16 @@ export default forwardRef<MetadataFormType, {}>((props, ref) => {
source: 'local', source: 'local',
}, },
isRefresh: false, isRefresh: false,
}).then(async({ lyric }) => { }).then(async({ lyric, tlyric, rlyric }) => {
if (isUnmounted.current || path != filePath.current) return if (isUnmounted.current || path != filePath.current) return
toast(t('metadata_edit_modal_form_match_lyric_success')) toast(t('metadata_edit_modal_form_match_lyric_success'))
let lrc = [
lyric,
settingState.setting['player.isShowLyricTranslation'] && tlyric ? tlyric : '',
settingState.setting['player.isShowLyricRoma'] && rlyric ? rlyric : '',
]
setData(data => { setData(data => {
return { ...data, lyric } return { ...data, lyric: lrc.join('\n\n').trim() }
}) })
}).catch(() => { }).catch(() => {
if (isUnmounted.current || path != filePath.current) return if (isUnmounted.current || path != filePath.current) return