mirror of
https://github.com/morpheus65535/bazarr.git
synced 2025-02-24 06:46:20 +08:00
core: update to subliminal_patch:head; core: try and fix #703
This commit is contained in:
parent
5dc8facae7
commit
64fa210688
2 changed files with 10 additions and 3 deletions
|
@ -31,7 +31,7 @@ from subliminal.core import guessit, ProviderPool, io, is_windows_special_path,
|
||||||
ThreadPoolExecutor, check_video
|
ThreadPoolExecutor, check_video
|
||||||
from subliminal_patch.exceptions import TooManyRequests, APIThrottled
|
from subliminal_patch.exceptions import TooManyRequests, APIThrottled
|
||||||
|
|
||||||
from subzero.language import Language, ENDSWITH_LANGUAGECODE_RE
|
from subzero.language import Language, ENDSWITH_LANGUAGECODE_RE, FULL_LANGUAGE_LIST
|
||||||
from scandir import scandir, scandir_generic as _scandir_generic
|
from scandir import scandir, scandir_generic as _scandir_generic
|
||||||
import six
|
import six
|
||||||
|
|
||||||
|
@ -610,7 +610,8 @@ def _search_external_subtitles(path, languages=None, only_one=False, scandir_gen
|
||||||
forced = "forced" in adv_tag
|
forced = "forced" in adv_tag
|
||||||
|
|
||||||
# remove possible language code for matching
|
# remove possible language code for matching
|
||||||
p_root_bare = ENDSWITH_LANGUAGECODE_RE.sub("", p_root)
|
p_root_bare = ENDSWITH_LANGUAGECODE_RE.sub(
|
||||||
|
lambda m: "" if str(m.group(1)).lower() in FULL_LANGUAGE_LIST else m.group(0), p_root)
|
||||||
|
|
||||||
p_root_lower = p_root_bare.lower()
|
p_root_lower = p_root_bare.lower()
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import types
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from babelfish.exceptions import LanguageError
|
from babelfish.exceptions import LanguageError
|
||||||
from babelfish import Language as Language_, basestr
|
from babelfish import Language as Language_, basestr, LANGUAGE_MATRIX
|
||||||
from six.moves import zip
|
from six.moves import zip
|
||||||
|
|
||||||
repl_map = {
|
repl_map = {
|
||||||
|
@ -33,6 +33,12 @@ repl_map = {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ALPHA2_LIST = list(set(filter(lambda x: x, map(lambda x: x.alpha2, LANGUAGE_MATRIX)) + repl_map.values()))
|
||||||
|
ALPHA3b_LIST = list(set(filter(lambda x: x, map(lambda x: x.alpha3, LANGUAGE_MATRIX)) +
|
||||||
|
filter(lambda x: len(x) == 3, repl_map.keys())))
|
||||||
|
FULL_LANGUAGE_LIST = ALPHA2_LIST + ALPHA3b_LIST
|
||||||
|
|
||||||
|
|
||||||
def language_from_stream(l):
|
def language_from_stream(l):
|
||||||
if not l:
|
if not l:
|
||||||
raise LanguageError()
|
raise LanguageError()
|
||||||
|
|
Loading…
Reference in a new issue