From d5c141f9cf3284ede727d16de89a7634af5358de Mon Sep 17 00:00:00 2001 From: morpheus65535 <5130500+morpheus65535@users.noreply.github.com> Date: Wed, 28 Nov 2018 21:38:13 -0500 Subject: [PATCH] Fix to prevent manual search to return None instead of an empty json string. --- bazarr/get_subtitle.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bazarr/get_subtitle.py b/bazarr/get_subtitle.py index 5f14fd648..9d310810a 100644 --- a/bazarr/get_subtitle.py +++ b/bazarr/get_subtitle.py @@ -172,6 +172,9 @@ def download_subtitle(path, language, hi, providers, providers_auth, sceneName, def manual_search(path, language, hi, providers, providers_auth, sceneName, media_type): logging.debug('BAZARR Manually searching subtitles for this file: ' + path) + + subtitles_dict = {} + if hi == "True": hi = True else: @@ -239,7 +242,6 @@ def manual_search(path, language, hi, providers, providers_auth, sceneName, medi # The pickle doesn't work very well with RAR (rarfile.RarFile) or ZIP (zipfile.ZipFile) s.archive.content = None subtitles_list.append(dict(score=round((compute_score(s, video, hearing_impaired=hi) / max_score * 100), 2), language=alpha2_from_alpha3(s.language.alpha3), hearing_impaired=str(s.hearing_impaired), provider=s.provider_name, subtitle=codecs.encode(pickle.dumps(s), "base64").decode(), url=s.page_link, matches=list(matched), dont_matches=list(not_matched))) - subtitles_dict = {} subtitles_dict = sorted(subtitles_list, key=lambda x: x['score'], reverse=True) logging.debug('BAZARR ' + str(len(subtitles_dict)) + " subtitles have been found for this file: " + path) logging.debug('BAZARR Ended searching subtitles for this file: ' + path)