reorganize detect-language logic

This commit is contained in:
McCloudS
2025-03-01 17:53:42 -07:00
parent a9a68c2397
commit 3cba9352a8

View File

@@ -1,4 +1,4 @@
subgen_version = '2025.02.95' subgen_version = '2025.03.4'
from language_code import LanguageCode from language_code import LanguageCode
from datetime import datetime from datetime import datetime
@@ -1071,6 +1071,9 @@ def gen_subtitles_queue(file_path: str, transcription_type: str, force_language:
force_language = choose_transcribe_language(file_path, force_language) 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 # 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: if not force_language and should_whiser_detect_audio_language:
# make a detect language task # make a detect language task
@@ -1079,8 +1082,6 @@ def gen_subtitles_queue(file_path: str, transcription_type: str, force_language:
logging.debug(f"Added to queue: {task_id['path']} [type: {task_id.get('type', 'transcribe')}]") logging.debug(f"Added to queue: {task_id['path']} [type: {task_id.get('type', 'transcribe')}]")
return return
if should_skip_file(file_path, force_language):
return
task = { task = {
'path': file_path, 'path': file_path,