From 0f19d79fa2b4a16806487d92a0bf7628f31d947c Mon Sep 17 00:00:00 2001 From: morpheus65535 Date: Fri, 10 Nov 2023 13:59:38 -0500 Subject: [PATCH] Fixed improper subtitles being downloaded when HI is required by languages profile. #2293 --- bazarr/subtitles/download.py | 2 +- libs/subliminal_patch/providers/embeddedsubtitles.py | 1 + libs/subliminal_patch/providers/gestdown.py | 1 + libs/subliminal_patch/providers/hdbits.py | 1 + libs/subliminal_patch/providers/opensubtitlescom.py | 3 ++- libs/subliminal_patch/providers/yifysubtitles.py | 1 + 6 files changed, 7 insertions(+), 2 deletions(-) diff --git a/bazarr/subtitles/download.py b/bazarr/subtitles/download.py index 9aa4fb88c..c4a8e2da7 100644 --- a/bazarr/subtitles/download.py +++ b/bazarr/subtitles/download.py @@ -40,7 +40,7 @@ def generate_subtitles(path, languages, audio_language, sceneName, title, media_ providers = pool.providers language_set = _get_language_obj(languages=languages) - hi_required = any([x.hi for x in language_set]) + hi_required = "force HI" if any([x.hi for x in language_set]) else False also_forced = any([x.forced for x in language_set]) forced_required = all([x.forced for x in language_set]) _set_forced_providers(pool=pool, also_forced=also_forced, forced_required=forced_required) diff --git a/libs/subliminal_patch/providers/embeddedsubtitles.py b/libs/subliminal_patch/providers/embeddedsubtitles.py index b1d7b12f9..2a690331f 100644 --- a/libs/subliminal_patch/providers/embeddedsubtitles.py +++ b/libs/subliminal_patch/providers/embeddedsubtitles.py @@ -32,6 +32,7 @@ class EmbeddedSubtitle(Subtitle): provider_name = "embeddedsubtitles" hash_verifiable = False + hearing_impaired_verifiable = True def __init__(self, stream, container, matches, media_type): super().__init__(stream.language, stream.disposition.hearing_impaired) diff --git a/libs/subliminal_patch/providers/gestdown.py b/libs/subliminal_patch/providers/gestdown.py index f8add61ac..bfdadf699 100644 --- a/libs/subliminal_patch/providers/gestdown.py +++ b/libs/subliminal_patch/providers/gestdown.py @@ -20,6 +20,7 @@ class GestdownSubtitle(Subtitle): provider_name = "gestdown" hash_verifiable = False + hearing_impaired_verifiable = True def __init__(self, language, data: dict): super().__init__(language, hearing_impaired=data["hearingImpaired"]) diff --git a/libs/subliminal_patch/providers/hdbits.py b/libs/subliminal_patch/providers/hdbits.py index ddac50fc6..10793b9ea 100644 --- a/libs/subliminal_patch/providers/hdbits.py +++ b/libs/subliminal_patch/providers/hdbits.py @@ -23,6 +23,7 @@ class HDBitsSubtitle(Subtitle): provider_name = "hdbits" hash_verifiable = False + hearing_impaired_verifiable = True def __init__(self, language, id, name, filename, matches=None, episode=None): super().__init__(language, hearing_impaired=language.hi) diff --git a/libs/subliminal_patch/providers/opensubtitlescom.py b/libs/subliminal_patch/providers/opensubtitlescom.py index 4c2a84d70..8576dc2e0 100644 --- a/libs/subliminal_patch/providers/opensubtitlescom.py +++ b/libs/subliminal_patch/providers/opensubtitlescom.py @@ -74,7 +74,8 @@ def from_opensubtitlescom(lang): class OpenSubtitlesComSubtitle(Subtitle): provider_name = 'opensubtitlescom' - hash_verifiable = False + hash_verifiable = True + hearing_impaired_verifiable = True def __init__(self, language, forced, hearing_impaired, page_link, file_id, releases, uploader, title, year, hash_matched, file_hash=None, season=None, episode=None, imdb_match=False): diff --git a/libs/subliminal_patch/providers/yifysubtitles.py b/libs/subliminal_patch/providers/yifysubtitles.py index 35c1317b1..974582292 100644 --- a/libs/subliminal_patch/providers/yifysubtitles.py +++ b/libs/subliminal_patch/providers/yifysubtitles.py @@ -29,6 +29,7 @@ class YifySubtitle(Subtitle): """YIFY Subtitles""" provider_name = 'yifysubtitles' + hearing_impaired_verifiable = True def __init__(self, language, page_link, release, uploader, rating, hi): super(YifySubtitle, self).__init__(language)