mirror of
https://github.com/HiMeditator/auto-caption.git
synced 2026-02-14 11:34:43 +08:00
feat功能): 完善字幕引擎并添加字幕记录导出功能
- 丰富了 README.md 文件,介绍了字幕引擎的原理和构建方法 - 更新了 .gitignore 文件,排除了 build 目录 - 移除了 python-prototype 和 python-subprocess 目录下的无用代码 - 添加了字幕记录导出功能,用户可以将字幕数据导出为 JSON 文件 - 调整了字幕控制面板,移除了未使用的 Whisper 引擎选项
This commit is contained in:
@@ -30,7 +30,16 @@
|
||||
</div>
|
||||
|
||||
<div class="caption-list">
|
||||
<div class="caption-title">字幕记录</div>
|
||||
<div class="caption-title">
|
||||
<span style="margin-right: 30px;">字幕记录</span>
|
||||
<a-button
|
||||
type="primary"
|
||||
@click="exportCaptions"
|
||||
:disabled="captionData.length === 0"
|
||||
>
|
||||
导出字幕记录
|
||||
</a-button>
|
||||
</div>
|
||||
<a-table
|
||||
:columns="columns"
|
||||
:data-source="captionData"
|
||||
@@ -105,6 +114,20 @@ const columns = [
|
||||
function openCaptionWindow() {
|
||||
window.electron.ipcRenderer.send('control.captionWindow.activate')
|
||||
}
|
||||
|
||||
function exportCaptions() {
|
||||
const jsonData = JSON.stringify(captionData.value, null, 2)
|
||||
const blob = new Blob([jsonData], { type: 'application/json' })
|
||||
const url = URL.createObjectURL(blob)
|
||||
const a = document.createElement('a')
|
||||
a.href = url
|
||||
const timestamp = new Date().toISOString().replace(/[:.]/g, '-')
|
||||
a.download = `captions-${timestamp}.json`
|
||||
document.body.appendChild(a)
|
||||
a.click()
|
||||
document.body.removeChild(a)
|
||||
URL.revokeObjectURL(url)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@@ -15,15 +15,6 @@ export const useCaptionControlStore = defineStore('captionControl', () => {
|
||||
{ value: 'ko', label: '韩语' }
|
||||
]
|
||||
},
|
||||
{
|
||||
value: 'whisper',
|
||||
label: '本地-OpenAI-Whisper',
|
||||
languages: [
|
||||
{ value: 'auto', label: '自动检测' },
|
||||
{ value: 'en', label: '英语' },
|
||||
{ value: 'zh', label: '简体中文' }
|
||||
]
|
||||
},
|
||||
])
|
||||
const engineEnabled = ref(false)
|
||||
|
||||
@@ -82,7 +73,8 @@ export const useCaptionControlStore = defineStore('captionControl', () => {
|
||||
engineEnabled.value = true
|
||||
notification.open({
|
||||
message: '字幕引擎启动',
|
||||
description: `原语言:${sourceLang.value},是否翻译:${translation.value?'是':'否'},翻译语言:${targetLang.value}`
|
||||
description: `原语言:${sourceLang.value},是否翻译:${translation.value?'是':'否'}` +
|
||||
(translation.value ? `,翻译语言:${targetLang.value}` : '')
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user