From dd4707176aec68b1378a254e14a3c8ed89a3b4ad Mon Sep 17 00:00:00 2001 From: josdion Date: Sun, 22 Mar 2020 11:54:54 +0200 Subject: [PATCH] add subtitle uploader as a column in manual search dialog --- bazarr/get_subtitle.py | 7 ++++++- views/episodes.tpl | 22 ++++++++++++++++------ views/movie.tpl | 26 ++++++++++++++++++-------- 3 files changed, 40 insertions(+), 15 deletions(-) diff --git a/bazarr/get_subtitle.py b/bazarr/get_subtitle.py index 7d0081716..8d917fa57 100644 --- a/bazarr/get_subtitle.py +++ b/bazarr/get_subtitle.py @@ -356,6 +356,11 @@ def manual_search(path, language, hi, forced, providers, providers_auth, sceneNa if len(releases) == 0: releases = ['n/a'] + if s.uploader and s.uploader.strip(): + s_uploader = s.uploader.strip() + else: + s_uploader = 'n/a' + subtitles_list.append( dict(score=round((score / max_score * 100), 2), orig_score=score, @@ -364,7 +369,7 @@ def manual_search(path, language, hi, forced, providers, providers_auth, sceneNa 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), - release_info=releases)) + release_info=releases, uploader=s_uploader)) final_subtitles = sorted(subtitles_list, key=lambda x: (x['orig_score'], x['score_without_hash']), reverse=True) diff --git a/views/episodes.tpl b/views/episodes.tpl index 82bb6f739..1fb735894 100644 --- a/views/episodes.tpl +++ b/views/episodes.tpl @@ -416,11 +416,11 @@ Score: - Lang.: - HI: + Provider: Matching: Releases: + Uploader: @@ -694,14 +694,19 @@ }, { data: null, render: function ( data, type, row ) { + let lng = data.language; if ( data.language === "pt" && is_pb === true && is_pt === false) { - return 'pb' - } else { - return data.language + lng = 'pb' } + + let text = '
' + lng.toUpperCase() + '
'; + if (data.hearing_impaired == "True") { + text += '
HI
'; + } + + return text; } }, - { data: 'hearing_impaired' }, { data: null, render: function ( data, type, row ) { return ''+data.provider+''; @@ -740,6 +745,11 @@ } text += ''; return text; + } + }, + { data: 'uploader', + render: function ( data, type, row ) { + return '
' + data + '
'; } }, { data: null, diff --git a/views/movie.tpl b/views/movie.tpl index c53849d77..0ce04eb6a 100644 --- a/views/movie.tpl +++ b/views/movie.tpl @@ -372,12 +372,12 @@ Score: - Lang.: - HI: + Provider: Matching: Releases: - details + Uploader: + @@ -632,16 +632,21 @@ }, { data: null, render: function ( data, type, row ) { + let lng = data.language; if ( data.language === "pt" && is_pb === true && is_pt === false) { - return 'pb' + lng = 'pb' } else if ( data.language === "pt:forced" && is_pb === true && is_pt === false) { - return 'pb:forced' - } else { - return data.language + lng = 'pb:forced' + } + + let text = '
' + lng.toUpperCase() + '
'; + if (data.hearing_impaired == "True") { + text += '
HI
'; } + + return text; } }, - { data: 'hearing_impaired' }, { data: null, render: function ( data, type, row ) { return ''+data.provider+''; @@ -680,6 +685,11 @@ } text += ''; return text; + } + }, + { data: 'uploader', + render: function ( data, type, row ) { + return '
' + data + '
'; } }, { data: null,