aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-06-20 20:11:52 +0800
committer魏曹先生 <1992414357@qq.com>2026-06-20 20:11:52 +0800
commitdbeac25149b52a6a069ad29dd75204c8953b365c (patch)
tree51deb16eafde53273b6b89f4a0da06c87982c4f5 /src/main.rs
parent90595bbed2b0fdfda45980dc7ebff8c4eb11dcbd (diff)
feat: add pinyin conversion for Chinese output
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/main.rs b/src/main.rs
index fabf16c..e3a5b84 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -31,7 +31,7 @@ impl OutputChannel {
}
}
- async fn send(&self, message: &str) {
+ async fn send_to_channel(&self, message: &str) {
match self {
OutputChannel::Stdout(p) => p.clone().send(message).await,
OutputChannel::Stderr(p) => p.clone().send(message).await,
@@ -252,17 +252,19 @@ async fn main() {
match rx.recv().await {
Ok(event) => match event {
vtx_engine::EngineEvent::TranscriptionComplete(result) => {
- let formatted = format_output(&pattern, &result.text, 0.0, last_volume_db);
+ let raw = maybe_to_pinyin(&result.text, args.use_pinyin);
+ let formatted = format_output(&pattern, &raw, 0.0, last_volume_db);
for ch in &channels {
- ch.send(&formatted).await;
+ ch.send_to_channel(&formatted).await;
}
}
vtx_engine::EngineEvent::TranscriptionSegment(segment) => {
- let formatted = format_output(&pattern, &segment.text, 0.0, last_volume_db);
+ let raw = maybe_to_pinyin(&segment.text, args.use_pinyin);
+ let formatted = format_output(&pattern, &raw, 0.0, last_volume_db);
for ch in &channels {
- ch.send(&formatted).await;
+ ch.send_to_channel(&formatted).await;
}
}
vtx_engine::EngineEvent::VisualizationData(viz) => {