From a001e913e35ccdf3f200b03f6d07cf2e1e03b6de Mon Sep 17 00:00:00 2001 From: Kim Date: Sat, 9 Nov 2024 09:35:47 -0500 Subject: [PATCH] Add new logging invocation for in-progress VOSK monitoring, as well as migrate to f-string syntax for rest of buscribe. --- buscribe/buscribe/buscribe.py | 2 ++ buscribe/buscribe/main.py | 6 +++--- buscribe/buscribe/recognizer.py | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/buscribe/buscribe/buscribe.py b/buscribe/buscribe/buscribe.py index c42f48b..eeb8c29 100644 --- a/buscribe/buscribe/buscribe.py +++ b/buscribe/buscribe/buscribe.py @@ -55,6 +55,8 @@ def transcribe_segments(segments: list, sample_rate: int, recognizer: BuscribeRe if line_start_time > start_of_transcript: write_line(result_json, line_start_time, line_end_time, db_cursor) + logging.info(f"Line successfully written for duration {line_end_time - line_start_time}") + if stopping.is_set(): return segments_end_time diff --git a/buscribe/buscribe/main.py b/buscribe/buscribe/main.py index e223307..76dbe3a 100644 --- a/buscribe/buscribe/main.py +++ b/buscribe/buscribe/main.py @@ -61,18 +61,18 @@ def main(channel, database="", base_dir=".", logging.error("Couldn't figure out start time!") db_conn.close() exit(1) - logging.info("Start time: {}".format(start_time)) + logging.info(f"Start time: {start_time}") if end_time is not None: end_time = dateutil.parse(end_time) - logging.info("End time: {}".format(end_time)) + logging.info(f"End time: {end_time}") logging.info("Loading models...") recognizer = BuscribeRecognizer(SAMPLE_RATE, model, spk_model) logging.info("Models loaded.") - logging.info('Transcribing from {}'.format(start_time)) + logging.info(f'Transcribing from {start_time}') # Start priming the recognizer if possible start_of_transcription = start_time diff --git a/buscribe/buscribe/recognizer.py b/buscribe/buscribe/recognizer.py index 075820e..a1a3246 100644 --- a/buscribe/buscribe/recognizer.py +++ b/buscribe/buscribe/recognizer.py @@ -1,7 +1,7 @@ from vosk import Model, SpkModel, KaldiRecognizer -class BuscribeRecognizer(): +class BuscribeRecognizer: segments_start_time = None def __init__(self, sample_rate=48000, model_path="model_small", spk_model_path="spk_model"):