From 3cba9352a83d71fd571c9177251196fd70afed77 Mon Sep 17 00:00:00 2001 From: McCloudS Date: Sat, 1 Mar 2025 17:53:42 -0700 Subject: [PATCH] reorganize detect-language logic --- subgen.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/subgen.py b/subgen.py index 07c3dcc..1d44256 100644 --- a/subgen.py +++ b/subgen.py @@ -1,4 +1,4 @@ -subgen_version = '2025.02.95' +subgen_version = '2025.03.4' from language_code import LanguageCode from datetime import datetime @@ -1070,6 +1070,9 @@ def gen_subtitles_queue(file_path: str, transcription_type: str, force_language: return force_language = choose_transcribe_language(file_path, force_language) + + if should_skip_file(file_path, force_language): # skip a file before we waste time detecting it's language + return # check if we would like to detect audio language in case of no audio language specified. Will return here again with specified language from whisper if not force_language and should_whiser_detect_audio_language: @@ -1078,9 +1081,7 @@ def gen_subtitles_queue(file_path: str, transcription_type: str, force_language: task_queue.put(task_id) logging.debug(f"Added to queue: {task_id['path']} [type: {task_id.get('type', 'transcribe')}]") return - - if should_skip_file(file_path, force_language): - return + task = { 'path': file_path,