First step in forced subtitles searching.

This commit is contained in:
Louis Vézina 2019-03-30 23:09:52 -04:00
parent 6045252d15
commit 73269efebc
7 changed files with 101 additions and 50 deletions

View File

@ -19,7 +19,8 @@ from subzero.language import Language
from subzero.video import parse_video
from subliminal import region, score as subliminal_scores, \
list_subtitles, Episode, Movie
from subliminal_patch.core import SZAsyncProviderPool, download_best_subtitles, save_subtitles, download_subtitles
from subliminal_patch.core import SZAsyncProviderPool, download_best_subtitles, save_subtitles, download_subtitles, \
list_all_subtitles
from subliminal_patch.score import compute_score
from subliminal.refiners.tvdb import series_re
from get_languages import language_from_alpha3, alpha2_from_alpha3, alpha3_from_alpha2, language_from_alpha2
@ -99,7 +100,7 @@ def get_scores(video, media_type, min_score_movie_perc=60 * 100 / 120.0, min_sco
return min_score, max_score, set(scores)
def download_subtitle(path, language, hi, providers, providers_auth, sceneName, title, media_type, forced_minimum_score=None, is_upgrade=False):
def download_subtitle(path, language, hi, forced, providers, providers_auth, sceneName, title, media_type, forced_minimum_score=None, is_upgrade=False):
# fixme: supply all missing languages, not only one, to hit providers only once who support multiple languages in
# one query
@ -115,9 +116,18 @@ def download_subtitle(path, language, hi, providers, providers_auth, sceneName,
for l in language:
if l == 'pob':
language_set.add(Language('por', 'BR'))
lang_obj = Language('por', 'BR')
if forced == "True":
lang_obj.forced = True
else:
lang_obj.forced = False
else:
language_set.add(Language(l))
lang_obj = Language(l)
if forced == "True":
lang_obj.forced = True
else:
lang_obj.forced = False
language_set.add(lang_obj)
use_scenename = settings.general.getboolean('use_scenename')
minimum_score = settings.general.minimum_score
@ -247,7 +257,7 @@ def download_subtitle(path, language, hi, providers, providers_auth, sceneName,
logging.debug('BAZARR Ended searching subtitles for file: ' + path)
def manual_search(path, language, hi, providers, providers_auth, sceneName, title, media_type):
def manual_search(path, language, hi, forced, providers, providers_auth, sceneName, title, media_type):
logging.debug('BAZARR Manually searching subtitles for this file: ' + path)
final_subtitles = []
@ -260,9 +270,18 @@ def manual_search(path, language, hi, providers, providers_auth, sceneName, titl
for lang in ast.literal_eval(language):
lang = alpha3_from_alpha2(lang)
if lang == 'pob':
language_set.add(Language('por', 'BR'))
lang_obj = Language('por', 'BR')
if forced == "True":
lang_obj.forced = True
else:
lang_obj.forced = False
else:
language_set.add(Language(lang))
lang_obj = Language(lang)
if forced == "True":
lang_obj.forced = True
else:
lang_obj.forced = False
language_set.add(lang_obj)
use_scenename = settings.general.getboolean('use_scenename')
minimum_score = settings.general.minimum_score
@ -277,12 +296,12 @@ def manual_search(path, language, hi, providers, providers_auth, sceneName, titl
try:
if providers:
subtitles = list_subtitles([video], language_set,
providers=providers,
provider_configs=providers_auth,
pool_class=provider_pool(),
throttle_callback=provider_throttle,
language_hook=None) # fixme
subtitles = list_all_subtitles([video], language_set,
providers=providers,
provider_configs=providers_auth,
throttle_callback=provider_throttle,
language_hook=None) # fixme
print subtitles
else:
subtitles = []
logging.info("BAZARR All providers are throttled")
@ -326,7 +345,7 @@ def manual_search(path, language, hi, providers, providers_auth, sceneName, titl
return final_subtitles
def manual_download_subtitle(path, language, hi, subtitle, provider, providers_auth, sceneName, title, media_type):
def manual_download_subtitle(path, language, hi, forced, subtitle, provider, providers_auth, sceneName, title, media_type):
logging.debug('BAZARR Manually downloading subtitles for this file: ' + path)
subtitle = pickle.loads(codecs.decode(subtitle.encode(), "base64"))
@ -340,8 +359,7 @@ def manual_download_subtitle(path, language, hi, subtitle, provider, providers_a
try:
if provider:
download_subtitles([subtitle], providers={provider}, provider_configs=providers_auth,
pool_class=provider_pool(),
throttle_callback=provider_throttle)
pool_class=provider_pool(), throttle_callback=provider_throttle)
logging.debug('BAZARR Subtitles file downloaded for this file:' + path)
else:
logging.info("BAZARR All providers are throttled")
@ -441,7 +459,7 @@ def series_download_subtitles(no):
episodes_details = c_db.execute(
'SELECT path, missing_subtitles, sonarrEpisodeId, scene_name FROM table_episodes WHERE sonarrSeriesId = ? AND missing_subtitles != "[]"' + monitored_only_query_string,
(no,)).fetchall()
series_details = c_db.execute("SELECT hearing_impaired, title FROM table_shows WHERE sonarrSeriesId = ?",
series_details = c_db.execute("SELECT hearing_impaired, title, forced FROM table_shows WHERE sonarrSeriesId = ?",
(no,)).fetchone()
c_db.close()
@ -453,8 +471,8 @@ def series_download_subtitles(no):
if language is not None:
notifications.write(msg='Searching for ' + str(language_from_alpha2(language)) + ' subtitles for this episode: ' + path_replace(episode[0]), queue='get_subtitle')
result = download_subtitle(path_replace(episode[0]), str(alpha3_from_alpha2(language)),
series_details[0], providers_list, providers_auth, str(episode[3]),
series_details[1], 'series')
series_details[0], series_details[2], providers_list,
providers_auth, str(episode[3]), series_details[1], 'series')
if result is not None:
message = result[0]
path = result[1]
@ -473,7 +491,7 @@ def movies_download_subtitles(no):
conn_db = sqlite3.connect(os.path.join(args.config_dir, 'db', 'bazarr.db'), timeout=30)
c_db = conn_db.cursor()
movie = c_db.execute(
"SELECT path, missing_subtitles, radarrId, sceneName, hearing_impaired, title FROM table_movies WHERE radarrId = ?",
"SELECT path, missing_subtitles, radarrId, sceneName, hearing_impaired, title, forced FROM table_movies WHERE radarrId = ?",
(no,)).fetchone()
c_db.close()
@ -484,7 +502,7 @@ def movies_download_subtitles(no):
if language is not None:
notifications.write(msg='Searching for ' + str(language_from_alpha2(language)) + ' subtitles for this movie: ' + path_replace_movie(movie[0]), queue='get_subtitle')
result = download_subtitle(path_replace_movie(movie[0]), str(alpha3_from_alpha2(language)), movie[4],
providers_list, providers_auth, str(movie[3]), movie[5], 'movie')
movie[6], providers_list, providers_auth, str(movie[3]), movie[5], 'movie')
if result is not None:
message = result[0]
path = result[1]
@ -503,7 +521,7 @@ def wanted_download_subtitles(path):
conn_db = sqlite3.connect(os.path.join(args.config_dir, 'db', 'bazarr.db'), timeout=30)
c_db = conn_db.cursor()
episodes_details = c_db.execute(
"SELECT table_episodes.path, table_episodes.missing_subtitles, table_episodes.sonarrEpisodeId, table_episodes.sonarrSeriesId, table_shows.hearing_impaired, table_episodes.scene_name, table_episodes.failedAttempts, table_shows.title FROM table_episodes INNER JOIN table_shows on table_shows.sonarrSeriesId = table_episodes.sonarrSeriesId WHERE table_episodes.path = ? AND missing_subtitles != '[]'",
"SELECT table_episodes.path, table_episodes.missing_subtitles, table_episodes.sonarrEpisodeId, table_episodes.sonarrSeriesId, table_shows.hearing_impaired, table_episodes.scene_name, table_episodes.failedAttempts, table_shows.title, table_shows.forced FROM table_episodes INNER JOIN table_shows on table_shows.sonarrSeriesId = table_episodes.sonarrSeriesId WHERE table_episodes.path = ? AND missing_subtitles != '[]'",
(path_replace_reverse(path),)).fetchall()
c_db.close()
@ -536,8 +554,8 @@ def wanted_download_subtitles(path):
notifications.write(
msg='Searching ' + str(language_from_alpha2(language)) + ' subtitles for this episode: ' + path, queue='get_subtitle')
result = download_subtitle(path_replace(episode[0]), str(alpha3_from_alpha2(language)),
episode[4], providers_list, providers_auth, str(episode[5]),
episode[7], 'series')
episode[4], episode[8], providers_list, providers_auth,
str(episode[5]), episode[7], 'series')
if result is not None:
message = result[0]
path = result[1]
@ -557,7 +575,7 @@ def wanted_download_subtitles_movie(path):
conn_db = sqlite3.connect(os.path.join(args.config_dir, 'db', 'bazarr.db'), timeout=30)
c_db = conn_db.cursor()
movies_details = c_db.execute(
"SELECT path, missing_subtitles, radarrId, radarrId, hearing_impaired, sceneName, failedAttempts, title FROM table_movies WHERE path = ? AND missing_subtitles != '[]'",
"SELECT path, missing_subtitles, radarrId, radarrId, hearing_impaired, sceneName, failedAttempts, title, forced FROM table_movies WHERE path = ? AND missing_subtitles != '[]'",
(path_replace_reverse_movie(path),)).fetchall()
c_db.close()
@ -589,8 +607,8 @@ def wanted_download_subtitles_movie(path):
notifications.write(
msg='Searching ' + str(language_from_alpha2(language)) + ' subtitles for this movie: ' + path, queue='get_subtitle')
result = download_subtitle(path_replace_movie(movie[0]), str(alpha3_from_alpha2(language)),
movie[4], providers_list, providers_auth, str(movie[5]), movie[7],
'movie')
movie[4], movie[8], providers_list, providers_auth, str(movie[5]),
movie[7], 'movie')
if result is not None:
message = result[0]
path = result[1]
@ -733,7 +751,7 @@ def upgrade_subtitles():
episodes_list = c.execute("""SELECT table_history.video_path, table_history.language, table_history.score,
table_shows.hearing_impaired, table_episodes.scene_name, table_episodes.title,
table_episodes.sonarrSeriesId, table_episodes.sonarrEpisodeId,
MAX(table_history.timestamp), table_shows.languages
MAX(table_history.timestamp), table_shows.languages, table_shows.forced
FROM table_history
INNER JOIN table_shows on table_shows.sonarrSeriesId = table_history.sonarrSeriesId
INNER JOIN table_episodes on table_episodes.sonarrEpisodeId = table_history.sonarrEpisodeId
@ -744,7 +762,7 @@ def upgrade_subtitles():
movies_list = c.execute("""SELECT table_history_movie.video_path, table_history_movie.language,
table_history_movie.score, table_movies.hearing_impaired, table_movies.sceneName,
table_movies.title, table_movies.radarrId, MAX(table_history_movie.timestamp),
table_movies.languages
table_movies.languages, table_movies.forced
FROM table_history_movie
INNER JOIN table_movies on table_movies.radarrId = table_history_movie.radarrId
WHERE action IN (""" + ','.join(map(str, query_actions)) + """) AND timestamp > ? AND
@ -772,7 +790,7 @@ def upgrade_subtitles():
msg='Searching to upgrade ' + str(language_from_alpha2(episode[1])) + ' subtitles for this episode: ' +
path_replace(episode[0]), queue='get_subtitle')
result = download_subtitle(path_replace(episode[0]), str(alpha3_from_alpha2(episode[1])),
episode[3], providers_list, providers_auth, str(episode[4]),
episode[3], episode[10], providers_list, providers_auth, str(episode[4]),
episode[5], 'series', forced_minimum_score=int(episode[2]), is_upgrade=True)
if result is not None:
message = result[0]
@ -790,7 +808,7 @@ def upgrade_subtitles():
msg='Searching to upgrade ' + str(language_from_alpha2(movie[1])) + ' subtitles for this movie: ' +
path_replace_movie(movie[0]), queue='get_subtitle')
result = download_subtitle(path_replace_movie(movie[0]), str(alpha3_from_alpha2(movie[1])),
movie[3], providers_list, providers_auth, str(movie[4]),
movie[3], movie[9], providers_list, providers_auth, str(movie[4]),
movie[5], 'movie', forced_minimum_score=int(movie[2]), is_upgrade=True)
if result is not None:
message = result[0]

View File

@ -548,7 +548,7 @@ def series():
monitored_only_query_string = ""
c.execute(
"SELECT tvdbId, title, path_substitution(path), languages, hearing_impaired, sonarrSeriesId, poster, audio_language FROM table_shows ORDER BY sortTitle ASC LIMIT ? OFFSET ?",
"SELECT tvdbId, title, path_substitution(path), languages, hearing_impaired, sonarrSeriesId, poster, audio_language, forced FROM table_shows ORDER BY sortTitle ASC LIMIT ? OFFSET ?",
(page_size, offset,))
data = c.fetchall()
c.execute("SELECT code2, name FROM table_settings_languages WHERE enabled = 1")
@ -705,7 +705,7 @@ def episodes(no):
series_details = []
series_details = c.execute(
"SELECT title, overview, poster, fanart, hearing_impaired, tvdbid, audio_language, languages, path_substitution(path) FROM table_shows WHERE sonarrSeriesId LIKE ?",
"SELECT title, overview, poster, fanart, hearing_impaired, tvdbid, audio_language, languages, path_substitution(path), forced FROM table_shows WHERE sonarrSeriesId LIKE ?",
(str(no),)).fetchone()
tvdbid = series_details[5]
@ -746,7 +746,7 @@ def movies():
max_page = int(math.ceil(missing_count / (page_size + 0.0)))
c.execute(
"SELECT tmdbId, title, path_substitution(path), languages, hearing_impaired, radarrId, poster, audio_language, monitored, sceneName FROM table_movies ORDER BY sortTitle ASC LIMIT ? OFFSET ?",
"SELECT tmdbId, title, path_substitution(path), languages, hearing_impaired, radarrId, poster, audio_language, monitored, sceneName, forced FROM table_movies ORDER BY sortTitle ASC LIMIT ? OFFSET ?",
(page_size, offset,))
data = c.fetchall()
c.execute("SELECT code2, name FROM table_settings_languages WHERE enabled = 1")
@ -869,7 +869,7 @@ def movie(no):
movies_details = []
movies_details = c.execute(
"SELECT title, overview, poster, fanart, hearing_impaired, tmdbid, audio_language, languages, path_substitution(path), subtitles, radarrId, missing_subtitles, sceneName, monitored, failedAttempts FROM table_movies WHERE radarrId LIKE ?",
"SELECT title, overview, poster, fanart, hearing_impaired, tmdbid, audio_language, languages, path_substitution(path), subtitles, radarrId, missing_subtitles, sceneName, monitored, failedAttempts, forced FROM table_movies WHERE radarrId LIKE ?",
(str(no),)).fetchone()
tmdbid = movies_details[5]
@ -1751,6 +1751,7 @@ def get_subtitle():
sceneName = request.forms.get('sceneName')
language = request.forms.get('language')
hi = request.forms.get('hi')
forced = request.forms.get('forced')
sonarrSeriesId = request.forms.get('sonarrSeriesId')
sonarrEpisodeId = request.forms.get('sonarrEpisodeId')
title = request.forms.get('title')
@ -1760,7 +1761,7 @@ def get_subtitle():
providers_auth = get_providers_auth()
try:
result = download_subtitle(episodePath, language, hi, providers_list, providers_auth, sceneName, title,
result = download_subtitle(episodePath, language, hi, forced, providers_list, providers_auth, sceneName, title,
'series')
if result is not None:
message = result[0]
@ -1787,12 +1788,13 @@ def manual_search_json():
sceneName = request.forms.get('sceneName')
language = request.forms.get('language')
hi = request.forms.get('hi')
forced = request.forms.get('forced')
title = request.forms.get('title')
providers_list = get_providers()
providers_auth = get_providers_auth()
data = manual_search(episodePath, language, hi, providers_list, providers_auth, sceneName, title, 'series')
data = manual_search(episodePath, language, hi, forced, providers_list, providers_auth, sceneName, title, 'series')
return dict(data=data)
@ -1806,6 +1808,7 @@ def manual_get_subtitle():
sceneName = request.forms.get('sceneName')
language = request.forms.get('language')
hi = request.forms.get('hi')
forced = request.forms.get('forced')
selected_provider = request.forms.get('provider')
subtitle = request.forms.get('subtitle')
sonarrSeriesId = request.forms.get('sonarrSeriesId')
@ -1816,7 +1819,7 @@ def manual_get_subtitle():
providers_auth = get_providers_auth()
try:
result = manual_download_subtitle(episodePath, language, hi, subtitle, selected_provider, providers_auth,
result = manual_download_subtitle(episodePath, language, hi, forced, subtitle, selected_provider, providers_auth,
sceneName, title, 'series')
if result is not None:
message = result[0]
@ -1843,6 +1846,7 @@ def get_subtitle_movie():
sceneName = request.forms.get('sceneName')
language = request.forms.get('language')
hi = request.forms.get('hi')
forced = request.forms.get('forced')
radarrId = request.forms.get('radarrId')
# tmdbid = request.forms.get('tmdbid')
title = request.forms.get('title')
@ -1851,7 +1855,7 @@ def get_subtitle_movie():
providers_auth = get_providers_auth()
try:
result = download_subtitle(moviePath, language, hi, providers_list, providers_auth, sceneName, title, 'movie')
result = download_subtitle(moviePath, language, hi, forced, providers_list, providers_auth, sceneName, title, 'movie')
if result is not None:
message = result[0]
path = result[1]
@ -1877,12 +1881,13 @@ def manual_search_movie_json():
sceneName = request.forms.get('sceneName')
language = request.forms.get('language')
hi = request.forms.get('hi')
forced = request.forms.get('forced')
title = request.forms.get('title')
providers_list = get_providers()
providers_auth = get_providers_auth()
data = manual_search(moviePath, language, hi, providers_list, providers_auth, sceneName, title, 'movie')
data = manual_search(moviePath, language, hi, forced, providers_list, providers_auth, sceneName, title, 'movie')
return dict(data=data)
@ -1896,6 +1901,7 @@ def manual_get_subtitle_movie():
sceneName = request.forms.get('sceneName')
language = request.forms.get('language')
hi = request.forms.get('hi')
forced = request.forms.get('forced')
selected_provider = request.forms.get('provider')
subtitle = request.forms.get('subtitle')
radarrId = request.forms.get('radarrId')
@ -1905,7 +1911,7 @@ def manual_get_subtitle_movie():
providers_auth = get_providers_auth()
try:
result = manual_download_subtitle(moviePath, language, hi, subtitle, selected_provider, providers_auth,
result = manual_download_subtitle(moviePath, language, hi, forced, subtitle, selected_provider, providers_auth,
sceneName, title, 'movie')
if result is not None:
message = result[0]

View File

@ -136,5 +136,22 @@ if os.path.exists(os.path.join(args.config_dir, 'db', 'bazarr.db')):
db.commit()
except:
pass
try:
c.execute('alter table table_shows add column "forced" "text"')
except:
pass
else:
c.execute('UPDATE table_shows SET forced="False"')
db.commit()
try:
c.execute('alter table table_movies add column "forced" "text"')
db.commit()
except:
pass
else:
c.execute('UPDATE table_movies SET forced="False"')
db.commit()
db.close()

View File

@ -232,12 +232,12 @@
if language in lang:
if search_active(lang[1]):
%>
<a data-episodePath="{{episode[1]}}" data-scenename="{{episode[8]}}" data-language="{{alpha3_from_alpha2(str(language))}}" data-hi="{{details[4]}}" data-sonarrSeriesId="{{episode[5]}}" data-sonarrEpisodeId="{{episode[7]}}" class="get_subtitle ui tiny label">
<a data-episodePath="{{episode[1]}}" data-scenename="{{episode[8]}}" data-language="{{alpha3_from_alpha2(str(language))}}" data-hi="{{details[4]}}" data-forced="{{details[9]}}" data-sonarrSeriesId="{{episode[5]}}" data-sonarrEpisodeId="{{episode[7]}}" class="get_subtitle ui tiny label">
{{language}}
<i style="margin-left:3px; margin-right:0" class="search icon"></i>
</a>
%else:
<a data-tooltip="Automatic searching delayed (adaptive search)" data-position="top right" data-inverted="" data-episodePath="{{episode[1]}}" data-scenename="{{episode[8]}}" data-language="{{alpha3_from_alpha2(str(language))}}" data-hi="{{details[4]}}" data-sonarrSeriesId="{{episode[5]}}" data-sonarrEpisodeId="{{episode[7]}}" class="get_subtitle ui tiny label">
<a data-tooltip="Automatic searching delayed (adaptive search)" data-position="top right" data-inverted="" data-episodePath="{{episode[1]}}" data-scenename="{{episode[8]}}" data-language="{{alpha3_from_alpha2(str(language))}}" data-hi="{{details[4]}}" data-forced="{{details[9]}}" data-sonarrSeriesId="{{episode[5]}}" data-sonarrEpisodeId="{{episode[7]}}" class="get_subtitle ui tiny label">
{{language}}
<i style="margin-left:3px; margin-right:0" class="search red icon"></i>
</a>
@ -245,7 +245,7 @@
%end
%end
%else:
<a data-episodePath="{{episode[1]}}" data-scenename="{{episode[8]}}" data-language="{{alpha3_from_alpha2(str(language))}}" data-hi="{{details[4]}}" data-sonarrSeriesId="{{episode[5]}}" data-sonarrEpisodeId="{{episode[7]}}" class="get_subtitle ui tiny label">
<a data-episodePath="{{episode[1]}}" data-scenename="{{episode[8]}}" data-language="{{alpha3_from_alpha2(str(language))}}" data-hi="{{details[4]}}" data-forced="{{details[9]}}" data-sonarrSeriesId="{{episode[5]}}" data-sonarrEpisodeId="{{episode[7]}}" class="get_subtitle ui tiny label">
{{language}}
<i style="margin-left:3px; margin-right:0" class="search icon"></i>
</a>
@ -258,7 +258,7 @@
</td>
<td>
%if subs_languages is not None:
<a data-episodePath="{{episode[1]}}" data-scenename="{{episode[8]}}" data-language="{{subs_languages_list}}" data-hi="{{details[4]}}" data-series_title="{{details[0]}}" data-season="{{episode[2]}}" data-episode="{{episode[3]}}" data-episode_title="{{episode[0]}}" data-sonarrSeriesId="{{episode[5]}}" data-sonarrEpisodeId="{{episode[7]}}" class="manual_search ui tiny label"><i class="ui user icon" style="margin-right:0px" ></i></a>
<a data-episodePath="{{episode[1]}}" data-scenename="{{episode[8]}}" data-language="{{subs_languages_list}}" data-hi="{{details[4]}}" data-forced="{{details[9]}}" data-series_title="{{details[0]}}" data-season="{{episode[2]}}" data-episode="{{episode[3]}}" data-episode_title="{{episode[0]}}" data-sonarrSeriesId="{{episode[5]}}" data-sonarrEpisodeId="{{episode[7]}}" class="manual_search ui tiny label"><i class="ui user icon" style="margin-right:0px" ></i></a>
%end
</td>
</tr>
@ -405,6 +405,7 @@
sceneName: $(this).attr("data-sceneName"),
language: $(this).attr("data-language"),
hi: $(this).attr("data-hi"),
forced: $(this).attr("data-forced"),
sonarrSeriesId: $(this).attr('data-sonarrSeriesId'),
sonarrEpisodeId: $(this).attr('data-sonarrEpisodeId'),
title: "{{!details[0].replace("'", "\\'")}}"
@ -470,6 +471,7 @@
sceneName = $(this).attr("data-sceneName");
language = $(this).attr("data-language");
hi = $(this).attr("data-hi");
forced = $(this).attr("data-forced");
sonarrSeriesId = $(this).attr("data-sonarrSeriesId");
sonarrEpisodeId = $(this).attr("data-sonarrEpisodeId");
var languages = Array.from({{!subs_languages_list}});
@ -481,6 +483,7 @@
sceneName: sceneName,
language: language,
hi: hi,
forced: forced,
sonarrSeriesId: sonarrSeriesId,
sonarrEpisodeId: sonarrEpisodeId,
title: "{{!details[0].replace("'", "\'")}}"

View File

@ -105,7 +105,7 @@
end
%>
%if subs_languages is not None:
<button class="manual_search ui button" data-tooltip="Manually search for subtitles" data-inverted="" data-moviePath="{{details[8]}}" data-scenename="{{details[12]}}" data-language="{{subs_languages_list}}" data-hi="{{details[4]}}" data-movie_title="{{details[0]}}" data-radarrId="{{details[10]}}"><i class="ui inverted large compact user icon"></i></button>
<button class="manual_search ui button" data-tooltip="Manually search for subtitles" data-inverted="" data-moviePath="{{details[8]}}" data-scenename="{{details[12]}}" data-language="{{subs_languages_list}}" data-hi="{{details[4]}}" data-forced="{{details[15]}}" data-movie_title="{{details[0]}}" data-radarrId="{{details[10]}}"><i class="ui inverted large compact user icon"></i></button>
%end
<button id="config" class="ui button" data-tooltip="Edit movie" data-inverted="" data-tmdbid="{{details[5]}}" data-title="{{details[0]}}" data-poster="{{details[2]}}" data-audio="{{details[6]}}" data-languages="{{!subs_languages_list}}" data-hearing-impaired="{{details[4]}}"><i class="ui inverted large compact configure icon"></i></button>
</div>
@ -198,12 +198,12 @@
if missing_subs_language in lang:
if search_active(lang[1]):
%>
<a class="get_subtitle ui small blue label" data-moviePath="{{details[8]}}" data-scenename="{{details[12]}}" data-language="{{alpha3_from_alpha2(str(missing_subs_language))}}" data-hi="{{details[4]}}" data-radarrId={{details[10]}}>
<a class="get_subtitle ui small blue label" data-moviePath="{{details[8]}}" data-scenename="{{details[12]}}" data-language="{{alpha3_from_alpha2(str(missing_subs_language))}}" data-hi="{{details[4]}}" data-forced="{{details[15]}}" data-radarrId={{details[10]}}>
{{language_from_alpha2(str(missing_subs_language))}}
<i style="margin-left:3px; margin-right:0" class="search icon"></i>
</a>
%else:
<a data-tooltip="Automatic searching delayed (adaptive search)" data-position="top left" data-inverted="" class="get_subtitle ui small red label" data-moviePath="{{details[8]}}" data-scenename="{{details[12]}}" data-language="{{alpha3_from_alpha2(str(missing_subs_language))}}" data-hi="{{details[4]}}" data-radarrId={{details[10]}}>
<a data-tooltip="Automatic searching delayed (adaptive search)" data-position="top left" data-inverted="" class="get_subtitle ui small red label" data-moviePath="{{details[8]}}" data-scenename="{{details[12]}}" data-language="{{alpha3_from_alpha2(str(missing_subs_language))}}" data-hi="{{details[4]}}" data-forced="{{details[15]}}" data-radarrId={{details[10]}}>
{{language_from_alpha2(str(missing_subs_language))}}
<i style="margin-left:3px; margin-right:0" class="search icon"></i>
</a>
@ -213,7 +213,7 @@
end
else:
%>
<a class="get_subtitle ui small blue label" data-moviePath="{{details[8]}}" data-scenename="{{details[12]}}" data-language="{{alpha3_from_alpha2(str(missing_subs_language))}}" data-hi="{{details[4]}}" data-radarrId={{details[10]}}>
<a class="get_subtitle ui small blue label" data-moviePath="{{details[8]}}" data-scenename="{{details[12]}}" data-language="{{alpha3_from_alpha2(str(missing_subs_language))}}" data-hi="{{details[4]}}" data-forced="{{details[15]}}" data-radarrId={{details[10]}}>
{{language_from_alpha2(str(missing_subs_language))}}
<i style="margin-left:3px; margin-right:0" class="search icon"></i>
</a>
@ -358,6 +358,7 @@
sceneName: $(this).attr("data-sceneName"),
language: $(this).attr("data-language"),
hi: $(this).attr("data-hi"),
forced: $(this).attr("data-forced"),
radarrId: $(this).attr("data-radarrId"),
tmdbid: {{tmdbid}},
title: "{{!details[0].replace("'", "\\'")}}"
@ -420,6 +421,7 @@
sceneName = $(this).attr("data-sceneName");
language = $(this).attr("data-language");
hi = $(this).attr("data-hi");
forced = $(this).attr("data-forced");
radarrId = $(this).attr("data-radarrId");
var languages = Array.from({{!subs_languages_list}});
var is_pb = languages.includes('pb');
@ -430,6 +432,7 @@
sceneName: sceneName,
language: language,
hi: hi,
forced: forced,
radarrId: radarrId,
title: "{{!details[0].replace("'", "\'")}}"
};

View File

@ -62,6 +62,7 @@
<th>Audio<br>language</th>
<th>Subtitles<br>languages</th>
<th>Hearing-<br>impaired</th>
<th>Forced</th>
<th class="no-sort"></th>
</tr>
</thead>
@ -101,6 +102,7 @@
%end
</td>
<td>{{!"" if row[4] is None else row[4]}}</td>
<td>{{row[10]}}</td>
<td {{!"style='background-color: #e8e8e8;'" if row[4] is None else ""}}>
<%
subs_languages_list = []

View File

@ -67,6 +67,7 @@
<th>Audio language</th>
<th>Subtitles languages</th>
<th>Hearing-impaired</th>
<th>Forced</th>
<th class="two wide">Subtitles</th>
<th></th>
</tr>
@ -95,6 +96,7 @@
%end
</td>
<td>{{!"" if row[4] is None else row[4]}}</td>
<td>{{row[8]}}</td>
<td>
%total_subs = 0
%missing_subs = 0