Continuing development.

pull/479/head
Louis Vézina 5 years ago
parent 6734656aeb
commit 679a76b476

@ -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)))

@ -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.")

@ -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
%>
<tr>
<td>{{path_replace_movie(subtitles_file[1]) if subtitles_file[1] is not None else 'Video file subtitles track'}}</td>
<td><div class="ui tiny inverted label" style='background-color: #777777;'>{{!'<span class="ui" data-tooltip="Forced" data-inverted=""><i class="exclamation icon"></i></span>' if forced else ''}}{{language_from_alpha2(subtitles_file[0])}}</div></td>
<td><div class="ui tiny inverted label" style='background-color: #777777;'>{{!'<span class="ui" data-tooltip="Forced" data-inverted=""><i class="exclamation icon"></i></span>' if forced else ''}}{{language_from_alpha2(subtitles_file[0].split(':')[0])}}</div></td>
<td>
%if subtitles_file[1] is not None:
<a class="remove_subtitles ui inverted basic compact icon" data-tooltip="Delete subtitles file from disk" data-inverted="" data-moviePath="{{details[8]}}" data-subtitlesPath="{{path_replace_movie(subtitles_file[1])}}" data-language="{{alpha3_from_alpha2(subtitles_file[0])}}" data-radarrId={{details[10]}}>
<a class="remove_subtitles ui inverted basic compact icon" data-tooltip="Delete subtitles file from disk" data-inverted="" data-position="top right" data-moviePath="{{details[8]}}" data-subtitlesPath="{{path_replace_movie(subtitles_file[1])}}" data-language="{{alpha3_from_alpha2(subtitles_file[0].split(':')[0])}}" data-radarrId={{details[10]}}>
<i class="ui black delete icon"></i>
</a>
%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
}

Loading…
Cancel
Save