1
0
Fork 0
mirror of https://github.com/morpheus65535/bazarr synced 2024-12-21 23:32:31 +00:00

no log: small fixes to my latest commit

This commit is contained in:
morpheus65535 2024-08-27 21:51:14 -04:00
parent 74f2c66464
commit f1f3850f9e
2 changed files with 6 additions and 3 deletions

View file

@ -2,7 +2,6 @@
import os
import logging
import re
from guess_language import guess_language
from subliminal_patch import core
@ -136,6 +135,7 @@ def guess_external_subtitles(dest_folder, subtitles, media_type, previously_inde
continue
text = text.decode(encoding)
if core.parse_for_hi_regex(subtitle_text=text, alpha3_language=language.alpha3):
if core.parse_for_hi_regex(subtitle_text=text,
alpha3_language=language.alpha3 if hasattr(language, 'alpha3') else None):
subtitles[subtitle] = Language.rebuild(subtitles[subtitle], forced=False, hi=True)
return subtitles

View file

@ -1213,7 +1213,10 @@ def save_subtitles(file_path, subtitles, single=False, directory=None, chmod=Non
continue
# create subtitle path
if subtitle.text and parse_for_hi_regex(subtitle_text=subtitle.text, alpha3_language=subtitle.language.alpha3):
if subtitle.text and parse_for_hi_regex(subtitle_text=subtitle.text,
alpha3_language=subtitle.language.alpha3 if
(hasattr(subtitle, 'language') and hasattr(subtitle.language, 'alpha3'))
else None):
subtitle.language.hi = True
subtitle_path = get_subtitle_path(file_path, None if single else subtitle.language,
forced_tag=subtitle.language.forced,