Skip to content

Commit 87c5c6d

Browse files
committed
Fix prepare_for_transcription method for the microphone source type
1 parent 80449f5 commit 87c5c6d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/controllers/main_controller.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ def prepare_for_transcription(self, transcription: Transcription):
7272
self.transcription.source_path = transcription.source_path
7373
elif transcription.source_type == AudioSource.MIC:
7474
threading.Thread(target=self._start_recording_from_mic).start()
75+
return
7576
elif transcription.source_type == AudioSource.YOUTUBE:
7677
self._prepare_for_youtube_video_transcription()
7778

@@ -285,6 +286,13 @@ def _start_recording_from_mic(self):
285286
filename = "mic-output.wav"
286287
au.save_audio_data(audio_data, filename=filename)
287288
self.transcription.source_path = Path(filename)
289+
290+
threading.Thread(
291+
target=lambda loop: loop.run_until_complete(
292+
self._handle_transcription_process()
293+
),
294+
args=(asyncio.new_event_loop(),),
295+
).start()
288296
else:
289297
e = ValueError("No audio detected")
290298
self._handle_exception(e)

0 commit comments

Comments
 (0)