diff --git a/bazarr/config.py b/bazarr/config.py index 92beec7bf..19e885839 100644 --- a/bazarr/config.py +++ b/bazarr/config.py @@ -33,11 +33,14 @@ defaults = { 'use_embedded_subs': 'True', 'adaptive_searching': 'False', 'enabled_providers': '', - 'throtteled_providers': '', + 'throtteled_providers': '{}', 'multithreading': 'True', 'chmod': '0640', 'subfolder': 'current', - 'subfolder_custom': '' + 'subfolder_custom': '', + 'upgrade_subs': 'True', + 'days_to_upgrade_subs': '7', + 'upgrade_manual': 'True' }, 'auth': { 'type': 'None', diff --git a/bazarr/get_providers.py b/bazarr/get_providers.py index 3511f628d..39ba91b67 100644 --- a/bazarr/get_providers.py +++ b/bazarr/get_providers.py @@ -3,6 +3,7 @@ import os import datetime import logging import subliminal_patch +import pretty from get_args import args from config import settings @@ -139,3 +140,33 @@ def provider_throttle(name, exception): logging.info("Throttling %s for %s, until %s, because of: %s. Exception info: %r", name, throttle_description, throttle_until.strftime("%y/%m/%d %H:%M"), cls_name, exception.message) + +def update_throttled_provider(): + changed = False + if settings.general.enabled_providers: + for provider in settings.general.enabled_providers.lower().split(','): + reason, until, throttle_desc = tp.get(provider, (None, None, None)) + + if reason: + now = datetime.datetime.now() + if now < until: + pass + else: + logging.info("Using %s again after %s, (disabled because: %s)", provider, throttle_desc, reason) + del tp[provider] + settings.general.throtteled_providers = str(tp) + changed = True + + if changed: + with open(os.path.join(args.config_dir, 'config', 'config.ini'), 'w+') as handle: + settings.write(handle) + + +def list_throttled_providers(): + update_throttled_provider() + throttled_providers = [] + if settings.general.enabled_providers: + for provider in settings.general.enabled_providers.lower().split(','): + reason, until, throttle_desc = tp.get(provider, (None, None, None)) + throttled_providers.append([provider, reason, pretty.date(until)]) + return throttled_providers diff --git a/bazarr/get_subtitle.py b/bazarr/get_subtitle.py index f77e8ab7d..e7a412a9c 100644 --- a/bazarr/get_subtitle.py +++ b/bazarr/get_subtitle.py @@ -102,7 +102,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): +def download_subtitle(path, language, hi, 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 @@ -112,7 +112,7 @@ def download_subtitle(path, language, hi, providers, providers_auth, sceneName, else: hi = False language_set = set() - + if not isinstance(language, types.ListType): language = [language] @@ -145,6 +145,8 @@ def download_subtitle(path, language, hi, providers, providers_auth, sceneName, min_score_series_perc=int(minimum_score)) if providers: + if forced_minimum_score: + min_score = int(forced_minimum_score) + 1 downloaded_subtitles = download_best_subtitles({video}, language_set, int(min_score), hi, providers=providers, provider_configs=providers_auth, @@ -183,16 +185,23 @@ def download_subtitle(path, language, hi, providers, providers_auth, sceneName, saved_any = True for subtitle in saved_subtitles: downloaded_provider = subtitle.provider_name - downloaded_language = language_from_alpha3(subtitle.language.alpha3) - downloaded_language_code2 = alpha2_from_alpha3(subtitle.language.alpha3) - downloaded_language_code3 = subtitle.language.alpha3 + if subtitle.language == 'pt-BR': + downloaded_language_code3 = 'pob' + else: + downloaded_language_code3 = subtitle.language.alpha3 + downloaded_language = language_from_alpha3(downloaded_language_code3) + downloaded_language_code2 = alpha2_from_alpha3(downloaded_language_code3) downloaded_path = subtitle.storage_path logging.debug('BAZARR Subtitles file saved to disk: ' + downloaded_path) + if is_upgrade: + action = "upgraded" + else: + action = "downloaded" if video.used_scene_name: - message = downloaded_language + " subtitles downloaded from " + downloaded_provider + " with a score of " + unicode( + message = downloaded_language + " subtitles " + action + " from " + downloaded_provider + " with a score of " + unicode( round(subtitle.score * 100 / max_score, 2)) + "% using this scene name: " + sceneName else: - message = downloaded_language + " subtitles downloaded from " + downloaded_provider + " with a score of " + unicode( + message = downloaded_language + " subtitles " + action + " from " + downloaded_provider + " with a score of " + unicode( round(subtitle.score * 100 / max_score, 2)) + "% using filename guessing." if use_postprocessing is True: @@ -367,9 +376,12 @@ def manual_download_subtitle(path, language, hi, subtitle, provider, providers_a if saved_subtitles: for saved_subtitle in saved_subtitles: downloaded_provider = saved_subtitle.provider_name - downloaded_language = language_from_alpha3(saved_subtitle.language.alpha3) - downloaded_language_code2 = alpha2_from_alpha3(saved_subtitle.language.alpha3) - downloaded_language_code3 = saved_subtitle.language.alpha3 + if saved_subtitle.language == 'pt-BR': + downloaded_language_code3 = 'pob' + else: + downloaded_language_code3 = subtitle.language.alpha3 + downloaded_language = language_from_alpha3(downloaded_language_code3) + downloaded_language_code2 = alpha2_from_alpha3(downloaded_language_code3) downloaded_path = saved_subtitle.storage_path logging.debug('BAZARR Subtitles file saved to disk: ' + downloaded_path) message = downloaded_language + " subtitles downloaded from " + downloaded_provider + " with a score of " + unicode( @@ -707,3 +719,88 @@ def refine_from_db(path, video): if data[6]: video.audio_codec = data[6] return video + + +def upgrade_subtitles(): + days_to_upgrade_subs = settings.general.days_to_upgrade_subs + minimum_timestamp = ((datetime.now() - timedelta(days=int(days_to_upgrade_subs))) - + datetime(1970, 1, 1)).total_seconds() + + if settings.general.getboolean('upgrade_manual'): + query_actions = [1, 2, 3] + else: + query_actions = [1, 3] + + db = sqlite3.connect(os.path.join(args.config_dir, 'db', 'bazarr.db'), timeout=30) + c = db.cursor() + 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 + 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 + WHERE action IN (""" + ','.join(map(str, query_actions)) + """) AND timestamp > ? AND + score is not null + GROUP BY table_history.video_path, table_history.language""", + (minimum_timestamp,)).fetchall() + 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 + 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 + score is not null + GROUP BY table_history_movie.video_path, table_history_movie.language""", + (minimum_timestamp,)).fetchall() + db.close() + + episodes_to_upgrade = [] + for episode in episodes_list: + if os.path.exists(path_replace(episode[0])) and int(episode[2]) < 360: + episodes_to_upgrade.append(episode) + + movies_to_upgrade = [] + for movie in movies_list: + if os.path.exists(path_replace_movie(movie[0])) and int(movie[2]) < 120: + movies_to_upgrade.append(movie) + + providers_list = get_providers() + providers_auth = get_providers_auth() + + for episode in episodes_to_upgrade: + if episode[1] in ast.literal_eval(str(episode[9])): + notifications.write( + 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[5], 'series', forced_minimum_score=int(episode[2]), is_upgrade=True) + if result is not None: + message = result[0] + path = result[1] + language_code = result[2] + provider = result[3] + score = result[4] + store_subtitles(path_replace(episode[0])) + history_log(3, episode[6], episode[7], message, path, language_code, provider, score) + send_notifications(episode[6], episode[7], message) + + for movie in movies_to_upgrade: + if movie[1] in ast.literal_eval(str(movie[8])): + notifications.write( + 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[5], 'movie', forced_minimum_score=int(movie[2]), is_upgrade=True) + if result is not None: + message = result[0] + path = result[1] + language_code = result[2] + provider = result[3] + score = result[4] + store_subtitles_movie(path_replace_movie(movie[0])) + history_log_movie(3, movie[6], message, path, language_code, provider, score) + send_notifications_movie(movie[6], message) diff --git a/bazarr/main.py b/bazarr/main.py index cc22b1696..65173d434 100644 --- a/bazarr/main.py +++ b/bazarr/main.py @@ -53,7 +53,7 @@ from cork import Cork from bottle import route, run, template, static_file, request, redirect, response, HTTPError, app, hook, abort from datetime import datetime, timedelta from get_languages import load_language_in_db, language_from_alpha3 -from get_providers import get_providers, get_providers_auth +from get_providers import get_providers, get_providers_auth, list_throttled_providers from get_series import * from get_episodes import * @@ -62,7 +62,7 @@ if not args.no_update: from list_subtitles import store_subtitles, store_subtitles_movie, series_scan_subtitles, movies_scan_subtitles, \ list_missing_subtitles, list_missing_subtitles_movies from get_subtitle import download_subtitle, series_download_subtitles, movies_download_subtitles, \ - wanted_download_subtitles, wanted_search_missing_subtitles, manual_search, manual_download_subtitle + wanted_download_subtitles, wanted_search_missing_subtitles, manual_search, manual_download_subtitle, upgrade_subtitles from utils import history_log, history_log_movie from scheduler import * from notifier import send_notifications, send_notifications_movie @@ -278,7 +278,18 @@ def save_wizard(): settings_general_embedded = 'True' settings_subfolder = request.forms.get('settings_subfolder') settings_subfolder_custom = request.forms.get('settings_subfolder_custom') - + settings_upgrade_subs = request.forms.get('settings_upgrade_subs') + if settings_upgrade_subs is None: + settings_upgrade_subs = 'False' + else: + settings_upgrade_subs = 'True' + settings_days_to_upgrade_subs = request.forms.get('settings_days_to_upgrade_subs') + settings_upgrade_manual = request.forms.get('settings_upgrade_manual') + if settings_upgrade_manual is None: + settings_upgrade_manual = 'False' + else: + settings_upgrade_manual = 'True' + settings.general.ip = text_type(settings_general_ip) settings.general.port = text_type(settings_general_port) settings.general.base_url = text_type(settings_general_baseurl) @@ -290,7 +301,10 @@ def save_wizard(): settings.general.subfolder = text_type(settings_subfolder) settings.general.subfolder_custom = text_type(settings_subfolder_custom) settings.general.use_embedded_subs = text_type(settings_general_embedded) - + settings.general.upgrade_subs = text_type(settings_upgrade_subs) + settings.general.days_to_upgrade_subs = text_type(settings_days_to_upgrade_subs) + settings.general.upgrade_manual = text_type(settings_upgrade_manual) + settings_sonarr_ip = request.forms.get('settings_sonarr_ip') settings_sonarr_port = request.forms.get('settings_sonarr_port') settings_sonarr_baseurl = request.forms.get('settings_sonarr_baseurl') @@ -939,7 +953,7 @@ def historyseries(): today = [] thisweek = [] thisyear = [] - stats = c.execute("SELECT timestamp FROM table_history WHERE action LIKE '1'").fetchall() + stats = c.execute("SELECT timestamp FROM table_history WHERE action > 0").fetchall() total = len(stats) for stat in stats: if now - timedelta(hours=24) <= datetime.fromtimestamp(stat[0]) <= now: @@ -951,14 +965,44 @@ def historyseries(): stats = [len(today), len(thisweek), len(thisyear), total] c.execute( - "SELECT table_history.action, table_shows.title, table_episodes.season || 'x' || table_episodes.episode, table_episodes.title, table_history.timestamp, table_history.description, table_history.sonarrSeriesId FROM table_history LEFT JOIN table_shows on table_shows.sonarrSeriesId = table_history.sonarrSeriesId LEFT JOIN table_episodes on table_episodes.sonarrEpisodeId = table_history.sonarrEpisodeId ORDER BY id DESC LIMIT ? OFFSET ?", + "SELECT table_history.action, table_shows.title, table_episodes.season || 'x' || table_episodes.episode, table_episodes.title, table_history.timestamp, table_history.description, table_history.sonarrSeriesId, table_episodes.path, table_shows.languages, table_history.language, table_history.score FROM table_history LEFT JOIN table_shows on table_shows.sonarrSeriesId = table_history.sonarrSeriesId LEFT JOIN table_episodes on table_episodes.sonarrEpisodeId = table_history.sonarrEpisodeId ORDER BY id DESC LIMIT ? OFFSET ?", (page_size, offset,)) data = c.fetchall() + + upgradable_episodes = [] + if settings.general.getboolean('upgrade_subs'): + days_to_upgrade_subs = settings.general.days_to_upgrade_subs + minimum_timestamp = ((datetime.now() - timedelta(days=int(days_to_upgrade_subs))) - + datetime(1970, 1, 1)).total_seconds() + + if settings.general.getboolean('upgrade_manual'): + query_actions = [1, 2, 3] + else: + query_actions = [1, 3] + + upgradable_episodes = c.execute("""SELECT video_path, MAX(timestamp), score + FROM table_history + WHERE action IN (""" + ','.join(map(str, query_actions)) + """) AND + timestamp > ? AND score is not null + GROUP BY table_history.video_path, table_history.language""", + (minimum_timestamp,)).fetchall() + upgradable_episodes_not_perfect = [] + for upgradable_episode in upgradable_episodes: + try: + int(upgradable_episode[2]) + except ValueError: + pass + else: + if int(upgradable_episode[2]) < 360: + upgradable_episodes_not_perfect.append(upgradable_episode) + c.close() + data = reversed(sorted(data, key=operator.itemgetter(4))) + return template('historyseries', bazarr_version=bazarr_version, rows=data, row_count=row_count, page=page, max_page=max_page, stats=stats, base_url=base_url, page_size=page_size, - current_port=settings.general.port) + current_port=settings.general.port, upgradable_episodes=upgradable_episodes_not_perfect) @route(base_url + 'historymovies') @@ -982,7 +1026,7 @@ def historymovies(): today = [] thisweek = [] thisyear = [] - stats = c.execute("SELECT timestamp FROM table_history_movie WHERE action LIKE '1'").fetchall() + stats = c.execute("SELECT timestamp FROM table_history_movie WHERE action > 0").fetchall() total = len(stats) for stat in stats: if now - timedelta(hours=24) <= datetime.fromtimestamp(stat[0]) <= now: @@ -994,14 +1038,42 @@ def historymovies(): stats = [len(today), len(thisweek), len(thisyear), total] c.execute( - "SELECT table_history_movie.action, table_movies.title, table_history_movie.timestamp, table_history_movie.description, table_history_movie.radarrId FROM table_history_movie LEFT JOIN table_movies on table_movies.radarrId = table_history_movie.radarrId ORDER BY id DESC LIMIT ? OFFSET ?", + "SELECT table_history_movie.action, table_movies.title, table_history_movie.timestamp, table_history_movie.description, table_history_movie.radarrId, table_history_movie.video_path, table_movies.languages, table_history_movie.language, table_history_movie.score FROM table_history_movie LEFT JOIN table_movies on table_movies.radarrId = table_history_movie.radarrId ORDER BY id DESC LIMIT ? OFFSET ?", (page_size, offset,)) data = c.fetchall() + + upgradable_movies = [] + if settings.general.getboolean('upgrade_subs'): + days_to_upgrade_subs = settings.general.days_to_upgrade_subs + minimum_timestamp = ((datetime.now() - timedelta(days=int(days_to_upgrade_subs))) - + datetime(1970, 1, 1)).total_seconds() + + if settings.general.getboolean('upgrade_manual'): + query_actions = [1, 2, 3] + else: + query_actions = [1, 3] + + upgradable_movies = c.execute("""SELECT video_path, MAX(timestamp), score + FROM table_history_movie + WHERE action IN (""" + ','.join(map(str, query_actions)) + """) AND + timestamp > ? AND score is not null + GROUP BY video_path, language""", + (minimum_timestamp,)).fetchall() + upgradable_movies_not_perfect = [] + for upgradable_movie in upgradable_movies: + try: + int(upgradable_movie[2]) + except ValueError: + pass + else: + if int(upgradable_movie[2]) < 120: + upgradable_movies_not_perfect.append(upgradable_movie) + c.close() data = reversed(sorted(data, key=operator.itemgetter(2))) return template('historymovies', bazarr_version=bazarr_version, rows=data, row_count=row_count, page=page, max_page=max_page, stats=stats, base_url=base_url, page_size=page_size, - current_port=settings.general.port) + current_port=settings.general.port, upgradable_movies=upgradable_movies_not_perfect) @route(base_url + 'wanted') @@ -1187,7 +1259,18 @@ def save_settings(): settings_page_size = request.forms.get('settings_page_size') settings_subfolder = request.forms.get('settings_subfolder') settings_subfolder_custom = request.forms.get('settings_subfolder_custom') - + settings_upgrade_subs = request.forms.get('settings_upgrade_subs') + if settings_upgrade_subs is None: + settings_upgrade_subs = 'False' + else: + settings_upgrade_subs = 'True' + settings_days_to_upgrade_subs = request.forms.get('settings_days_to_upgrade_subs') + settings_upgrade_manual = request.forms.get('settings_upgrade_manual') + if settings_upgrade_manual is None: + settings_upgrade_manual = 'False' + else: + settings_upgrade_manual = 'True' + before = (unicode(settings.general.ip), int(settings.general.port), unicode(settings.general.base_url), unicode(settings.general.path_mappings), unicode(settings.general.getboolean('use_sonarr')), unicode(settings.general.getboolean('use_radarr')), unicode(settings.general.path_mappings_movie)) @@ -1214,6 +1297,9 @@ def save_settings(): settings.general.page_size = text_type(settings_page_size) settings.general.subfolder = text_type(settings_subfolder) settings.general.subfolder_custom = text_type(settings_subfolder_custom) + settings.general.upgrade_subs = text_type(settings_upgrade_subs) + settings.general.days_to_upgrade_subs = text_type(settings_days_to_upgrade_subs) + settings.general.upgrade_manual = text_type(settings_upgrade_manual) settings.general.minimum_score_movie = text_type(settings_general_minimum_score_movies) settings.general.use_embedded_subs = text_type(settings_general_embedded) settings.general.adaptive_searching = text_type(settings_general_adaptive_searching) @@ -1556,6 +1642,8 @@ def system(): elif job.trigger.__str__().startswith('cron'): task_list.append([job.name, get_time_from_cron(job.trigger.fields), next_run, job.id]) + throttled_providers = list_throttled_providers() + i = 0 with open(os.path.join(args.config_dir, 'log', 'bazarr.log')) as f: for i, l in enumerate(f, 1): @@ -1592,7 +1680,7 @@ def system(): operating_system=platform.platform(), python_version=platform.python_version(), config_dir=args.config_dir, bazarr_dir=os.path.normcase(os.getcwd()), base_url=base_url, task_list=task_list, row_count=row_count, max_page=max_page, page_size=page_size, - releases=releases, current_port=settings.general.port) + releases=releases, current_port=settings.general.port, throttled_providers=throttled_providers) @route(base_url + 'logs/') @@ -1743,7 +1831,7 @@ def manual_get_subtitle(): language_code = result[2] provider = result[3] score = result[4] - history_log(1, sonarrSeriesId, sonarrEpisodeId, message, path, language_code, provider, score) + history_log(2, sonarrSeriesId, sonarrEpisodeId, message, path, language_code, provider, score) send_notifications(sonarrSeriesId, sonarrEpisodeId, message) store_subtitles(unicode(episodePath)) list_missing_subtitles(sonarrSeriesId) @@ -1832,7 +1920,7 @@ def manual_get_subtitle_movie(): language_code = result[2] provider = result[3] score = result[4] - history_log_movie(1, radarrId, message, path, language_code, provider, score) + history_log_movie(2, radarrId, message, path, language_code, provider, score) send_notifications_movie(radarrId, message) store_subtitles_movie(unicode(moviePath)) list_missing_subtitles_movies(radarrId) diff --git a/bazarr/scheduler.py b/bazarr/scheduler.py index bc2cff442..1cd9bb52a 100644 --- a/bazarr/scheduler.py +++ b/bazarr/scheduler.py @@ -4,7 +4,7 @@ from get_episodes import sync_episodes, update_all_episodes, update_all_movies from get_movies import update_movies from get_series import update_series from config import settings -from get_subtitle import wanted_search_missing_subtitles +from get_subtitle import wanted_search_missing_subtitles, upgrade_subtitles from get_args import args if not args.no_update: @@ -109,6 +109,10 @@ if settings.general.getboolean('use_sonarr') or settings.general.getboolean('use scheduler.add_job(wanted_search_missing_subtitles, IntervalTrigger(hours=3), max_instances=1, coalesce=True, misfire_grace_time=15, id='wanted_search_missing_subtitles', name='Search for wanted subtitles') +if settings.general.getboolean('upgrade_subs'): + scheduler.add_job(upgrade_subtitles, IntervalTrigger(hours=12), max_instances=1, coalesce=True, + misfire_grace_time=15, id='upgrade_subtitles', name='Upgrade previously downloaded subtitles') + sonarr_full_update() radarr_full_update() scheduler.start() diff --git a/views/episodes.tpl b/views/episodes.tpl index 586e36dec..e8c85f7bc 100644 --- a/views/episodes.tpl +++ b/views/episodes.tpl @@ -467,6 +467,9 @@ hi = $(this).attr("data-hi"); sonarrSeriesId = $(this).attr("data-sonarrSeriesId"); sonarrEpisodeId = $(this).attr("data-sonarrEpisodeId"); + var languages = Array.from({{!subs_languages_list}}); + var is_pb = languages.includes('pb'); + var is_pt = languages.includes('pt'); const values = { episodePath: episodePath, @@ -505,7 +508,15 @@ return data +'%'; } }, - { data: 'language' }, + { data: null, + render: function ( data, type, row ) { + if ( data.language === "pt" && is_pb === true && is_pt === false) { + return 'pb' + } else { + return data.language + } + } + }, { data: 'hearing_impaired' }, { data: null, render: function ( data, type, row ) { diff --git a/views/historymovies.tpl b/views/historymovies.tpl index baad469e4..28459c629 100644 --- a/views/historymovies.tpl +++ b/views/historymovies.tpl @@ -52,6 +52,7 @@ + %import ast %import time %import pretty %for row in rows: @@ -65,6 +66,14 @@
+ %elif row[0] == 2: +
+ +
+ %elif row[0] == 3: +
+ +
%end @@ -75,7 +84,20 @@ {{pretty.date(int(row[2]))}} - {{row[3]}} + + % upgradable_criteria = (row[5], row[2], row[8]) + % if upgradable_criteria in upgradable_movies: + % if row[7] in ast.literal_eval(str(row[6])): +
+ {{row[3]}} +
+ % else: + {{row[3]}} + % end + % else: + {{row[3]}} + %end + %end @@ -174,7 +196,7 @@ sessionStorage.clear(); } - $('a, i').on('click', function(){ + $('a').on('click', function(){ sessionStorage.scrolly=$(window).scrollTop(); $('#loader').addClass('active'); diff --git a/views/historyseries.tpl b/views/historyseries.tpl index f29fea046..a58c3d4b0 100644 --- a/views/historyseries.tpl +++ b/views/historyseries.tpl @@ -54,6 +54,7 @@ + %import ast %import time %import pretty %for row in rows: @@ -67,6 +68,14 @@
+ %elif row[0] == 2: +
+ +
+ %elif row[0] == 3: +
+ +
%end @@ -90,7 +99,20 @@ {{pretty.date(int(row[4]))}} - {{row[5]}} + + % upgradable_criteria = (row[7], row[4], row[10]) + % if upgradable_criteria in upgradable_episodes: + % if row[9] in ast.literal_eval(str(row[8])): +
+ {{row[5]}} +
+ % else: + {{row[5]}} + % end + % else: + {{row[5]}} + %end + %end @@ -189,7 +211,7 @@ sessionStorage.clear(); } - $('a, i').on('click', function(){ + $('a').on('click', function(){ sessionStorage.scrolly=$(window).scrollTop(); $('#loader').addClass('active'); diff --git a/views/menu.tpl b/views/menu.tpl index 9bea9b648..4dfdc9f1b 100644 --- a/views/menu.tpl +++ b/views/menu.tpl @@ -25,7 +25,11 @@ % from get_args import args + % from get_providers import update_throttled_provider + % update_throttled_provider() + % import ast + % import datetime % import os % import sqlite3 % from config import settings @@ -46,7 +50,8 @@ % c = conn.cursor() % wanted_series = c.execute("SELECT COUNT(*) FROM table_episodes WHERE missing_subtitles != '[]'" + monitored_only_query_string_sonarr).fetchone() % wanted_movies = c.execute("SELECT COUNT(*) FROM table_movies WHERE missing_subtitles != '[]'" + monitored_only_query_string_radarr).fetchone() - + % from get_providers import list_throttled_providers + % throttled_providers_count = len(eval(str(settings.general.throtteled_providers)))
+
+
+ + + + + + + + + + %for provider in throttled_providers: + + + + + + %end + +
NameStatusNext retry
{{provider[0]}}{{provider[1] if provider[1] is not None else "Good"}}{{provider[2] if provider[2] is not "now" else "-"}}
+
+
About