From 1e7d3941d9b2f0aa291db9b52b67c97abca774ff Mon Sep 17 00:00:00 2001 From: Chidi Williams Date: Tue, 3 Jan 2023 20:56:50 +0000 Subject: [PATCH] Fail transcription task if whisper transcription fails with non-zero exit code (#295) --- buzz/transcriber.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/buzz/transcriber.py b/buzz/transcriber.py index 7c42912e..23ed4a70 100644 --- a/buzz/transcriber.py +++ b/buzz/transcriber.py @@ -376,7 +376,11 @@ class WhisperFileTranscriber(QObject): 'whisper process completed with code = %s, time taken = %s, number of segments = %s', self.current_process.exitcode, datetime.datetime.now() - time_started, len(self.segments)) - self.completed.emit(self.segments) + if self.current_process.exitcode == 0: + self.completed.emit(self.segments) + else: + self.error.emit('Unknown error') + self.running = False def stop(self): @@ -406,6 +410,7 @@ class WhisperFileTranscriber(QObject): progress = int(line.split('|')[0].strip().strip('%')) self.progress.emit((progress, 100)) except ValueError: + logging.debug('whisper (stderr): %s', line) continue @@ -611,6 +616,7 @@ class FileTranscriberQueueWorker(QObject): self.current_transcriber.completed.connect(self.on_task_completed) # Wait for next item on the queue + self.current_transcriber.error.connect(self.run) self.current_transcriber.completed.connect(self.run) self.current_transcriber_thread.start()