summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorzx900930 <[email protected]>2021-02-15 01:39:57 +0100
committerzx900930 <[email protected]>2021-02-15 01:39:57 +0100
commit46e709c9986f4fa1ae57499141f575bef2dfdddf (patch)
tree52d085ac479c83ecb546b79e1f0a6492417190d1
parentcf0cc5df1da3f7854a2a161a792f56b261566fe8 (diff)
downloadbazarr-46e709c9986f4fa1ae57499141f575bef2dfdddf.tar.gz
bazarr-46e709c9986f4fa1ae57499141f575bef2dfdddf.zip
improve chinese language codes matching rules
-rw-r--r--bazarr/list_subtitles.py6
-rw-r--r--libs/subliminal_patch/core.py4
2 files changed, 4 insertions, 6 deletions
diff --git a/bazarr/list_subtitles.py b/bazarr/list_subtitles.py
index 4b7dd2133..cc819e28f 100644
--- a/bazarr/list_subtitles.py
+++ b/bazarr/list_subtitles.py
@@ -545,10 +545,8 @@ def guess_external_subtitles(dest_folder, subtitles):
detected_language = guess_language(text)
#add simplified and traditional chinese detection
if detected_language == 'zh':
- simplified_chinese = [".chs", ".sc", ".zhs", ".hans", ".gb", u"简", u"双语"]
- if any(ext in str(subtitle_path).lower() for ext in simplified_chinese):
- detected_language == 'zh'
- else:
+ traditional_chinese = [".cht", ".tc", ".traditional",".zh-tw", ".zht", "hant", "big5", u"繁", u"雙語"]
+ if any(ext in (str(subtitle_path).lower())[:-16] for ext in traditional_chinese):
detected_language == 'zt'
except UnicodeDecodeError:
detector = Detector()
diff --git a/libs/subliminal_patch/core.py b/libs/subliminal_patch/core.py
index 76e11402a..07cd6ad91 100644
--- a/libs/subliminal_patch/core.py
+++ b/libs/subliminal_patch/core.py
@@ -637,8 +637,8 @@ def _search_external_subtitles(path, languages=None, only_one=False, scandir_gen
hi = any(i for i in hi_tag if i in adv_tag)
#add simplified/traditional chinese detection
- simplified_chinese = ["chs", "sc", "zhs", "hans", "gb", u"简", u"双语"]
- traditional_chinese = ["cht", "tc", "zht", "hant", "big5", u"繁", u"雙語"]
+ simplified_chinese = ["chs", "sc", "zhs", "hans","zh-hans", "gb", "简", "简中", "简体", "简体中文", "中英双语", "中日双语","中法双语"]
+ traditional_chinese = ["cht", "tc", "zht", "hant","zh-hant", "big5", "繁", "繁中", "繁体", "繁體","繁体中文", "繁體中文", "正體中文", "中英雙語", "中日雙語","中法雙語"]
FULL_LANGUAGE_LIST.extend(simplified_chinese)
FULL_LANGUAGE_LIST.extend(traditional_chinese)
p_root = p_root.replace('zh-TW', 'zht')