diff --git a/bazarr/get_subtitle.py b/bazarr/get_subtitle.py index 73c2b46a3..6ecf41d84 100644 --- a/bazarr/get_subtitle.py +++ b/bazarr/get_subtitle.py @@ -339,12 +339,10 @@ def manual_search(path, language, hi, forced, providers, providers_auth, sceneNa score = compute_score(matches, s, video, hearing_impaired=hi) not_matched = scores - matches s.score = score - # if score < min_score: - # continue subtitles_list.append( dict(score=round((score / max_score * 100), 2), - language=alpha2_from_alpha3(s.language.alpha3), hearing_impaired=str(s.hearing_impaired), + language=str(s.language), hearing_impaired=str(s.hearing_impaired), provider=s.provider_name, subtitle=codecs.encode(pickle.dumps(s.make_picklable()), "base64").decode(), url=s.page_link, matches=list(matches), dont_matches=list(not_matched))) diff --git a/bazarr/list_subtitles.py b/bazarr/list_subtitles.py index 7bbbc7b72..ca129e2d8 100644 --- a/bazarr/list_subtitles.py +++ b/bazarr/list_subtitles.py @@ -69,16 +69,16 @@ def store_subtitles(file): if str(os.path.splitext(subtitle)[0]).lower().endswith(tuple(brazilian_portuguese)): logging.debug("BAZARR external subtitles detected: " + "pb") actual_subtitles.append( - [str("pb"), path_replace_reverse(subtitle_path), False]) + [str("pb"), path_replace_reverse(subtitle_path)]) elif str(os.path.splitext(subtitle)[0]).lower().endswith(tuple(brazilian_portuguese_forced)): logging.debug("BAZARR external subtitles detected: " + "pb:forced") actual_subtitles.append( - [str("pb"), path_replace_reverse(subtitle_path), True]) + [str("pb:forced"), path_replace_reverse(subtitle_path)]) elif str(language) != 'und': logging.debug("BAZARR external subtitles detected: " + str(language)) actual_subtitles.append( - [str(language).split(':')[0], path_replace_reverse(subtitle_path), language.forced]) + [str(language), path_replace_reverse(subtitle_path)]) else: if os.path.splitext(subtitle)[1] != ".sub": logging.debug("BAZARR falling back to file content analysis to detect language.") @@ -134,6 +134,8 @@ def store_subtitles_movie(file): try: if alpha2_from_alpha3(subtitle_track.language) is not None: lang = str(alpha2_from_alpha3(subtitle_track.language)) + if subtitle_track.forced: + lang = lang + ':forced' logging.debug("BAZARR embedded subtitles detected: " + lang) actual_subtitles.append([lang, None]) except: @@ -160,15 +162,15 @@ def store_subtitles_movie(file): if str(os.path.splitext(subtitle)[0]).lower().endswith(tuple(brazilian_portuguese)) is True: logging.debug("BAZARR external subtitles detected: " + "pb") actual_subtitles.append( - [str("pb"), path_replace_reverse_movie(os.path.join(os.path.dirname(file), subtitle)), False]) + [str("pb"), path_replace_reverse_movie(os.path.join(os.path.dirname(file), subtitle))]) elif str(os.path.splitext(subtitle)[0]).lower().endswith(tuple(brazilian_portuguese_forced)) is True: logging.debug("BAZARR external subtitles detected: " + "pb:forced") actual_subtitles.append( - [str("pb"), path_replace_reverse_movie(os.path.join(os.path.dirname(file), subtitle)), True]) + [str("pb:forced"), path_replace_reverse_movie(os.path.join(os.path.dirname(file), subtitle))]) elif str(language) != 'und': logging.debug("BAZARR external subtitles detected: " + str(language)) actual_subtitles.append( - [str(language).split(':')[0], path_replace_reverse_movie(os.path.join(os.path.dirname(file), subtitle)), language.forced]) + [str(language), path_replace_reverse_movie(os.path.join(os.path.dirname(file), subtitle))]) else: if os.path.splitext(subtitle)[1] != ".sub": logging.debug("BAZARR falling back to file content analysis to detect language.") diff --git a/views/movie.tpl b/views/movie.tpl index 409e70f5f..eb9d5e9d5 100644 --- a/views/movie.tpl +++ b/views/movie.tpl @@ -147,18 +147,18 @@ subtitles_files.sort() if subtitles_files is not None: for subtitles_file in subtitles_files: - if len(subtitles_file) > 2: - forced = subtitles_file[2] + if subtitles_file[0].endswith(':forced'): + forced = True else: forced = False end %> {{path_replace_movie(subtitles_file[1]) if subtitles_file[1] is not None else 'Video file subtitles track'}} -
{{!'' if forced else ''}}{{language_from_alpha2(subtitles_file[0])}}
+
{{!'' if forced else ''}}{{language_from_alpha2(subtitles_file[0].split(':')[0])}}
%if subtitles_file[1] is not None: - + %end @@ -474,6 +474,8 @@ render: function ( data, type, row ) { if ( data.language === "pt" && is_pb === true && is_pt === false) { return 'pb' + } else if ( data.language === "pt:forced" && is_pb === true && is_pt === false) { + return 'pb:forced' } else { return data.language }