From c086725d987ef69df082a80ab7c8ccc77e492e7b Mon Sep 17 00:00:00 2001 From: himeditator Date: Mon, 23 Jun 2025 20:23:03 +0800 Subject: [PATCH] =?UTF-8?q?feat(renderer):=20=E4=BF=AE=E6=94=B9=E9=83=A8?= =?UTF-8?q?=E5=88=86=E9=A1=B5=E9=9D=A2=E6=8F=90=E7=A4=BA=E3=80=81=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E8=8B=B1=E6=96=87=E7=89=88README?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 5 +- README_en.md | 101 ++++++++++++++++++++ src/renderer/src/components/CaptionData.vue | 4 +- src/renderer/src/stores/captionControl.ts | 9 +- 4 files changed, 113 insertions(+), 6 deletions(-) create mode 100644 README_en.md diff --git a/README.md b/README.md index 40b2f61..528cd1c 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,10 @@

auto-caption

Auto Caption 是一个跨平台的字幕显示软件。

- 项目初版已经开发完毕。 +

+ | 简体中文 + | English | +

![](./assets/01.png) diff --git a/README_en.md b/README_en.md new file mode 100644 index 0000000..5faf204 --- /dev/null +++ b/README_en.md @@ -0,0 +1,101 @@ +
+ +

auto-caption

+

Auto Caption is a cross-platform subtitle display software.

+

+ | 简体中文 + | English | +

+
+ +![](./assets/01.png) + +## 📥 Download + +[GitHub Releases](https://github.com/HiMeditator/auto-caption/releases) + +## 📚 User Manual + +Not available yet. + +### Basic Usage + +Currently, only an installable version for the Windows platform is provided. If using the default Gummy subtitle engine, you need to obtain an API KEY from Alibaba Cloud's Bailian platform and configure it in the environment variables to use the model properly. Related tutorials: [Get API KEY](https://help.aliyun.com/zh/model-studio/get-api-key), [Configure API Key through Environment Variables](https://help.aliyun.com/zh/model-studio/configure-api-key-through-environment-variables). + +For developers, you can create new subtitle engines. Please refer to the source code for specific communication specifications. + +## ✨ Features + +- Rich subtitle style settings +- Flexible subtitle engine selection +- Multi-language recognition and translation +- Subtitle record display and export +- Generate subtitles for audio output and microphone input + +Note: The Windows platform supports generating subtitles for both audio output and microphone input, while the Linux platform only supports generating subtitles for microphone input. + +## 🚀 Project Execution + +### Install Dependencies + +```bash +npm install +``` + +### Build Subtitle Engine + +> #### Background +> +> The so-called subtitle engine is actually a subprocess that will real-time acquire streaming data from system audio input (recording) or output (playing sound) and call an audio-to-text model to generate corresponding subtitles for the audio. The generated subtitles are output as JSON data converted to strings via IPC and returned to the main program. The main program reads the subtitle data, processes it, and displays it on the window. +> +> Currently, the project uses the [Alibaba Cloud Gummy Model](https://help.aliyun.com/zh/model-studio/gummy-speech-recognition-translation/) by default, which requires obtaining an API KEY from Alibaba Cloud's Bailian platform and configuring it in the environment variables to function properly. Related tutorials: [Get API KEY](https://help.aliyun.com/zh/model-studio/get-api-key), [Configure API Key through Environment Variables](https://help.aliyun.com/zh/model-studio/configure-api-key-through-environment-variables). +> +> The gummy subtitle engine in this project is a Python subprocess, packaged into an executable file using pyinstaller. The code for running the subtitle engine subprocess is in the `src\main\utils\engine.ts` file. + +First, enter the `python-subprocess` folder and execute the following command to create a virtual environment: + +```bash +python -m venv subenv +``` + +Then activate the virtual environment: + +```bash +# Windows +subenv/Scripts/activate +# Linux +source subenv/bin/activate +``` + +Then install the dependencies (note that if you are in a Linux environment, you need to comment out `PyAudioWPatch` in `requirements.txt`, as this module is only applicable to the Windows environment): + +```bash +pip install -r requirements.txt +``` + +Then build the project using `pyinstaller`: + +```bash +pyinstaller --onefile main-gummy.py +``` + +At this point, the project is built. You can find the corresponding executable file in the `python-subprocess/dist` folder. You can proceed with further operations. + +### Run the Project + +```bash +npm run dev +``` + +### Build the Project + +Please note that the software is not currently adapted for macOS. Use Windows or Linux systems for building. + +```bash +# For Windows +npm run build:win +# For macOS +npm run build:mac +# For Linux +npm run build:linux +``` \ No newline at end of file diff --git a/src/renderer/src/components/CaptionData.vue b/src/renderer/src/components/CaptionData.vue index 029dcaf..d7d1d63 100644 --- a/src/renderer/src/components/CaptionData.vue +++ b/src/renderer/src/components/CaptionData.vue @@ -2,7 +2,7 @@
- + @@ -81,7 +81,7 @@ import { useCaptionControlStore } from '@renderer/stores/captionControl' const captionLog = useCaptionLogStore() const { captionData } = storeToRefs(captionLog) const captionControl = useCaptionControlStore() -const { engineEnabled, engine } = storeToRefs(captionControl) +const { engineEnabled, engine, customized, customizedApp } = storeToRefs(captionControl) const pagination = ref({ current: 1, pageSize: 10, diff --git a/src/renderer/src/stores/captionControl.ts b/src/renderer/src/stores/captionControl.ts index 8d40bf9..dffbafb 100644 --- a/src/renderer/src/stores/captionControl.ts +++ b/src/renderer/src/stores/captionControl.ts @@ -90,11 +90,14 @@ export const useCaptionControlStore = defineStore('captionControl', () => { window.electron.ipcRenderer.on('control.engine.started', () => { engineEnabled.value = true + const str0 = + `原语言:${sourceLang.value},是否翻译:${translation.value?'是':'否'},` + + `字幕引擎:${engine.value},音频类型:${audio.value ? '输入音频' : '输出音频'}` + + (translation.value ? `,翻译语言:${targetLang.value}` : ''); + const str1 = `类型:自定义引擎,引擎路径:${customizedApp.value},命令参数:${customizedCommand.value}`; notification.open({ message: '字幕引擎启动', - description: `原语言:${sourceLang.value},是否翻译:${translation.value?'是':'否'},` + - `字幕引擎:${engine.value},音频类型:${audio.value ? '输入音频' : '输出音频'}` + - (translation.value ? `,翻译语言:${targetLang.value}` : '') + description: (customized.value && customizedApp.value) ? str1 : str0 }); })