|
|
@ -31,9 +31,9 @@ def manual_search(path, profile_id, providers, sceneName, title, media_type):
|
|
|
|
|
|
|
|
|
|
|
|
pool = _get_pool(media_type, profile_id)
|
|
|
|
pool = _get_pool(media_type, profile_id)
|
|
|
|
|
|
|
|
|
|
|
|
language_set, initial_language_set, original_format = _get_language_obj(profile_id=profile_id)
|
|
|
|
language_set, original_format = _get_language_obj(profile_id=profile_id)
|
|
|
|
also_forced = any([x.forced for x in initial_language_set])
|
|
|
|
also_forced = any([x.forced for x in language_set])
|
|
|
|
forced_required = all([x.forced for x in initial_language_set])
|
|
|
|
forced_required = all([x.forced for x in language_set])
|
|
|
|
compute_score = ComputeScore(get_scores())
|
|
|
|
compute_score = ComputeScore(get_scores())
|
|
|
|
_set_forced_providers(pool=pool, also_forced=also_forced, forced_required=forced_required)
|
|
|
|
_set_forced_providers(pool=pool, also_forced=also_forced, forced_required=forced_required)
|
|
|
|
|
|
|
|
|
|
|
@ -57,6 +57,10 @@ def manual_search(path, profile_id, providers, sceneName, title, media_type):
|
|
|
|
minimum_score_movie = settings.general.minimum_score_movie
|
|
|
|
minimum_score_movie = settings.general.minimum_score_movie
|
|
|
|
|
|
|
|
|
|
|
|
for s in subtitles[video]:
|
|
|
|
for s in subtitles[video]:
|
|
|
|
|
|
|
|
if s.language not in language_set:
|
|
|
|
|
|
|
|
# HI may not be matching what was requested
|
|
|
|
|
|
|
|
continue
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
matches = s.get_matches(video)
|
|
|
|
matches = s.get_matches(video)
|
|
|
|
except AttributeError:
|
|
|
|
except AttributeError:
|
|
|
@ -75,20 +79,8 @@ def manual_search(path, profile_id, providers, sceneName, title, media_type):
|
|
|
|
logging.debug("BAZARR Ignoring invalid subtitles")
|
|
|
|
logging.debug("BAZARR Ignoring invalid subtitles")
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
|
|
|
|
|
|
|
|
initial_hi = None
|
|
|
|
|
|
|
|
initial_hi_match = False
|
|
|
|
|
|
|
|
for language in initial_language_set:
|
|
|
|
|
|
|
|
if s.language.basename == language.basename and \
|
|
|
|
|
|
|
|
s.language.forced == language.forced and \
|
|
|
|
|
|
|
|
s.language.hi == language.hi:
|
|
|
|
|
|
|
|
initial_hi = language.hi
|
|
|
|
|
|
|
|
initial_hi_match = True
|
|
|
|
|
|
|
|
break
|
|
|
|
|
|
|
|
if not initial_hi_match:
|
|
|
|
|
|
|
|
initial_hi = None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_, max_score, scores = _get_scores(media_type, minimum_score_movie, minimum_score)
|
|
|
|
_, max_score, scores = _get_scores(media_type, minimum_score_movie, minimum_score)
|
|
|
|
score, score_without_hash = compute_score(matches, s, video, hearing_impaired=initial_hi)
|
|
|
|
score, score_without_hash = compute_score(matches, s, video, hearing_impaired=s.language.hi)
|
|
|
|
if 'hash' not in matches:
|
|
|
|
if 'hash' not in matches:
|
|
|
|
not_matched = scores - matches
|
|
|
|
not_matched = scores - matches
|
|
|
|
s.score = score_without_hash
|
|
|
|
s.score = score_without_hash
|
|
|
@ -96,11 +88,6 @@ def manual_search(path, profile_id, providers, sceneName, title, media_type):
|
|
|
|
s.score = score
|
|
|
|
s.score = score
|
|
|
|
not_matched = set()
|
|
|
|
not_matched = set()
|
|
|
|
|
|
|
|
|
|
|
|
if s.hearing_impaired == initial_hi:
|
|
|
|
|
|
|
|
matches.add('hearing_impaired')
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
not_matched.add('hearing_impaired')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
releases = []
|
|
|
|
releases = []
|
|
|
|
if hasattr(s, 'release_info'):
|
|
|
|
if hasattr(s, 'release_info'):
|
|
|
|
if s.release_info is not None:
|
|
|
|
if s.release_info is not None:
|
|
|
@ -215,7 +202,6 @@ def manual_download_subtitle(path, audio_language, hi, forced, subtitle, provide
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _get_language_obj(profile_id):
|
|
|
|
def _get_language_obj(profile_id):
|
|
|
|
initial_language_set = set()
|
|
|
|
|
|
|
|
language_set = set()
|
|
|
|
language_set = set()
|
|
|
|
|
|
|
|
|
|
|
|
profile = get_profiles_list(profile_id=int(profile_id))
|
|
|
|
profile = get_profiles_list(profile_id=int(profile_id))
|
|
|
@ -232,22 +218,13 @@ def _get_language_obj(profile_id):
|
|
|
|
lang_obj = _get_lang_obj(lang)
|
|
|
|
lang_obj = _get_lang_obj(lang)
|
|
|
|
|
|
|
|
|
|
|
|
if forced == "True":
|
|
|
|
if forced == "True":
|
|
|
|
lang_obj = Language.rebuild(lang_obj, forced=True)
|
|
|
|
language_set.add(Language.rebuild(lang_obj, forced=True))
|
|
|
|
|
|
|
|
elif hi == "only":
|
|
|
|
if hi == "True":
|
|
|
|
language_set.add(Language.rebuild(lang_obj, hi=True))
|
|
|
|
lang_obj = Language.rebuild(lang_obj, hi=True)
|
|
|
|
elif hi == "also":
|
|
|
|
|
|
|
|
language_set.add(lang_obj)
|
|
|
|
initial_language_set.add(lang_obj)
|
|
|
|
language_set.add(Language.rebuild(lang_obj, hi=True))
|
|
|
|
|
|
|
|
|
|
|
|
language_set = initial_language_set.copy()
|
|
|
|
|
|
|
|
for language in language_set.copy():
|
|
|
|
|
|
|
|
lang_obj_for_hi = language
|
|
|
|
|
|
|
|
if not language.forced and not language.hi:
|
|
|
|
|
|
|
|
lang_obj_hi = Language.rebuild(lang_obj_for_hi, hi=True)
|
|
|
|
|
|
|
|
elif not language.forced and language.hi:
|
|
|
|
|
|
|
|
lang_obj_hi = Language.rebuild(lang_obj_for_hi, hi=False)
|
|
|
|
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
continue
|
|
|
|
language_set.add(lang_obj)
|
|
|
|
language_set.add(lang_obj_hi)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return language_set, initial_language_set, original_format
|
|
|
|
return language_set, original_format
|
|
|
|