Fix subtitle checking logic to properly separate internal vs external subtitle detection (#228)

- Line 1139: Change has_subtitle_language() to has_subtitle_language_in_file() for SKIPIFINTERNALSUBLANG check
- Line 1148: Change has_subtitle_language() to has_subtitle_of_language_in_folder() for SKIPIFEXTERNALSUB check

This fixes the logic conflict where:
- SKIPIFINTERNALSUBLANG should only check for internal/embedded subtitles
- SKIPIFEXTERNALSUB should only check for external subtitle files

Previously both were using has_subtitle_language() which checks both internal AND external,
causing incorrect skip behavior when users wanted to generate subtitles despite having
internal subtitles but skip when external subtitle files exist.
This commit is contained in:
McCloudS
2025-08-21 23:21:01 -04:00
parent 94cc7c5005
commit 405476ca87

View File

@@ -1,4 +1,4 @@
subgen_version = '2025.08.3'
subgen_version = '2025.08.4'
from language_code import LanguageCode
from datetime import datetime
@@ -1136,7 +1136,7 @@ def should_skip_file(file_path: str, target_language: LanguageCode) -> bool:
return True
# 4. Skip if an internal subtitle exists in skipifinternalsublang language.
if skipifinternalsublang and has_subtitle_language(file_path, skipifinternalsublang):
if skipifinternalsublang and has_subtitle_language_in_file(file_path, skipifinternalsublang):
lang_name = skipifinternalsublang.to_name()
logging.info(f"Skipping {base_name}: Internal subtitles in {lang_name} already exist.")
return True
@@ -1144,7 +1144,7 @@ def should_skip_file(file_path: str, target_language: LanguageCode) -> bool:
# 5. Skip if an external subtitle exists in the namesublang language
if skipifexternalsub and namesublang and LanguageCode.is_valid_language(namesublang):
external_lang = LanguageCode.from_string(namesublang)
if has_subtitle_language(file_path, external_lang):
if has_subtitle_of_language_in_folder(file_path, external_lang):
lang_name = external_lang.to_name()
logging.info(f"Skipping {base_name}: External subtitles in {lang_name} already exist.")
return True