Filter noisy messages
This commit is contained in:
+13
-1
@@ -1,6 +1,7 @@
|
||||
mod config;
|
||||
mod eq_discovery;
|
||||
mod events;
|
||||
mod filters;
|
||||
mod kokoro;
|
||||
mod npc_voices;
|
||||
mod speakers;
|
||||
@@ -16,6 +17,7 @@ use crossterm::{
|
||||
terminal::{EnterAlternateScreen, LeaveAlternateScreen, disable_raw_mode, enable_raw_mode},
|
||||
};
|
||||
use events::LogEvent;
|
||||
use filters::DialogueFilters;
|
||||
use ratatui::{Terminal, backend::CrosstermBackend};
|
||||
use std::{
|
||||
io::{self, stdout},
|
||||
@@ -53,6 +55,7 @@ struct RuntimeChannels {
|
||||
worker_control: tokio_mpsc::Sender<Config>,
|
||||
audio_control: mpsc::Sender<AudioCommand>,
|
||||
tailer_generation: Arc<AtomicUsize>,
|
||||
filters: DialogueFilters,
|
||||
}
|
||||
|
||||
#[tokio::main]
|
||||
@@ -67,6 +70,7 @@ async fn main() -> Result<()> {
|
||||
}
|
||||
|
||||
let _ = npc_voices::builtin_index();
|
||||
let filters = DialogueFilters::load()?;
|
||||
let speakers = speakers::SpeakerStore::load()?;
|
||||
let (worker_sender, worker_receiver) = mpsc::channel::<WorkerEvent>();
|
||||
let audio_sender = spawn_audio_worker(config.volume, worker_sender.clone());
|
||||
@@ -81,7 +85,13 @@ async fn main() -> Result<()> {
|
||||
let tailer_generation = Arc::new(AtomicUsize::new(0));
|
||||
if config.log_path.as_ref().is_some_and(|path| path.is_file()) {
|
||||
let path = config.log_path.clone().expect("log path was checked");
|
||||
spawn_log_tailer(path, worker_sender.clone(), tailer_generation.clone(), 0);
|
||||
spawn_log_tailer(
|
||||
path,
|
||||
filters.clone(),
|
||||
worker_sender.clone(),
|
||||
tailer_generation.clone(),
|
||||
0,
|
||||
);
|
||||
}
|
||||
|
||||
let mut app = App::new(config, speakers);
|
||||
@@ -92,6 +102,7 @@ async fn main() -> Result<()> {
|
||||
worker_control,
|
||||
audio_control: audio_sender,
|
||||
tailer_generation,
|
||||
filters,
|
||||
};
|
||||
run_terminal(&mut app, channels).await
|
||||
}
|
||||
@@ -131,6 +142,7 @@ async fn run_loop(
|
||||
if let Some(path) = app.config.log_path.clone().filter(|path| path.is_file()) {
|
||||
spawn_log_tailer(
|
||||
path,
|
||||
channels.filters.clone(),
|
||||
channels.worker_sender.clone(),
|
||||
channels.tailer_generation.clone(),
|
||||
generation,
|
||||
|
||||
Reference in New Issue
Block a user