pull/684/head
Louis Vézina 5 years ago
parent 277198685e
commit 4a911f43e5

@ -10,25 +10,22 @@ database = Sqlite3Worker(os.path.join(args.config_dir, 'db', 'bazarr.db'), max_q
class SqliteDictConverter: class SqliteDictConverter:
def __init__(self): def __init__(self):
pass self.keys_insert = tuple()
self.keys_update = tuple()
self.values = tuple()
self.question_marks = tuple()
def convert(self, values_dict): def convert(self, values_dict):
self.keys = str()
self.values = str()
self.items = str()
if type(values_dict) is dict: if type(values_dict) is dict:
for key, value in values_dict.items(): temp_keys = list()
self.keys += key + ", " temp_values = list()
if type(value) is not string_types: for item in values_dict.items():
value = str(value) temp_keys.append(item[0])
else: temp_values.append(item[1])
value = "\"" + value + "\"" self.keys_insert = ','.join(temp_keys)
self.values += value + ", " self.keys_update = ','.join([k + '=?' for k in temp_keys])
self.items += key + "=" + value + ", " self.values = tuple(temp_values)
self.keys = self.keys.rstrip(", ") self.question_marks = ','.join(list('?'*len(values_dict)))
self.values = self.values.rstrip(", ")
self.items = self.items.rstrip(", ")
return self return self
else: else:
pass pass

@ -26,7 +26,7 @@ def sync_episodes():
# Get current episodes id in DB # Get current episodes id in DB
current_episodes_db = database.execute("SELECT sonarrEpisodeId, path, sonarrSeriesId FROM table_episodes") current_episodes_db = database.execute("SELECT sonarrEpisodeId, path, sonarrSeriesId FROM table_episodes")
current_episodes_db_list = [x.sonarr_episode_id for x in current_episodes_db] current_episodes_db_list = [x['sonarrEpisodeId'] for x in current_episodes_db]
current_episodes_sonarr = [] current_episodes_sonarr = []
episodes_to_update = [] episodes_to_update = []
@ -36,11 +36,11 @@ def sync_episodes():
# Get sonarrId for each series from database # Get sonarrId for each series from database
seriesIdList = database.execute("SELECT sonarrSeriesId, title FROM table_shows") seriesIdList = database.execute("SELECT sonarrSeriesId, title FROM table_shows")
seriesIdListLength = seriesIdList.count() seriesIdListLength = len(seriesIdList)
for i, seriesId in enumerate(seriesIdList, 1): for i, seriesId in enumerate(seriesIdList, 1):
notifications.write(msg='Getting episodes data from Sonarr...', queue='get_episodes', item=i, length=seriesIdListLength) notifications.write(msg='Getting episodes data from Sonarr...', queue='get_episodes', item=i, length=seriesIdListLength)
# Get episodes data for a series from Sonarr # Get episodes data for a series from Sonarr
url_sonarr_api_episode = url_sonarr + "/api/episode?seriesId=" + str(seriesId['sonarr_series_id']) + "&apikey=" + apikey_sonarr url_sonarr_api_episode = url_sonarr + "/api/episode?seriesId=" + str(seriesId['sonarrSeriesId']) + "&apikey=" + apikey_sonarr
try: try:
r = requests.get(url_sonarr_api_episode, timeout=60, verify=False) r = requests.get(url_sonarr_api_episode, timeout=60, verify=False)
r.raise_for_status() r.raise_for_status()
@ -136,18 +136,19 @@ def sync_episodes():
for updated_episode in episodes_to_update_list: for updated_episode in episodes_to_update_list:
query = dict_converter.convert(updated_episode) query = dict_converter.convert(updated_episode)
database.execute("UPDATE table_episodes SET ? WHERE sonarrEpisodeId=?", database.execute('''UPDATE table_shows SET ''' + query.keys_update + ''' WHERE sonarrSeriesId = ?''',
(query.items, updated_episode['sonarr_episode_id'])) query.values + (updated_episode['sonarrSeriesId'],))
altered_episodes.append([updated_episode['sonarr_episode_id'], altered_episodes.append([updated_episode['sonarrEpisodeId'],
updated_episode['path'], updated_episode['path'],
updated_episode['sonarr_series_id']]) updated_episode['sonarrSeriesId']])
# Insert new episodes in DB # Insert new episodes in DB
for added_episode in episodes_to_add: for added_episode in episodes_to_add:
query = dict_converter.convert(added_episode) query = dict_converter.convert(added_episode)
database.execute("INSERT OR IGNORE INTO table_episodes(?) VALUES(?)", database.execute(
(query.keys, query.values)) '''INSERT OR IGNORE INTO table_episodes(''' + query.keys_insert + ''') VALUES(''' + query.question_marks +
altered_episodes.append([added_episode['sonarr_episode_id'], ''')''', query.values)
altered_episodes.append([added_episode['sonarrEpisodeId'],
added_episode['path']]) added_episode['path']])
# Remove old episodes from DB # Remove old episodes from DB

@ -54,7 +54,7 @@ def update_movies():
# Get current movies in DB # Get current movies in DB
current_movies_db = database.execute("SELECT tmdbId, path, radarrId FROM table_movies") current_movies_db = database.execute("SELECT tmdbId, path, radarrId FROM table_movies")
current_movies_db_list = [x['tmdb_id'] for x in current_movies_db] current_movies_db_list = [x['tmdbId'] for x in current_movies_db]
current_movies_radarr = [] current_movies_radarr = []
movies_to_update = [] movies_to_update = []
@ -132,31 +132,31 @@ def update_movies():
current_movies_radarr.append(unicode(movie['tmdbId'])) current_movies_radarr.append(unicode(movie['tmdbId']))
if unicode(movie['tmdbId']) in current_movies_db_list: if unicode(movie['tmdbId']) in current_movies_db_list:
movies_to_update.append({'radarr_id': movie["id"], movies_to_update.append({'radarrId': movie["id"],
'title': unicode(movie["title"]), 'title': unicode(movie["title"]),
'path': unicode(movie["path"] + separator + movie['movieFile']['relativePath']), 'path': unicode(movie["path"] + separator + movie['movieFile']['relativePath']),
'tmdb_id': unicode(movie["tmdbId"]), 'tmdbId': unicode(movie["tmdbId"]),
'poster': unicode(poster), 'poster': unicode(poster),
'fanart': unicode(fanart), 'fanart': unicode(fanart),
'audio_language': unicode(profile_id_to_language(movie['qualityProfileId'], audio_profiles)), 'audio_language': unicode(profile_id_to_language(movie['qualityProfileId'], audio_profiles)),
'scene_name': sceneName, 'sceneName': sceneName,
'monitored': unicode(bool(movie['monitored'])), 'monitored': unicode(bool(movie['monitored'])),
'year': unicode(movie['year']), 'year': unicode(movie['year']),
'sort_title': unicode(movie['sortTitle']), 'sortTitle': unicode(movie['sortTitle']),
'alternative_titles': unicode(alternativeTitles), 'alternativeTitles': unicode(alternativeTitles),
'format': unicode(format), 'format': unicode(format),
'resolution': unicode(resolution), 'resolution': unicode(resolution),
'video_codec': unicode(videoCodec), 'video_codec': unicode(videoCodec),
'audio_codec': unicode(audioCodec), 'audio_codec': unicode(audioCodec),
'overview': unicode(overview), 'overview': unicode(overview),
'imdb_id': unicode(imdbId), 'imdbId': unicode(imdbId),
'movie_file_id': movie['movieFile']['id']}) 'movie_file_id': movie['movieFile']['id']})
else: else:
if movie_default_enabled is True: if movie_default_enabled is True:
movies_to_add.append({'radarr_id': movie["id"], movies_to_add.append({'radarrId': movie["id"],
'title': movie["title"], 'title': movie["title"],
'path': movie["path"] + separator + movie['movieFile']['relativePath'], 'path': movie["path"] + separator + movie['movieFile']['relativePath'],
'tmdb_id': movie["tmdbId"], 'tmdbId': movie["tmdbId"],
'languages': movie_default_language, 'languages': movie_default_language,
'subtitles': '[]', 'subtitles': '[]',
'hearing_impaired': movie_default_hi, 'hearing_impaired': movie_default_hi,
@ -164,37 +164,41 @@ def update_movies():
'poster': poster, 'poster': poster,
'fanart': fanart, 'fanart': fanart,
'audio_language': profile_id_to_language(movie['qualityProfileId'], audio_profiles), 'audio_language': profile_id_to_language(movie['qualityProfileId'], audio_profiles),
'scene_name': sceneName, 'sceneName': sceneName,
'monitored': unicode(bool(movie['monitored'])), 'monitored': unicode(bool(movie['monitored'])),
'sort_title': movie['sortTitle'], 'sortTitle': movie['sortTitle'],
'year': movie['year'], 'year': movie['year'],
'alternative_titles': alternativeTitles, 'alternativeTitles': alternativeTitles,
'format': format, 'format': format,
'resolution': resolution, 'resolution': resolution,
'video_codec': videoCodec, 'video_codec': videoCodec,
'audio_codec': audioCodec, 'audio_codec': audioCodec,
'imdb_id': imdbId, 'imdbId': imdbId,
'forced': movie_default_forced, 'forced': movie_default_forced,
'movie_file_id': movie['movieFile']['id']}) 'movie_file_id': movie['movieFile']['id']})
else: else:
movies_to_add.append({'radarr_id': movie["id"], movies_to_add.append({'radarrId': movie["id"],
'title': movie["title"], 'title': movie["title"],
'path': movie["path"] + separator + movie['movieFile']['relativePath'], 'path': movie["path"] + separator + movie['movieFile']['relativePath'],
'tmdb_id': movie["tmdbId"], 'tmdbId': movie["tmdbId"],
'languages': None,
'subtitles': '[]',
'hearing_impaired': None,
'overview': overview, 'overview': overview,
'poster': poster, 'poster': poster,
'fanart': fanart, 'fanart': fanart,
'audio_language': profile_id_to_language(movie['qualityProfileId'], audio_profiles), 'audio_language': profile_id_to_language(movie['qualityProfileId'], audio_profiles),
'scene_name': sceneName, 'sceneName': sceneName,
'monitored': unicode(bool(movie['monitored'])), 'monitored': unicode(bool(movie['monitored'])),
'sort_title': movie['sortTitle'], 'sortTitle': movie['sortTitle'],
'year': movie['year'], 'year': movie['year'],
'alternative_titles': alternativeTitles, 'alternativeTitles': alternativeTitles,
'format': format, 'format': format,
'resolution': resolution, 'resolution': resolution,
'video_codec': videoCodec, 'video_codec': videoCodec,
'audio_codec': audioCodec, 'audio_codec': audioCodec,
'imdb_id': imdbId, 'imdbId': imdbId,
'forced': None,
'movie_file_id': movie['movieFile']['id']}) 'movie_file_id': movie['movieFile']['id']})
else: else:
logging.error( logging.error(
@ -215,21 +219,22 @@ def update_movies():
for updated_movie in movies_to_update_list: for updated_movie in movies_to_update_list:
query = dict_converter.convert(updated_movie) query = dict_converter.convert(updated_movie)
database.execute("UPDATE table_movies SET ? WHERE radarrId=?", database.execute('''UPDATE table_movies SET ''' + query.keys_update + ''' WHERE radarrId = ?''',
(query.items, updated_movie['radarr_id'])) query.values + (updated_movie['radarrId'],))
altered_movies.append([updated_movie['tmdb_id'], altered_movies.append([updated_movie['tmdbId'],
updated_movie['path'], updated_movie['path'],
updated_movie['radarr_id'], updated_movie['radarrId'],
updated_movie['monitored']]) updated_movie['monitored']])
# Insert new movies in DB # Insert new movies in DB
for added_movie in movies_to_add: for added_movie in movies_to_add:
query = dict_converter.convert(updated_movie) query = dict_converter.convert(added_movie)
database.execute("INSERT OR IGNORE INTO table_movies(?) VALUES(?)", database.execute(
(query.keys, query.values)) '''INSERT OR IGNORE INTO table_movies(''' + query.keys_insert + ''') VALUES(''' +
altered_movies.append([added_movie['tmdb_id'], query.question_marks + ''')''', query.values)
altered_movies.append([added_movie['tmdbId'],
added_movie['path'], added_movie['path'],
added_movie['radarr_id'], added_movie['radarrId'],
added_movie['monitored']]) added_movie['monitored']])
# Remove old movies from DB # Remove old movies from DB

@ -133,13 +133,15 @@ def update_series():
for updated_series in series_to_update_list: for updated_series in series_to_update_list:
query = dict_converter.convert(updated_series) query = dict_converter.convert(updated_series)
database.execute("""UPDATE table_shows SET {0} WHERE sonarrSeriesId=?""".format(query.items), database.execute('''UPDATE table_shows SET ''' + query.keys_update + ''' WHERE sonarrSeriesId = ?''',
(updated_series['sonarrSeriesId'],)) query.values + (updated_series['sonarrSeriesId'],))
# Insert new series in DB # Insert new series in DB
for added_series in series_to_add: for added_series in series_to_add:
query = dict_converter.convert(added_series) query = dict_converter.convert(added_series)
database.execute("""INSERT OR IGNORE INTO table_shows({0}) VALUES({1})""".format(query.keys, query.values)) database.execute(
'''INSERT OR IGNORE INTO table_shows(''' + query.keys_insert + ''') VALUES(''' +
query.question_marks + ''')''', query.values)
list_missing_subtitles(no=added_series['sonarrSeriesId']) list_missing_subtitles(no=added_series['sonarrSeriesId'])
# Remove old series from DB # Remove old series from DB

@ -574,7 +574,7 @@ def series_download_subtitles(no):
notifications.write(msg='Searching for Series Subtitles...', queue='get_subtitle', item=i, notifications.write(msg='Searching for Series Subtitles...', queue='get_subtitle', item=i,
length=count_episodes_details) length=count_episodes_details)
result = download_subtitle(path_replace(episode['path']), result = download_subtitle(path_replace(episode['path']),
str(alpha3_from_alpha2(language.split(':'))), str(alpha3_from_alpha2(language.split(':')[0])),
series_details['hearing_impaired'], series_details['hearing_impaired'],
"True" if len(language.split(':')) > 1 else "False", "True" if len(language.split(':')) > 1 else "False",
providers_list, providers_list,
@ -589,7 +589,7 @@ def series_download_subtitles(no):
language_code = result[2] + ":forced" if forced else result[2] language_code = result[2] + ":forced" if forced else result[2]
provider = result[3] provider = result[3]
score = result[4] score = result[4]
store_subtitles(path_replace(episode.path)) store_subtitles(path_replace(episode['path']))
history_log(1, no, episode['sonarrEpisodeId'], message, path, language_code, provider, score) history_log(1, no, episode['sonarrEpisodeId'], message, path, language_code, provider, score)
send_notifications(no, episode['sonarrEpisodeId'], message) send_notifications(no, episode['sonarrEpisodeId'], message)
else: else:
@ -661,8 +661,11 @@ def movies_download_subtitles(no):
providers_list = get_providers() providers_list = get_providers()
providers_auth = get_providers_auth() providers_auth = get_providers_auth()
count_movie = len(ast.literal_eval(movie['missing_subtitles'])) if ast.literal_eval(movie['missing_subtitles']):
count_movie = len(ast.literal_eval(movie['missing_subtitles']))
else:
count_movie = 0
for i, language in enumerate(ast.literal_eval(movie['missing_subtitles']), 1): for i, language in enumerate(ast.literal_eval(movie['missing_subtitles']), 1):
if providers_list: if providers_list:
@ -712,7 +715,7 @@ def wanted_download_subtitles(path, l, count_episodes):
providers_auth = get_providers_auth() providers_auth = get_providers_auth()
for episode in episodes_details: for episode in episodes_details:
attempt = episode['failed_attempts'] attempt = episode['failedAttempts']
if type(attempt) == unicode: if type(attempt) == unicode:
attempt = ast.literal_eval(attempt) attempt = ast.literal_eval(attempt)
for language in ast.literal_eval(episode['missing_subtitles']): for language in ast.literal_eval(episode['missing_subtitles']):
@ -725,7 +728,7 @@ def wanted_download_subtitles(path, l, count_episodes):
attempt.append([language, time.time()]) attempt.append([language, time.time()])
database.execute("UPDATE table_episodes SET failedAttempts=? WHERE sonarrEpisodeId=?", database.execute("UPDATE table_episodes SET failedAttempts=? WHERE sonarrEpisodeId=?",
(unicode(attempt), episode['sonarrEpisdoeId'])) (unicode(attempt), episode['sonarrEpisodeId']))
for i in range(len(attempt)): for i in range(len(attempt)):
if attempt[i][0] == language: if attempt[i][0] == language:
@ -750,7 +753,7 @@ def wanted_download_subtitles(path, l, count_episodes):
score = result[4] score = result[4]
store_subtitles(path_replace(episode['path'])) store_subtitles(path_replace(episode['path']))
history_log(1, episode['sonarrSeriesId'], episode['sonarrEpisodeId'], message, path, language_code, provider, score) history_log(1, episode['sonarrSeriesId'], episode['sonarrEpisodeId'], message, path, language_code, provider, score)
send_notifications(episode['sonarrSeriesId'], episode['sonarrSeriesId'], message) send_notifications(episode['sonarrSeriesId'], episode['sonarrEpisodeId'], message)
else: else:
logging.debug( logging.debug(
'BAZARR Search is not active for episode ' + episode['path'] + ' Language: ' + attempt[i][0]) 'BAZARR Search is not active for episode ' + episode['path'] + ' Language: ' + attempt[i][0])
@ -765,7 +768,7 @@ def wanted_download_subtitles_movie(path, l, count_movies):
providers_auth = get_providers_auth() providers_auth = get_providers_auth()
for movie in movies_details: for movie in movies_details:
attempt = movie['failed_attempts'] attempt = movie['failedAttempts']
if type(attempt) == unicode: if type(attempt) == unicode:
attempt = ast.literal_eval(attempt) attempt = ast.literal_eval(attempt)
for language in ast.literal_eval(movie['missing_subtitles']): for language in ast.literal_eval(movie['missing_subtitles']):

@ -575,7 +575,7 @@ def serieseditor():
authorize() authorize()
# Get missing count # Get missing count
missing_count = len(database.execute("SELECT COUNT(*) FROM table_shows")) missing_count = database.execute("SELECT COUNT(*) as count FROM table_shows", only_one=True)['count']
# Get series list # Get series list
data = database.execute("SELECT tvdbId, title, path, languages, hearing_impaired, sonarrSeriesId, poster, " data = database.execute("SELECT tvdbId, title, path, languages, hearing_impaired, sonarrSeriesId, poster, "
@ -751,7 +751,7 @@ def movies():
def movieseditor(): def movieseditor():
authorize() authorize()
missing_count = len(database.execute("SELECT COUNT(*) FROM table_movies")) missing_count = database.execute("SELECT COUNT(*) as count FROM table_movies", only_one=True)['count']
data = database.execute("SELECT tmdbId, title, path, languages, hearing_impaired, radarrId, poster, " data = database.execute("SELECT tmdbId, title, path, languages, hearing_impaired, radarrId, poster, "
"audio_language, forced FROM table_movies ORDER BY sortTitle ASC") "audio_language, forced FROM table_movies ORDER BY sortTitle ASC")
@ -935,13 +935,14 @@ def historyseries():
thisyear.append(datetime.fromtimestamp(stat['timestamp']).date()) thisyear.append(datetime.fromtimestamp(stat['timestamp']).date())
stats = [len(today), len(thisweek), len(thisyear), total] stats = [len(today), len(thisweek), len(thisyear), total]
data = database.execute("SELECT table_history.action, table_shows.title, " data = database.execute("SELECT table_history.action, table_shows.title as seriesTitle, "
"table_episodes.season || 'x' || table_episodes.episode, table_episodes.title, " "table_episodes.season || 'x' || table_episodes.episode as episode_number, "
"table_episodes.title as episodeTitle, "
"table_history.timestamp, table_history.description, table_history.sonarrSeriesId, " "table_history.timestamp, table_history.description, table_history.sonarrSeriesId, "
"table_episodes.path, table_shows.languages, table_history.language, table_history.score, " "table_episodes.path, table_shows.languages, table_history.language, table_history.score, "
"table_shows.forced FROM table_history LEFT JOIN table_shows on " "table_shows.forced FROM table_history LEFT JOIN table_shows on "
"table_shows.sonarrSeriesId = table_history.sonarrSeriesId LEFT JOIN table_episodes on " "table_shows.sonarrSeriesId = table_history.sonarrSeriesId LEFT JOIN table_episodes on "
"table_episodes.sonarrEpisodeId = table_history.sonarrEpisodeId WHERE table_history.title " "table_episodes.sonarrEpisodeId = table_history.sonarrEpisodeId WHERE table_episodes.title "
"is not NULL ORDER BY timestamp DESC LIMIT ? OFFSET ?", (page_size, offset)) "is not NULL ORDER BY timestamp DESC LIMIT ? OFFSET ?", (page_size, offset))
upgradable_episodes_not_perfect = [] upgradable_episodes_not_perfect = []
@ -960,7 +961,7 @@ def historyseries():
else: else:
series_monitored_only_query_string = '' series_monitored_only_query_string = ''
upgradable_episodes = database.execute("SELECT video_path, MAX(timestamp), score FROM table_history " upgradable_episodes = database.execute("SELECT video_path, MAX(timestamp) as timestamp, score FROM table_history "
"INNER JOIN table_episodes on table_episodes.sonarrEpisodeId = " "INNER JOIN table_episodes on table_episodes.sonarrEpisodeId = "
"table_history.sonarrEpisodeId WHERE action IN (" + "table_history.sonarrEpisodeId WHERE action IN (" +
','.join(map(str, query_actions)) + ") AND timestamp > ? AND " ','.join(map(str, query_actions)) + ") AND timestamp > ? AND "
@ -1037,7 +1038,7 @@ def historymovies():
else: else:
query_actions = [1, 3] query_actions = [1, 3]
upgradable_movies = database.execute("SELECT video_path, MAX(timestamp), score FROM table_history_movie " upgradable_movies = database.execute("SELECT video_path, MAX(timestamp) as timestamp, score FROM table_history_movie "
"INNER JOIN table_movies on table_movies.radarrId=" "INNER JOIN table_movies on table_movies.radarrId="
"table_history_movie.radarrId WHERE action IN (" + "table_history_movie.radarrId WHERE action IN (" +
','.join(map(str, query_actions)) + ','.join(map(str, query_actions)) +
@ -1077,8 +1078,8 @@ def wantedseries():
else: else:
monitored_only_query_string = '' monitored_only_query_string = ''
missing_count = len(database.execute("SELECT COUNT(*) FROM table_episodes WHERE missing_subtitles != '[]'" + missing_count = database.execute("SELECT COUNT(*) as count FROM table_episodes WHERE missing_subtitles != '[]'" +
monitored_only_query_string)) monitored_only_query_string, only_one=True)['count']
page = request.GET.page page = request.GET.page
if page == "": if page == "":
page = "1" page = "1"
@ -1086,8 +1087,9 @@ def wantedseries():
offset = (int(page) - 1) * page_size offset = (int(page) - 1) * page_size
max_page = int(math.ceil(missing_count / (page_size + 0.0))) max_page = int(math.ceil(missing_count / (page_size + 0.0)))
data = database.execute("SELECT table_shows.title, table_episodes.season || 'x' || table_episodes.episode, " data = database.execute("SELECT table_shows.title as seriesTitle, "
"table_episodes.title, table_episodes.missing_subtitles, table_episodes.sonarrSeriesId, " "table_episodes.season || 'x' || table_episodes.episode as episode_number, "
"table_episodes.title as episodeTitle, table_episodes.missing_subtitles, table_episodes.sonarrSeriesId, "
"table_episodes.path, table_shows.hearing_impaired, table_episodes.sonarrEpisodeId, " "table_episodes.path, table_shows.hearing_impaired, table_episodes.sonarrEpisodeId, "
"table_episodes.scene_name, table_episodes.failedAttempts FROM table_episodes " "table_episodes.scene_name, table_episodes.failedAttempts FROM table_episodes "
"INNER JOIN table_shows on table_shows.sonarrSeriesId = table_episodes.sonarrSeriesId " "INNER JOIN table_shows on table_shows.sonarrSeriesId = table_episodes.sonarrSeriesId "
@ -1110,8 +1112,8 @@ def wantedmovies():
else: else:
monitored_only_query_string = '' monitored_only_query_string = ''
missing_count = len(database.execute("SELECT COUNT(*) FROM table_movies WHERE missing_subtitles != '[]'" + missing_count = database.execute("SELECT COUNT(*) as count FROM table_movies WHERE missing_subtitles != '[]'" +
monitored_only_query_string)) monitored_only_query_string, only_one=True)['count']
page = request.GET.page page = request.GET.page
if page == "": if page == "":
page = "1" page = "1"

@ -61,6 +61,7 @@ def get_episode_name(sonarrEpisodeId):
def get_movies_name(radarrId): def get_movies_name(radarrId):
data = database.execute("SELECT title FROM table_movies WHERE radarrId=?", (radarrId,), only_one=True) data = database.execute("SELECT title FROM table_movies WHERE radarrId=?", (radarrId,), only_one=True)
return data['title'] return data['title']

@ -58,58 +58,58 @@
%for row in rows: %for row in rows:
<tr class="selectable"> <tr class="selectable">
<td class="collapsing"> <td class="collapsing">
%if row.action == 0: %if row['action'] == 0:
<div class="ui inverted basic compact icon" data-tooltip="Subtitle file has been erased." data-inverted="" data-position="top left"> <div class="ui inverted basic compact icon" data-tooltip="Subtitle file has been erased." data-inverted="" data-position="top left">
<i class="ui trash icon"></i> <i class="ui trash icon"></i>
</div> </div>
%elif row.action == 1: %elif row['action'] == 1:
<div class="ui inverted basic compact icon" data-tooltip="Subtitle file has been downloaded." data-inverted="" data-position="top left"> <div class="ui inverted basic compact icon" data-tooltip="Subtitle file has been downloaded." data-inverted="" data-position="top left">
<i class="ui download icon"></i> <i class="ui download icon"></i>
</div> </div>
%elif row.action == 2: %elif row['action'] == 2:
<div class="ui inverted basic compact icon" data-tooltip="Subtitle file has been manually downloaded." data-inverted="" data-position="top left"> <div class="ui inverted basic compact icon" data-tooltip="Subtitle file has been manually downloaded." data-inverted="" data-position="top left">
<i class="ui user icon"></i> <i class="ui user icon"></i>
</div> </div>
%elif row.action == 3: %elif row['action'] == 3:
<div class="ui inverted basic compact icon" data-tooltip="Subtitle file has been upgraded." data-inverted="" data-position="top left"> <div class="ui inverted basic compact icon" data-tooltip="Subtitle file has been upgraded." data-inverted="" data-position="top left">
<i class="ui recycle icon"></i> <i class="ui recycle icon"></i>
</div> </div>
%elif row[0] == 4: %elif row['action'] == 4:
<div class="ui inverted basic compact icon" data-tooltip="Subtitle file has been manually uploaded." data-inverted="" data-position="top left"> <div class="ui inverted basic compact icon" data-tooltip="Subtitle file has been manually uploaded." data-inverted="" data-position="top left">
<i class="ui cloud upload icon"></i> <i class="ui cloud upload icon"></i>
</div> </div>
%end %end
</td> </td>
<td> <td>
<a href="{{base_url}}movie/{{row.radarr_id.radarr_id}}">{{row.title}}</a> <a href="{{base_url}}movie/{{row['radarrId']}}">{{row['title']}}</a>
</td> </td>
<td class="collapsing"> <td class="collapsing">
<div class="ui inverted" data-tooltip="{{time.strftime('%Y/%m/%d %H:%M', time.localtime(row.timestamp))}}" data-inverted="" data-position="top left"> <div class="ui inverted" data-tooltip="{{time.strftime('%Y/%m/%d %H:%M', time.localtime(row['timestamp']))}}" data-inverted="" data-position="top left">
{{pretty.date(int(row.timestamp))}} {{pretty.date(int(row['timestamp']))}}
</div> </div>
</td> </td>
<td> <td>
% upgradable_criteria = (row.timestamp, row.video_path, row.score) % upgradable_criteria = (row['timestamp'], row['video_path'], row['score'])
% if upgradable_criteria in upgradable_movies: % if upgradable_criteria in upgradable_movies:
% if row.languages != "None": % if row['languages'] != "None":
% desired_languages = ast.literal_eval(str(row.languages)) % desired_languages = ast.literal_eval(str(row['languages']))
% if row.forced == "True": % if row['forced'] == "True":
% forced_languages = [l + ":forced" for l in desired_languages] % forced_languages = [l + ":forced" for l in desired_languages]
% elif row.forced == "Both": % elif row['forced'] == "Both":
% forced_languages = [l + ":forced" for l in desired_languages] + desired_languages % forced_languages = [l + ":forced" for l in desired_languages] + desired_languages
% else: % else:
% forced_languages = desired_languages % forced_languages = desired_languages
% end % end
% if row.languages and row.language and row.language in forced_languages: % if row['languages'] and row['language'] and row['language'] in forced_languages:
<div class="ui inverted basic compact icon" data-tooltip="This Subtitle file is eligible for an upgrade." data-inverted="" data-position="top left"> <div class="ui inverted basic compact icon" data-tooltip="This Subtitle file is eligible for an upgrade." data-inverted="" data-position="top left">
<i class="ui green recycle icon upgrade"></i>{{row.description}} <i class="ui green recycle icon upgrade"></i>{{row['description']}}
</div> </div>
% else: % else:
{{row.description}} {{row['description']}}
% end % end
% end % end
% else: % else:
{{row.description}} {{row['description']}}
% end % end
</td> </td>
</tr> </tr>

@ -60,71 +60,71 @@
%for row in rows: %for row in rows:
<tr class="selectable"> <tr class="selectable">
<td class="collapsing"> <td class="collapsing">
%if row.action == 0: %if row['action'] == 0:
<div class="ui inverted basic compact icon" data-tooltip="Subtitle file has been erased." data-inverted="" data-position="top left"> <div class="ui inverted basic compact icon" data-tooltip="Subtitle file has been erased." data-inverted="" data-position="top left">
<i class="ui trash icon"></i> <i class="ui trash icon"></i>
</div> </div>
%elif row.action == 1: %elif row['action'] == 1:
<div class="ui inverted basic compact icon" data-tooltip="Subtitle file has been downloaded." data-inverted="" data-position="top left"> <div class="ui inverted basic compact icon" data-tooltip="Subtitle file has been downloaded." data-inverted="" data-position="top left">
<i class="ui download icon"></i> <i class="ui download icon"></i>
</div> </div>
%elif row.action == 2: %elif row['action'] == 2:
<div class="ui inverted basic compact icon" data-tooltip="Subtitle file has been manually downloaded." data-inverted="" data-position="top left"> <div class="ui inverted basic compact icon" data-tooltip="Subtitle file has been manually downloaded." data-inverted="" data-position="top left">
<i class="ui user icon"></i> <i class="ui user icon"></i>
</div> </div>
%elif row.action == 3: %elif row['action'] == 3:
<div class="ui inverted basic compact icon" data-tooltip="Subtitle file has been upgraded." data-inverted="" data-position="top left"> <div class="ui inverted basic compact icon" data-tooltip="Subtitle file has been upgraded." data-inverted="" data-position="top left">
<i class="ui recycle icon"></i> <i class="ui recycle icon"></i>
</div> </div>
%elif row.action == 4: %elif row['action'] == 4:
<div class="ui inverted basic compact icon" data-tooltip="Subtitle file has been manually uploaded." data-inverted="" data-position="top left"> <div class="ui inverted basic compact icon" data-tooltip="Subtitle file has been manually uploaded." data-inverted="" data-position="top left">
<i class="ui cloud upload icon"></i> <i class="ui cloud upload icon"></i>
</div> </div>
%end %end
</td> </td>
<td> <td>
<a href="{{base_url}}episodes/{{row.sonarr_series_id.sonarr_series_id}}">{{row.seriesTitle}}</a> <a href="{{base_url}}episodes/{{row['sonarrSeriesId']}}">{{row['seriesTitle']}}</a>
</td> </td>
<td class="collapsing"> <td class="collapsing">
%if row.episode_number is not None: %if row['episode_number'] is not None:
% episode = row.episode_number.split('x') % episode = row['episode_number'].split('x')
{{episode[0] + 'x' + episode[1].zfill(2)}} {{episode[0] + 'x' + episode[1].zfill(2)}}
%end %end
</td> </td>
<td> <td>
%if row.episodeTitle is not None: %if row['episodeTitle'] is not None:
{{row.episodeTitle}} {{row['episodeTitle']}}
%else: %else:
<em>Deleted episode</em> <em>Deleted episode</em>
%end %end
</td> </td>
<td class="collapsing"> <td class="collapsing">
<div class="ui inverted" data-tooltip="{{time.strftime('%Y/%m/%d %H:%M', time.localtime(row.timestamp))}}" data-inverted="" data-position="top left"> <div class="ui inverted" data-tooltip="{{time.strftime('%Y/%m/%d %H:%M', time.localtime(row['timestamp']))}}" data-inverted="" data-position="top left">
{{pretty.date(int(row.timestamp))}} {{pretty.date(int(row['timestamp']))}}
</div> </div>
</td> </td>
<td> <td>
% upgradable_criteria = (row.timestamp, row.path, row.score) % upgradable_criteria = (row['timestamp'], row['path'], row['score'])
% if upgradable_criteria in upgradable_episodes: % if upgradable_criteria in upgradable_episodes:
% if row.languages != "None": % if row['languages'] != "None":
% desired_languages = ast.literal_eval(str(row.languages)) % desired_languages = ast.literal_eval(str(row['languages']))
% if row.forced == "True": % if row['forced'] == "True":
% forced_languages = [l + ":forced" for l in desired_languages] % forced_languages = [l + ":forced" for l in desired_languages]
% elif row.forced == "Both": % elif row['forced'] == "Both":
% forced_languages = [l + ":forced" for l in desired_languages] + desired_languages % forced_languages = [l + ":forced" for l in desired_languages] + desired_languages
% else: % else:
% forced_languages = desired_languages % forced_languages = desired_languages
% end % end
% if row.language in forced_languages: % if row['language'] in forced_languages:
<div class="ui inverted basic compact icon" data-tooltip="This Subtitle file is eligible for an upgrade." data-inverted="" data-position="top left"> <div class="ui inverted basic compact icon" data-tooltip="This Subtitle file is eligible for an upgrade." data-inverted="" data-position="top left">
<i class="ui green recycle icon upgrade"></i>{{row.description}} <i class="ui green recycle icon upgrade"></i>{{row['description']}}
</div> </div>
% else: % else:
{{row.description}} {{row['description']}}
% end % end
% end % end
% else: % else:
{{row.description}} {{row['description']}}
% end % end
</td> </td>
</tr> </tr>

@ -74,8 +74,8 @@
% monitored_only_query_string_radarr = "" % monitored_only_query_string_radarr = ""
%end %end
% wanted_series = len(database.execute("SELECT COUNT(*) FROM table_episodes WHERE missing_subtitles != '[]'" + monitored_only_query_string_sonarr)) % wanted_series = database.execute("SELECT COUNT(*) as count FROM table_episodes WHERE missing_subtitles != '[]'" + monitored_only_query_string_sonarr, only_one=True)['count']
% wanted_movies = len(database.execute("SELECT COUNT(*) FROM table_movies WHERE missing_subtitles != '[]'" + monitored_only_query_string_radarr)) % wanted_movies = database.execute("SELECT COUNT(*) as count FROM table_movies WHERE missing_subtitles != '[]'" + monitored_only_query_string_radarr, only_one=True)['count']
% from get_providers import list_throttled_providers % from get_providers import list_throttled_providers
% throttled_providers_count = len(eval(str(settings.general.throtteled_providers))) % throttled_providers_count = len(eval(str(settings.general.throtteled_providers)))
<div id="divmenu" class="ui container"> <div id="divmenu" class="ui container">

@ -232,8 +232,8 @@
forced_bool = False forced_bool = False
end end
if details['failed_attempts'] is not None and settings.general.getboolean('adaptive_searching') and missing_subs_language in details['failed_attempts']: if details['failedAttempts'] is not None and settings.general.getboolean('adaptive_searching') and missing_subs_language in details['failedAttempts']:
for lang in ast.literal_eval(details['failed_attempts']): for lang in ast.literal_eval(details['failedAttempts']):
if missing_subs_language in lang: if missing_subs_language in lang:
if search_active(lang[1]): if search_active(lang[1]):
%> %>

@ -74,22 +74,22 @@
<tr class="selectable"> <tr class="selectable">
<td class="collapsing"> <td class="collapsing">
<div class="ui checkbox"> <div class="ui checkbox">
<input id='{{row.radarr_id}}' type="checkbox" class="selected"> <input id='{{row['radarrId']}}' type="checkbox" class="selected">
<label></label> <label></label>
</div> </div>
</td> </td>
<td><a href="{{base_url}}movie/{{row.radarr_id}}">{{row.title}}</a></td> <td><a href="{{base_url}}movie/{{row['radarrId']}}">{{row['title']}}</a></td>
<td>{{row.audio_language}}</td> <td>{{row['audio_language']}}</td>
<td> <td>
%subs_languages = ast.literal_eval(str(row.languages)) %subs_languages = ast.literal_eval(str(row['languages']))
%if subs_languages is not None: %if subs_languages is not None:
%for subs_language in subs_languages: %for subs_language in subs_languages:
<div class="ui tiny label">{{subs_language}}</div> <div class="ui tiny label">{{subs_language}}</div>
%end %end
%end %end
</td> </td>
<td>{{!"" if row.hearing_impaired == None else row.hearing_impaired}}</td> <td>{{!"" if row['hearing_impaired'] == None else row['hearing_impaired']}}</td>
<td>{{!"" if row.forced is None else row.forced}}</td> <td>{{!"" if row['forced'] is None else row['forced']}}</td>
</tr> </tr>
%end %end
</tbody> </tbody>
@ -105,7 +105,7 @@
<option value="">No Change</option> <option value="">No Change</option>
<option value="None">None</option> <option value="None">None</option>
%for language in languages: %for language in languages:
<option value="{{language.code2}}">{{language.name}}</option> <option value="{{language['code2']}}">{{language['name']}}</option>
%end %end
</select> </select>
</div> </div>

@ -74,22 +74,22 @@
<tr class="selectable"> <tr class="selectable">
<td class="collapsing"> <td class="collapsing">
<div class="ui checkbox"> <div class="ui checkbox">
<input id='{{row.sonarr_series_id}}' type="checkbox" class="selected"> <input id='{{row['sonarrSeriesId']}}' type="checkbox" class="selected">
<label></label> <label></label>
</div> </div>
</td> </td>
<td><a href="{{base_url}}episodes/{{row.sonarr_series_id}}">{{row.title}}</a></td> <td><a href="{{base_url}}episodes/{{row['sonarrSeriesId']}}">{{row['title']}}</a></td>
<td>{{row.audio_language}}</td> <td>{{row['audio_language']}}</td>
<td> <td>
%subs_languages = ast.literal_eval(str(row.languages)) %subs_languages = ast.literal_eval(str(row['languages']))
%if subs_languages is not None: %if subs_languages is not None:
%for subs_language in subs_languages: %for subs_language in subs_languages:
<div class="ui tiny label">{{subs_language}}</div> <div class="ui tiny label">{{subs_language}}</div>
%end %end
%end %end
</td> </td>
<td>{{!"" if row.hearing_impaired is None else row.hearing_impaired}}</td> <td>{{!"" if row['hearing_impaired'] is None else row['hearing_impaired']}}</td>
<td>{{!"" if row.forced is None else row.forced}}</td> <td>{{!"" if row['forced'] is None else row['forced']}}</td>
</tr> </tr>
%end %end
</tbody> </tbody>
@ -105,7 +105,7 @@
<option value="">No Change</option> <option value="">No Change</option>
<option value="None">None</option> <option value="None">None</option>
%for language in languages: %for language in languages:
<option value="{{language.code2}}">{{language.name}}</option> <option value="{{language['code2']}}">{{language['name']}}</option>
%end %end
</select> </select>
</div> </div>

@ -10,19 +10,19 @@
%for notifier in settings_notifier: %for notifier in settings_notifier:
<div class="middle aligned row"> <div class="middle aligned row">
<div class="right aligned four wide column"> <div class="right aligned four wide column">
<label>{{notifier.name}}</label> <label>{{notifier['name']}}</label>
</div> </div>
<div class="one wide column"> <div class="one wide column">
<div id="settings_notifier_{{notifier.name}}_enabled" class="notifier_enabled ui toggle checkbox" data-notifier-url-div="settings_notifier_{{notifier.name}}_url_div" data-enabled={{notifier.enabled}}> <div id="settings_notifier_{{notifier['name']}}_enabled" class="notifier_enabled ui toggle checkbox" data-notifier-url-div="settings_notifier_{{notifier['name']}}_url_div" data-enabled={{notifier['enabled']}}>
<input name="settings_notifier_{{notifier.name}}_enabled" type="checkbox"> <input name="settings_notifier_{{notifier['name']}}_enabled" type="checkbox">
<label></label> <label></label>
</div> </div>
</div> </div>
<div class="eight wide column"> <div class="eight wide column">
<div class='field'> <div class='field'>
<div id="settings_notifier_{{notifier.name}}_url_div" class="ui fluid input"> <div id="settings_notifier_{{notifier['name']}}_url_div" class="ui fluid input">
<input name="settings_notifier_{{notifier.name}}_url" type="text" value="{{notifier.url if notifier.url != None else ''}}"> <input name="settings_notifier_{{notifier['name']}}_url" type="text" value="{{notifier['url'] if notifier['url'] != None else ''}}">
<div class="test_notification ui blue button" data-notification="{{notifier.url}}">Test Notification</div> <div class="test_notification ui blue button" data-notification="{{notifier['url']}}">Test Notification</div>
</div> </div>
</div> </div>
</div> </div>

@ -414,9 +414,9 @@
<option value="">Languages</option> <option value="">Languages</option>
%enabled_languages = [] %enabled_languages = []
%for language in settings_languages: %for language in settings_languages:
<option value="{{language.code2}}">{{language.name}}</option> <option value="{{language['code2']}}">{{language['name']}}</option>
%if language.enabled == True: %if language['enabled'] == True:
% enabled_languages.append(str(language.code2)) % enabled_languages.append(str(language['code2']))
%end %end
%end %end
</select> </select>

@ -60,8 +60,8 @@
% episodes_missing_subtitles_clause_movie = "" % episodes_missing_subtitles_clause_movie = ""
%end %end
% wanted_series = len(database.execute("SELECT COUNT(*) FROM table_episodes WHERE missing_subtitles != '[]'" + episodes_missing_subtitles_clause)) % wanted_series = database.execute("SELECT COUNT(*) as count FROM table_episodes WHERE missing_subtitles != '[]'" + episodes_missing_subtitles_clause, only_one=True)['count']
% wanted_movies = len(database.execute("SELECT COUNT(*) FROM table_movies WHERE missing_subtitles != '[]'" + episodes_missing_subtitles_clause_movie)) % wanted_movies = database.execute("SELECT COUNT(*) as count FROM table_movies WHERE missing_subtitles != '[]'" + episodes_missing_subtitles_clause_movie, only_one=True)['count']
<div id='loader' class="ui page dimmer"> <div id='loader' class="ui page dimmer">
<div id="loader_text" class="ui indeterminate text loader">Loading...</div> <div id="loader_text" class="ui indeterminate text loader">Loading...</div>

@ -59,10 +59,10 @@
%end %end
%for row in rows: %for row in rows:
<tr class="selectable"> <tr class="selectable">
<td><a href="{{base_url}}movie/{{row.radarr_id}}">{{row.title}}</a></td> <td><a href="{{base_url}}movie/{{row['radarrId']}}">{{row['title']}}</a></td>
<td> <td>
<% <%
missing_languages = ast.literal_eval(row.missing_subtitles) missing_languages = ast.literal_eval(row['missing_subtitles'])
if missing_languages is not None: if missing_languages is not None:
from get_subtitle import search_active from get_subtitle import search_active
from config import settings from config import settings
@ -72,18 +72,18 @@
else: else:
forced = False forced = False
end end
if row.failed_attempts is not None and settings.general.getboolean('adaptive_searching') and language in row.failed_attempts: if row['failedAttempts'] is not None and settings.general.getboolean('adaptive_searching') and language in row['failedAttempts']:
for lang in ast.literal_eval(row.failed_attempts): for lang in ast.literal_eval(row['failedAttempts']):
if language in lang: if language in lang:
active = search_active(lang[1]) active = search_active(lang[1])
if active: if active:
%> %>
<a data-moviePath="{{row.path}}" data-sceneName="{{row.scene_name}}" data-language="{{alpha3_from_alpha2(str(language.split(':')[0]))}}" data-hi="{{row.hearing_impaired}}" data-forced="{{forced}}" data-radarrId={{row.radarr_id}} data-title="{{row.title.replace("'", "\'")}}" class="get_subtitle ui tiny label"> <a data-moviePath="{{row['path']}}" data-sceneName="{{row['sceneName']}}" data-language="{{alpha3_from_alpha2(str(language.split(':')[0]))}}" data-hi="{{row['hearing_impaired']}}" data-forced="{{forced}}" data-radarrId={{row['radarrId']}} data-title="{{row['title'].replace("'", "\'")}}" class="get_subtitle ui tiny label">
{{language}} {{language}}
<i style="margin-left:3px; margin-right:0" class="search icon"></i> <i style="margin-left:3px; margin-right:0" class="search icon"></i>
</a> </a>
%else: %else:
<a data-tooltip="Automatic Searching Delayed (Adaptive Search)" data-position="top right" data-inverted="" data-moviePath="{{row.path}}" data-sceneName="{{row.scene_name}}" data-language="{{alpha3_from_alpha2(str(language.split(':')[0]))}}" data-hi="{{row.hearing_impaired}}" data-forced="{{forced}}" data-radarrId={{row.radarr_id}} data-title="{{row.title.replace("'", "\'")}}" class="get_subtitle ui tiny label"> <a data-tooltip="Automatic Searching Delayed (Adaptive Search)" data-position="top right" data-inverted="" data-moviePath="{{row['path']}}" data-sceneName="{{row['sceneName']}}" data-language="{{alpha3_from_alpha2(str(language.split(':')[0]))}}" data-hi="{{row['hearing_impaired']}}" data-forced="{{forced}}" data-radarrId={{row['radarrId']}} data-title="{{row['title'].replace("'", "\'")}}" class="get_subtitle ui tiny label">
{{language}} {{language}}
<i style="margin-left:3px; margin-right:0" class="search red icon"></i> <i style="margin-left:3px; margin-right:0" class="search red icon"></i>
</a> </a>
@ -91,7 +91,7 @@
%end %end
%end %end
%else: %else:
<a data-moviePath="{{row.path}}" data-sceneName="{{row.scene_name}}" data-language="{{alpha3_from_alpha2(str(language.split(':')[0]))}}" data-hi="{{row.hearing_impaired}}" data-forced="{{forced}}" data-radarrId="{{row.radarr_id}}" data-title="{{row.title.replace("'", "\'")}}" class="get_subtitle ui tiny label"> <a data-moviePath="{{row['path']}}" data-sceneName="{{row['sceneName']}}" data-language="{{alpha3_from_alpha2(str(language.split(':')[0]))}}" data-hi="{{row['hearing_impaired']}}" data-forced="{{forced}}" data-radarrId="{{row['radarrId']}}" data-title="{{row['title'].replace("'", "\'")}}" class="get_subtitle ui tiny label">
{{language}} {{language}}
<i style="margin-left:3px; margin-right:0" class="search icon"></i> <i style="margin-left:3px; margin-right:0" class="search icon"></i>
</a> </a>

@ -54,22 +54,22 @@
<tbody> <tbody>
%import time %import time
%import pretty %import pretty
%if rows.count() == 0: %if len(rows) == 0:
<tr> <tr>
<td colspan="4">No Missing Subtitles.</td> <td colspan="4">No Missing Subtitles.</td>
</tr> </tr>
%end %end
%for row in rows: %for row in rows:
<tr class="selectable"> <tr class="selectable">
<td><a href="{{base_url}}episodes/{{row.sonarr_series_id.sonarr_series_id}}">{{row.seriesTitle}}</a></td> <td><a href="{{base_url}}episodes/{{row['sonarrSeriesId']}}">{{row['seriesTitle']}}</a></td>
<td class="collapsing"> <td class="collapsing">
<%episode = str(row.episode_number).split('x')%> <%episode = str(row['episode_number']).split('x')%>
{{episode[0] + 'x' + episode[1].zfill(2)}} {{episode[0] + 'x' + episode[1].zfill(2)}}
</td> </td>
<td>{{row.episodeTitle}}</td> <td>{{row['episodeTitle']}}</td>
<td> <td>
<% <%
missing_languages = ast.literal_eval(row.missing_subtitles) missing_languages = ast.literal_eval(row['missing_subtitles'])
if missing_languages is not None: if missing_languages is not None:
from get_subtitle import search_active from get_subtitle import search_active
from config import settings from config import settings
@ -79,18 +79,18 @@
else: else:
forced = False forced = False
end end
if row.failed_attempts is not None and settings.general.getboolean('adaptive_searching') and language in row.failed_attempts: if row['failedAttempts'] is not None and settings.general.getboolean('adaptive_searching') and language in row['failedAttempts']:
for lang in ast.literal_eval(row.failed_attempts): for lang in ast.literal_eval(row['failedAttempts']):
if language in lang: if language in lang:
active = search_active(lang[1]) active = search_active(lang[1])
if active: if active:
%> %>
<a data-episodePath="{{row.path}}" data-sceneName="{{row.scene_name}}" data-language="{{alpha3_from_alpha2(str(language.split(':')[0]))}}" data-hi="{{row.hearing_impaired}}" data-forced="{{forced}}" data-sonarrSeriesId={{row.sonarr_series_id.sonarr_series_id}} data-sonarrEpisodeId={{row.sonarr_episode_id}} data-title="{{row.seriesTitle.replace("'", "\'")}}" class="get_subtitle ui tiny label"> <a data-episodePath="{{row['path']}}" data-sceneName="{{row['scene_name']}}" data-language="{{alpha3_from_alpha2(str(language.split(':')[0]))}}" data-hi="{{row['hearing_impaired']}}" data-forced="{{forced}}" data-sonarrSeriesId={{row['sonarrSeriesId']}} data-sonarrEpisodeId={{row['sonarrEpisodeId']}} data-title="{{row['seriesTitle'].replace("'", "\'")}}" class="get_subtitle ui tiny label">
{{language}} {{language}}
<i style="margin-left:3px; margin-right:0" class="search icon"></i> <i style="margin-left:3px; margin-right:0" class="search icon"></i>
</a> </a>
%else: %else:
<a data-tooltip="Automatic Searching Delayed (Adaptive Search)" data-position="top right" data-inverted="" data-episodePath="{{row.path}}" data-sceneName="{{row.scene_name}}" data-language="{{alpha3_from_alpha2(str(language.split(':')[0]))}}" data-hi="{{row.hearing_impaired}}" data-forced="{{forced}}" data-sonarrSeriesId={{row.sonarr_series_id.sonarr_series_id}} data-sonarrEpisodeId={{row.sonarr_episode_id}} data-title="{{row.seriesTitle.replace("'", "\'")}}" class="get_subtitle ui tiny label"> <a data-tooltip="Automatic Searching Delayed (Adaptive Search)" data-position="top right" data-inverted="" data-episodePath="{{row['path']}}" data-sceneName="{{row['scene_name']}}" data-language="{{alpha3_from_alpha2(str(language.split(':')[0]))}}" data-hi="{{row['hearing_impaired']}}" data-forced="{{forced}}" data-sonarrSeriesId={{row['sonarrSeriesId']}} data-sonarrEpisodeId={{row['sonarrEpisodeId']}} data-title="{{row['seriesTitle'].replace("'", "\'")}}" class="get_subtitle ui tiny label">
{{language}} {{language}}
<i style="margin-left:3px; margin-right:0" class="search red icon"></i> <i style="margin-left:3px; margin-right:0" class="search red icon"></i>
</a> </a>
@ -98,7 +98,7 @@
%end %end
%end %end
%else: %else:
<a data-episodePath="{{row.path}}" data-sceneName="{{row.scene_name}}" data-language="{{alpha3_from_alpha2(str(language.split(':')[0]))}}" data-hi="{{row.hearing_impaired}}" data-forced="{{forced}}" data-sonarrSeriesId={{row.sonarr_series_id.sonarr_series_id}} data-sonarrEpisodeId={{row.sonarr_episode_id}} data-title="{{row.seriesTitle.replace("'", "\'")}}" class="get_subtitle ui tiny label"> <a data-episodePath="{{row['path']}}" data-sceneName="{{row['scene_name']}}" data-language="{{alpha3_from_alpha2(str(language.split(':')[0]))}}" data-hi="{{row['hearing_impaired']}}" data-forced="{{forced}}" data-sonarrSeriesId={{row['sonarrSeriesId']}} data-sonarrEpisodeId={{row['sonarrEpisodeId']}} data-title="{{row['seriesTitle'].replace("'", "\'")}}" class="get_subtitle ui tiny label">
{{language}} {{language}}
<i style="margin-left:3px; margin-right:0" class="search icon"></i> <i style="margin-left:3px; margin-right:0" class="search icon"></i>
</a> </a>

Loading…
Cancel
Save