diff options
author | Vitiko <[email protected]> | 2023-06-13 22:35:43 -0400 |
---|---|---|
committer | Vitiko <[email protected]> | 2023-06-13 22:35:43 -0400 |
commit | 2b0e435f6a6485e833233f9fab9203ef1b02d184 (patch) | |
tree | bd1841067ce73c6411dd82aa0a761d19965ca570 | |
parent | 6ac5bc7d4d7717254fc6de2a2b176a372f73378c (diff) | |
download | bazarr-1.2.2-beta.18.tar.gz bazarr-1.2.2-beta.18.zip |
Update language equals mechanismv1.2.2-beta.18
This commit will avoid the core requesting languages that are not
supported by providers.
-rw-r--r-- | libs/subliminal_patch/core.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libs/subliminal_patch/core.py b/libs/subliminal_patch/core.py index 8d6f54ff5..cd5bc5561 100644 --- a/libs/subliminal_patch/core.py +++ b/libs/subliminal_patch/core.py @@ -330,6 +330,8 @@ class SZProviderPool(ProviderPool): :rtype: list of :class:`~subliminal.subtitle.Subtitle` or None """ + logger.debug("Languages requested: %s", languages) + if self.language_hook: languages_search_base = self.language_hook(provider) else: @@ -354,10 +356,14 @@ class SZProviderPool(ProviderPool): return [] # list subtitles - logger.info('Listing subtitles with provider %r and languages %r', provider, provider_languages) results = [] + + to_request = self.lang_equals.translate(provider_languages) & set(provider_registry[provider].languages) + + logger.info('Listing subtitles with provider %r and languages %r', provider, to_request) + try: - results = self[provider].list_subtitles(video, self.lang_equals.translate(provider_languages)) + results = self[provider].list_subtitles(video, to_request) seen = [] out = [] for s in results: |