mirror of
https://github.com/HiMeditator/auto-caption.git
synced 2026-02-14 03:24:44 +08:00
feat: 更新 README 并添加清空字幕记录功能
- 更新 README 中的项目状态和下载链接 - 添加清空字幕记录的功能 - 优化字幕记录的导出和清空界面 - 更新代码以支持跨平台兼容性 - 添加开源协议
This commit is contained in:
@@ -5,6 +5,7 @@ import icon from '../../resources/icon.png?asset'
|
||||
import { captionWindow } from './caption'
|
||||
import {
|
||||
captionEngine,
|
||||
captionLog,
|
||||
controls,
|
||||
setStyles,
|
||||
sendStyles,
|
||||
@@ -98,6 +99,10 @@ class ControlWindow {
|
||||
captionEngine.stop()
|
||||
this.window?.webContents.send('control.engine.stopped')
|
||||
})
|
||||
// 清空字幕记录
|
||||
ipcMain.on('control.caption.clear', () => {
|
||||
captionLog.splice(0)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,16 +15,26 @@ export class CaptionEngine {
|
||||
this.command = [ controls.customizedCommand ]
|
||||
}
|
||||
else if(controls.engine === 'gummy'){
|
||||
let gummyName = ''
|
||||
if(process.platform === 'win32'){
|
||||
gummyName = 'main-gummy.exe'
|
||||
}
|
||||
else if(process.platform === 'linux'){
|
||||
gummyName = 'main-gummy'
|
||||
}
|
||||
else{
|
||||
throw new Error('Unsupported platform')
|
||||
}
|
||||
if(is.dev){
|
||||
this.appPath = path.join(
|
||||
app.getAppPath(),
|
||||
'python-subprocess', 'dist', 'main-gummy.exe'
|
||||
'python-subprocess', 'dist', gummyName
|
||||
)
|
||||
}
|
||||
else{
|
||||
this.appPath = path.join(
|
||||
process.resourcesPath,
|
||||
'python-subprocess', 'dist', 'main-gummy.exe'
|
||||
'python-subprocess', 'dist', gummyName
|
||||
)
|
||||
}
|
||||
this.command = []
|
||||
|
||||
@@ -34,11 +34,18 @@
|
||||
<span style="margin-right: 30px;">字幕记录</span>
|
||||
<a-button
|
||||
type="primary"
|
||||
style="margin-right: 20px;"
|
||||
@click="exportCaptions"
|
||||
:disabled="captionData.length === 0"
|
||||
>
|
||||
导出字幕记录
|
||||
</a-button>
|
||||
<a-button
|
||||
danger
|
||||
@click="clearCaptions"
|
||||
>
|
||||
清空字幕记录
|
||||
</a-button>
|
||||
</div>
|
||||
<a-table
|
||||
:columns="columns"
|
||||
@@ -128,6 +135,10 @@ function exportCaptions() {
|
||||
document.body.removeChild(a)
|
||||
URL.revokeObjectURL(url)
|
||||
}
|
||||
|
||||
function clearCaptions() {
|
||||
captionLog.clear()
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@@ -21,11 +21,17 @@ export const useCaptionLogStore = defineStore('captionLog', () => {
|
||||
}
|
||||
})
|
||||
|
||||
function clear() {
|
||||
captionData.value = []
|
||||
window.electron.ipcRenderer.send('control.caption.clear')
|
||||
}
|
||||
|
||||
window.electron.ipcRenderer.on('both.log.set', (_, logs) => {
|
||||
captionData.value = logs
|
||||
})
|
||||
|
||||
return {
|
||||
captionData
|
||||
captionData,
|
||||
clear
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user