improve notifier + add transcriber

This commit is contained in:
LeonardoTrapani
2025-08-16 16:17:48 +02:00
parent 688152ea13
commit feda62a7d4
8 changed files with 492 additions and 47 deletions
+23
View File
@@ -158,6 +158,7 @@ func (d *Daemon) toggle() {
d.mu.Unlock()
go d.notifier.RecordingStarted()
go d.monitorPipelineErrors(p)
case pipeline.Recording:
d.stopPipeline() // aborted during recording (chunks not sent to transcriber yet)
@@ -179,3 +180,25 @@ func (d *Daemon) toggle() {
go d.notifier.Aborted()
}
}
func (d *Daemon) monitorPipelineErrors(p pipeline.Pipeline) {
errorCh := p.GetErrorCh()
for {
select {
case pipelineErr := <-errorCh:
d.handlePipelineError(pipelineErr)
case <-d.ctx.Done():
return
}
}
}
func (d *Daemon) handlePipelineError(pipelineErr pipeline.PipelineError) {
message := pipelineErr.Message
if pipelineErr.Err != nil {
message = fmt.Sprintf("%s: %v", message, pipelineErr.Err)
}
d.notifier.Error(message)
}