summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJayZed <[email protected]>2024-08-05 21:40:34 -0400
committerGitHub <[email protected]>2024-08-05 21:40:34 -0400
commit5582cc076dd58a63638d96cb0dbc5119554fe127 (patch)
treea1dc7e43068b1f256a811eee3c3b05bb8b7d7721
parent866b1d5894a4f8cf873a4b3d11a0dc8c4bbd47d7 (diff)
downloadbazarr-1.4.4-beta.29.tar.gz
bazarr-1.4.4-beta.29.zip
Fix for provider subtitle language being unintentionally modifiedv1.4.4-beta.29
This prevents unwanted changes to the provider copy of the language. Thanks to @vitiko98 for suggesting a better place for this fix.
-rw-r--r--custom_libs/subliminal_patch/subtitle.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/custom_libs/subliminal_patch/subtitle.py b/custom_libs/subliminal_patch/subtitle.py
index c19acd1ec..06a491be7 100644
--- a/custom_libs/subliminal_patch/subtitle.py
+++ b/custom_libs/subliminal_patch/subtitle.py
@@ -12,6 +12,7 @@ import chardet
import pysrt
import pysubs2
from bs4 import UnicodeDammit
+from copy import deepcopy
from pysubs2 import SSAStyle
from pysubs2.formats.subrip import parse_tags, MAX_REPRESENTABLE_TIME
from pysubs2.time import ms_to_times
@@ -65,6 +66,11 @@ class Subtitle(Subtitle_):
# format = "srt" # default format is srt
def __init__(self, language, hearing_impaired=False, page_link=None, encoding=None, mods=None, original_format=False):
+ # language needs to be cloned because it is actually a reference to the provider language object
+ # if a new copy is not created then all subsequent subtitles for this provider will incorrectly be modified
+ # at least until Bazarr is restarted or the provider language object is recreated somehow
+ language = deepcopy(language)
+
# set subtitle language to hi if it's hearing_impaired
if hearing_impaired:
language = Language.rebuild(language, hi=True)