From 8ac1c99c63fdb3bb00c295a01a47bffaa84fce82 Mon Sep 17 00:00:00 2001 From: himeditator Date: Tue, 8 Jul 2025 01:33:48 +0800 Subject: [PATCH] =?UTF-8?q?feat(log):=20=E6=B7=BB=E5=8A=A0=E5=AD=97?= =?UTF-8?q?=E5=B9=95=E8=AE=B0=E5=BD=95=E5=A4=8D=E5=88=B6=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=20(#3)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 提高记录时间精度,精确到毫秒 - 在字幕记录组件中添加复制到剪贴板的功能 - 提供多种复制选项,包括是否添加序号、是否复制时间、选择复制内容等 --- README.md | 2 +- README_en.md | 2 +- README_ja.md | 6 +-- caption-engine/audio2text/gummy.py | 4 +- src/renderer/src/components/CaptionLog.vue | 58 +++++++++++++++++++--- src/renderer/src/i18n/lang/en.ts | 9 ++++ src/renderer/src/i18n/lang/ja.ts | 9 ++++ src/renderer/src/i18n/lang/zh.ts | 9 ++++ 8 files changed, 84 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 6e9eb49..4dd4d25 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,7 @@ $$ 48000\, \text{samples/second} \times 2\,\text{bytes/sample} \times 1\, \text{channel} = 93.75\,\text{KB/s} $$ -模型结果回传流量消耗较小,可以不纳入考虑。 +而且引擎只会获取到音频流的时候才会上传数据,因此实际上传速率可能更小。模型结果回传流量消耗较小,可以不纳入考虑。 ### Vosk 字幕引擎(本地) diff --git a/README_en.md b/README_en.md index e6edb4b..45f1e06 100644 --- a/README_en.md +++ b/README_en.md @@ -76,7 +76,7 @@ $$ 48000\, \text{samples/second} \times 2\,\text{bytes/sample} \times 1\, \text{channel} = 93.75\,\text{KB/s} $$ -The traffic consumption for returning the model results is relatively small and can be disregarded. +Moreover, the engine only uploads data when it gets an audio stream, so the actual upload speed may be smaller. The traffic consumption for returning the model results is relatively small and can be disregarded. ### Vosk Subtitle Engine (Local) diff --git a/README_ja.md b/README_ja.md index 9fcd570..f685608 100644 --- a/README_ja.md +++ b/README_ja.md @@ -49,10 +49,6 @@ - Linux プラットフォームでは、現在マイク入力の字幕生成のみがサポートされています。 - 現在、macOS プラットフォームには対応していません。 -以下是你选择的内容翻译成日语的结果: - ---- - ## ⚙️ 搭載字幕エンジンの説明 現在のソフトウェアには 1 つの字幕エンジンが搭載されており、新しい 2 つのエンジンが計画されています。それぞれの詳細情報は以下の通りです。 @@ -80,7 +76,7 @@ $$ 48000\, \text{samples/second} \times 2\,\text{bytes/sample} \times 1\, \text{channel} = 93.75\,\text{KB/s} $$ -モデルからの結果返送によるトラフィック消費は小さく、考慮する必要はありません。 +また、エンジンは音声ストリームを取得したときのみデータをアップロードするため、実際のアップロード速度はさらに小さくなる可能性があります。モデルからの結果返送によるトラフィック消費は小さく、考慮する必要はありません。 ### Vosk 字幕エンジン(ローカル) diff --git a/caption-engine/audio2text/gummy.py b/caption-engine/audio2text/gummy.py index 949039b..0b79d98 100644 --- a/caption-engine/audio2text/gummy.py +++ b/caption-engine/audio2text/gummy.py @@ -39,12 +39,12 @@ class Callback(TranslationRecognizerCallback): caption['text'] = transcription_result.text if caption['index'] != self.cur_id: self.cur_id = caption['index'] - cur_time = datetime.now().strftime('%H:%M:%S') + cur_time = datetime.now().strftime('%H:%M:%S.%f')[:-3] caption['time_s'] = cur_time self.time_str = cur_time else: caption['time_s'] = self.time_str - caption['time_t'] = datetime.now().strftime('%H:%M:%S') + caption['time_t'] = datetime.now().strftime('%H:%M:%S.%f')[:-3] caption['translation'] = "" if translation_result is not None: diff --git a/src/renderer/src/components/CaptionLog.vue b/src/renderer/src/components/CaptionLog.vue index 6de96ae..e9d3fed 100644 --- a/src/renderer/src/components/CaptionLog.vue +++ b/src/renderer/src/components/CaptionLog.vue @@ -9,15 +9,36 @@ style="margin-right: 20px;" @click="exportCaptions" :disabled="captionData.length === 0" - > - {{ $t('log.export') }} - + >{{ $t('log.export') }} + + + + {{ $t('log.copy') }} + + - {{ $t('log.clear') }} - + >{{ $t('log.clear') }} ${item.time_t}\n`.replace(/\./g, ',') + if(copyOption.value === 'both') content += `${item.text}\n${item.translation}\n\n` + else if(copyOption.value === 'source') content += `${item.text}\n\n` + else if(copyOption.value === 'translation') content += `${item.translation}\n\n` + } + navigator.clipboard.writeText(content) + message.success(t('log.copySuccess')) +} + function clearCaptions() { captionLog.clear() }