From faecbbfa098ec3f8d3e75aaf9c3c9ddbb3590cf1 Mon Sep 17 00:00:00 2001 From: morpheus65535 <5130500+morpheus65535@users.noreply.github.com> Date: Wed, 8 Aug 2018 23:43:13 -0400 Subject: [PATCH] Implement only monitored feature for episodes and movies #70 --- bazarr.py | 31 ++++++++++++++++++++++-------- get_episodes.py | 6 +++--- get_general_settings.py | 12 +++++++----- get_movies.py | 6 +++--- get_subtitle.py | 40 +++++++++++++++++++++++++-------------- list_subtitles.py | 4 ++-- update_db.py | 42 +++++++++++++++++++++++++++++++++++++---- views/episodes.tpl | 8 ++++++++ views/menu.tpl | 13 ++++++++++--- views/movie.tpl | 9 ++++++++- views/movies.tpl | 8 ++++++++ views/settings.tpl | 29 ++++++++++++++++++++++++++-- views/wanted.tpl | 13 ++++++++++--- 13 files changed, 173 insertions(+), 48 deletions(-) diff --git a/bazarr.py b/bazarr.py index a75038752..55ef2184a 100644 --- a/bazarr.py +++ b/bazarr.py @@ -372,7 +372,7 @@ def episodes(no): series_details = c.execute("SELECT title, overview, poster, fanart, hearing_impaired, tvdbid, audio_language, languages, path_substitution(path) FROM table_shows WHERE sonarrSeriesId LIKE ?", (str(no),)).fetchone() tvdbid = series_details[5] - episodes = c.execute("SELECT title, path_substitution(path), season, episode, subtitles, sonarrSeriesId, missing_subtitles, sonarrEpisodeId, scene_name FROM table_episodes WHERE sonarrSeriesId LIKE ? ORDER BY episode ASC", (str(no),)).fetchall() + episodes = c.execute("SELECT title, path_substitution(path), season, episode, subtitles, sonarrSeriesId, missing_subtitles, sonarrEpisodeId, scene_name, monitored FROM table_episodes WHERE sonarrSeriesId LIKE ? ORDER BY episode ASC", (str(no),)).fetchall() number = len(episodes) languages = c.execute("SELECT code2, name FROM table_settings_languages WHERE enabled = 1").fetchall() c.close() @@ -403,7 +403,7 @@ def movies(): offset = (int(page) - 1) * page_size 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 FROM table_movies ORDER BY title ASC LIMIT ? OFFSET ?", (page_size, offset,)) + c.execute("SELECT tmdbId, title, path_substitution(path), languages, hearing_impaired, radarrId, poster, audio_language, monitored FROM table_movies ORDER BY title ASC LIMIT ? OFFSET ?", (page_size, offset,)) data = c.fetchall() c.execute("SELECT code2, name FROM table_settings_languages WHERE enabled = 1") languages = c.fetchall() @@ -506,7 +506,7 @@ def movie(no): c = conn.cursor() 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 FROM table_movies WHERE radarrId LIKE ?", (str(no),)).fetchone() + movies_details = c.execute("SELECT title, overview, poster, fanart, hearing_impaired, tmdbid, audio_language, languages, path_substitution(path), subtitles, radarrId, missing_subtitles, sceneName, monitored FROM table_movies WHERE radarrId LIKE ?", (str(no),)).fetchone() tmdbid = movies_details[5] languages = c.execute("SELECT code2, name FROM table_settings_languages WHERE enabled = 1").fetchall() @@ -641,7 +641,12 @@ def wantedseries(): db.create_function("path_substitution", 1, path_replace) c = db.cursor() - c.execute("SELECT COUNT(*) FROM table_episodes WHERE missing_subtitles != '[]'") + if get_general_settings()[24] == "True": + monitored_only_query_string = ' AND monitored = "True"' + else: + monitored_only_query_string = "" + + c.execute("SELECT COUNT(*) FROM table_episodes WHERE missing_subtitles != '[]'" + monitored_only_query_string) missing_count = c.fetchone() missing_count = missing_count[0] page = request.GET.page @@ -651,7 +656,7 @@ def wantedseries(): offset = (int(page) - 1) * page_size max_page = int(math.ceil(missing_count / (page_size + 0.0))) - c.execute("SELECT table_shows.title, table_episodes.season || 'x' || table_episodes.episode, table_episodes.title, table_episodes.missing_subtitles, table_episodes.sonarrSeriesId, path_substitution(table_episodes.path), table_shows.hearing_impaired, table_episodes.sonarrEpisodeId, table_episodes.scene_name FROM table_episodes INNER JOIN table_shows on table_shows.sonarrSeriesId = table_episodes.sonarrSeriesId WHERE table_episodes.missing_subtitles != '[]' ORDER BY table_episodes._rowid_ DESC LIMIT ? OFFSET ?", (page_size, offset,)) + c.execute("SELECT table_shows.title, table_episodes.season || 'x' || table_episodes.episode, table_episodes.title, table_episodes.missing_subtitles, table_episodes.sonarrSeriesId, path_substitution(table_episodes.path), table_shows.hearing_impaired, table_episodes.sonarrEpisodeId, table_episodes.scene_name FROM table_episodes INNER JOIN table_shows on table_shows.sonarrSeriesId = table_episodes.sonarrSeriesId WHERE table_episodes.missing_subtitles != '[]'" + monitored_only_query_string + " ORDER BY table_episodes._rowid_ DESC LIMIT ? OFFSET ?", (page_size, offset,)) data = c.fetchall() c.close() return template('wantedseries', __file__=__file__, bazarr_version=bazarr_version, rows=data, missing_count=missing_count, page=page, max_page=max_page, base_url=base_url, page_size=page_size) @@ -663,7 +668,12 @@ def wantedmovies(): db.create_function("path_substitution", 1, path_replace_movie) c = db.cursor() - c.execute("SELECT COUNT(*) FROM table_movies WHERE missing_subtitles != '[]'") + if get_general_settings()[24] == "True": + monitored_only_query_string = ' AND monitored = "True"' + else: + monitored_only_query_string = "" + + c.execute("SELECT COUNT(*) FROM table_movies WHERE missing_subtitles != '[]'" + monitored_only_query_string) missing_count = c.fetchone() missing_count = missing_count[0] page = request.GET.page @@ -673,7 +683,7 @@ def wantedmovies(): offset = (int(page) - 1) * page_size max_page = int(math.ceil(missing_count / (page_size + 0.0))) - c.execute("SELECT title, missing_subtitles, radarrId, path_substitution(path), hearing_impaired, sceneName FROM table_movies WHERE missing_subtitles != '[]' ORDER BY _rowid_ DESC LIMIT ? OFFSET ?", (page_size, offset,)) + c.execute("SELECT title, missing_subtitles, radarrId, path_substitution(path), hearing_impaired, sceneName FROM table_movies WHERE missing_subtitles != '[]'" + monitored_only_query_string + " ORDER BY _rowid_ DESC LIMIT ? OFFSET ?", (page_size, offset,)) data = c.fetchall() c.close() return template('wantedmovies', __file__=__file__, bazarr_version=bazarr_version, rows=data, missing_count=missing_count, page=page, max_page=max_page, base_url=base_url, page_size=page_size) @@ -757,6 +767,11 @@ def save_settings(): settings_general_embedded = 'False' else: settings_general_embedded = 'True' + settings_general_only_monitored = request.forms.get('settings_general_only_monitored') + if settings_general_only_monitored is None: + settings_general_only_monitored = 'False' + else: + settings_general_only_monitored = 'True' settings_general_minimum_score = request.forms.get('settings_general_minimum_score') settings_general_minimum_score_movies = request.forms.get('settings_general_minimum_score_movies') settings_general_use_postprocessing = request.forms.get('settings_general_use_postprocessing') @@ -779,7 +794,7 @@ def save_settings(): before = c.execute("SELECT ip, port, base_url, log_level, path_mapping, use_sonarr, use_radarr, path_mapping_movie FROM table_settings_general").fetchone() after = (unicode(settings_general_ip), int(settings_general_port), unicode(settings_general_baseurl), unicode(settings_general_loglevel), unicode(settings_general_pathmapping), unicode(settings_general_use_sonarr), unicode(settings_general_use_radarr), unicode(settings_general_pathmapping_movie)) - c.execute("UPDATE table_settings_general SET ip = ?, port = ?, base_url = ?, path_mapping = ?, log_level = ?, branch=?, auto_update=?, single_language=?, minimum_score=?, use_scenename=?, use_postprocessing=?, postprocessing_cmd=?, use_sonarr=?, use_radarr=?, path_mapping_movie=?, page_size=?, use_embedded_subs=?, minimum_score_movie=?", (unicode(settings_general_ip), int(settings_general_port), unicode(settings_general_baseurl), unicode(settings_general_pathmapping), unicode(settings_general_loglevel), unicode(settings_general_branch), unicode(settings_general_automatic), unicode(settings_general_single_language), unicode(settings_general_minimum_score), unicode(settings_general_scenename), unicode(settings_general_use_postprocessing), unicode(settings_general_postprocessing_cmd), unicode(settings_general_use_sonarr), unicode(settings_general_use_radarr), unicode(settings_general_pathmapping_movie), unicode(settings_page_size), unicode(settings_general_embedded), unicode(settings_general_minimum_score_movies))) + c.execute("UPDATE table_settings_general SET ip = ?, port = ?, base_url = ?, path_mapping = ?, log_level = ?, branch=?, auto_update=?, single_language=?, minimum_score=?, use_scenename=?, use_postprocessing=?, postprocessing_cmd=?, use_sonarr=?, use_radarr=?, path_mapping_movie=?, page_size=?, use_embedded_subs=?, minimum_score_movie=?, only_monitored=?", (unicode(settings_general_ip), int(settings_general_port), unicode(settings_general_baseurl), unicode(settings_general_pathmapping), unicode(settings_general_loglevel), unicode(settings_general_branch), unicode(settings_general_automatic), unicode(settings_general_single_language), unicode(settings_general_minimum_score), unicode(settings_general_scenename), unicode(settings_general_use_postprocessing), unicode(settings_general_postprocessing_cmd), unicode(settings_general_use_sonarr), unicode(settings_general_use_radarr), unicode(settings_general_pathmapping_movie), unicode(settings_page_size), unicode(settings_general_embedded), unicode(settings_general_minimum_score_movies), unicode(settings_general_only_monitored))) conn.commit() if after != before: configured() diff --git a/get_episodes.py b/get_episodes.py index b42a0ad1d..920f0a483 100644 --- a/get_episodes.py +++ b/get_episodes.py @@ -28,7 +28,7 @@ def sync_episodes(): c = db.cursor() # Get current episodes id in DB - current_episodes_db = c.execute('SELECT sonarrSeriesId, sonarrEpisodeId, title, path, season, episode, scene_name FROM table_episodes').fetchall() + current_episodes_db = c.execute('SELECT sonarrSeriesId, sonarrEpisodeId, title, path, season, episode, scene_name, monitored FROM table_episodes').fetchall() # Get sonarrId for each series from database current_episodes_sonarr = [] @@ -58,7 +58,7 @@ def sync_episodes(): sceneName = episode['episodeFile']['sceneName'] else: sceneName = None - current_episodes_sonarr.append((episode['seriesId'], episode['id'], episode['title'], episode['episodeFile']['path'], episode['seasonNumber'], episode['episodeNumber'], sceneName)) + current_episodes_sonarr.append((episode['seriesId'], episode['id'], episode['title'], episode['episodeFile']['path'], episode['seasonNumber'], episode['episodeNumber'], sceneName, str(bool(episode['monitored'])))) added_episodes = list(set(current_episodes_sonarr) - set(current_episodes_db)) removed_episodes = list(set(current_episodes_db) - set(current_episodes_sonarr)) @@ -69,7 +69,7 @@ def sync_episodes(): for added_episode in added_episodes: try: - c.execute('''INSERT INTO table_episodes(sonarrSeriesId, sonarrEpisodeId, title, path, season, episode, scene_name) VALUES (?, ?, ?, ?, ?, ?, ?)''', added_episode) + c.execute('''INSERT INTO table_episodes(sonarrSeriesId, sonarrEpisodeId, title, path, season, episode, scene_name, monitored) VALUES (?, ?, ?, ?, ?, ?, ?, ?)''', added_episode) except sqlite3.IntegrityError as e: logging.exception("You're probably an early adopter of Bazarr and this is a known issue. Please open an issue on Github and we'll fix this.") else: diff --git a/get_general_settings.py b/get_general_settings.py index 3794c6d6f..619234237 100644 --- a/get_general_settings.py +++ b/get_general_settings.py @@ -50,10 +50,11 @@ def get_general_settings(): movie_default_language = general_settings[21] movie_default_hi = general_settings[22] page_size = general_settings[23] - use_embedded_subs = general_settings[24] - minimum_score_movie = general_settings[25] + minimum_score_movie = general_settings[24] + use_embedded_subs = general_settings[25] + only_monitored = general_settings[26] - return [ip, port, base_url, path_mappings, log_level, branch, automatic, single_language, minimum_score, use_scenename, use_postprocessing, postprocessing_cmd, use_sonarr, use_radarr, path_mappings_movie, serie_default_enabled, serie_default_language, serie_default_hi, movie_default_enabled,movie_default_language, movie_default_hi, page_size, use_embedded_subs, minimum_score_movie] + return [ip, port, base_url, path_mappings, log_level, branch, automatic, single_language, minimum_score, use_scenename, use_postprocessing, postprocessing_cmd, use_sonarr, use_radarr, path_mappings_movie, serie_default_enabled, serie_default_language, serie_default_hi, movie_default_enabled,movie_default_language, movie_default_hi, page_size, minimum_score_movie, use_embedded_subs, only_monitored] def path_replace(path): for path_mapping in path_mappings: @@ -132,5 +133,6 @@ movie_default_enabled = result[18] movie_default_language = result[19] movie_default_hi = result[20] page_size = result[21] -use_embedded_subs = result[22] -minimum_score_movie = result[23] \ No newline at end of file +minimum_score_movie = result[22] +use_embedded_subs = result[23] +only_monitored = result[24] \ No newline at end of file diff --git a/get_movies.py b/get_movies.py index 7ebafa5b5..62d5f3c04 100644 --- a/get_movies.py +++ b/get_movies.py @@ -79,11 +79,11 @@ def update_movies(): # Update or insert movies list in database table try: if movie_default_enabled == 'True': - c.execute('''INSERT INTO table_movies(title, path, tmdbId, languages,`hearing_impaired`, radarrId, overview, poster, fanart, `audio_language`, sceneName) VALUES (?,?,?,?,?, ?, ?, ?, ?, ?, ?)''', (movie["title"], movie["path"] + separator + movie['movieFile']['relativePath'], movie["tmdbId"], movie_default_language, movie_default_hi, movie["id"], overview, poster, fanart, profile_id_to_language(movie['qualityProfileId']), sceneName)) + c.execute('''INSERT INTO table_movies(title, path, tmdbId, languages,`hearing_impaired`, radarrId, overview, poster, fanart, `audio_language`, sceneName, monitored) VALUES (?,?,?,?,?, ?, ?, ?, ?, ?, ?, ?)''', (movie["title"], movie["path"] + separator + movie['movieFile']['relativePath'], movie["tmdbId"], movie_default_language, movie_default_hi, movie["id"], overview, poster, fanart, profile_id_to_language(movie['qualityProfileId']), sceneName, unicode(bool(movie['monitored'])))) else: - c.execute('''INSERT INTO table_movies(title, path, tmdbId, languages,`hearing_impaired`, radarrId, overview, poster, fanart, `audio_language`, sceneName) VALUES (?,?,?,(SELECT languages FROM table_movies WHERE tmdbId = ?),(SELECT `hearing_impaired` FROM table_movies WHERE tmdbId = ?), ?, ?, ?, ?, ?, ?)''', (movie["title"], movie["path"] + separator + movie['movieFile']['relativePath'], movie["tmdbId"], movie["tmdbId"], movie["tmdbId"], movie["id"], overview, poster, fanart, profile_id_to_language(movie['qualityProfileId']), sceneName)) + c.execute('''INSERT INTO table_movies(title, path, tmdbId, languages,`hearing_impaired`, radarrId, overview, poster, fanart, `audio_language`, sceneName, monitored) VALUES (?,?,?,(SELECT languages FROM table_movies WHERE tmdbId = ?),(SELECT `hearing_impaired` FROM table_movies WHERE tmdbId = ?), ?, ?, ?, ?, ?, ?, ?)''', (movie["title"], movie["path"] + separator + movie['movieFile']['relativePath'], movie["tmdbId"], movie["tmdbId"], movie["tmdbId"], movie["id"], overview, poster, fanart, profile_id_to_language(movie['qualityProfileId']), sceneName, unicode(bool(movie['monitored'])))) except: - c.execute('''UPDATE table_movies SET title = ?, path = ?, tmdbId = ?, radarrId = ?, overview = ?, poster = ?, fanart = ?, `audio_language` = ?, sceneName = ? WHERE tmdbid = ?''', (movie["title"],movie["path"] + separator + movie['movieFile']['relativePath'],movie["tmdbId"],movie["id"],overview,poster,fanart,profile_id_to_language(movie['qualityProfileId']),sceneName,movie["tmdbId"])) + c.execute('''UPDATE table_movies SET title = ?, path = ?, tmdbId = ?, radarrId = ?, overview = ?, poster = ?, fanart = ?, `audio_language` = ?, sceneName = ?, monitored = ? WHERE tmdbid = ?''', (movie["title"],movie["path"] + separator + movie['movieFile']['relativePath'],movie["tmdbId"],movie["id"],overview,poster,fanart,profile_id_to_language(movie['qualityProfileId']),sceneName,unicode(bool(movie['monitored'])),movie["tmdbId"])) # Commit changes to database table db.commit() diff --git a/get_subtitle.py b/get_subtitle.py index 6bca5a1af..531de4237 100644 --- a/get_subtitle.py +++ b/get_subtitle.py @@ -21,7 +21,7 @@ def download_subtitle(path, language, hi, providers, providers_auth, sceneName, minimum_score = float(get_general_settings()[8]) / 100 * type_of_score elif type == 'movies': type_of_score = 119 - minimum_score = float(get_general_settings()[23]) / 100 * type_of_score + minimum_score = float(get_general_settings()[22]) / 100 * type_of_score use_scenename = get_general_settings()[9] use_postprocessing = get_general_settings()[10] postprocessing_cmd = get_general_settings()[11] @@ -107,9 +107,14 @@ def download_subtitle(path, language, hi, providers, providers_auth, sceneName, return message def series_download_subtitles(no): + if get_general_settings()[24] == "True": + monitored_only_query_string = ' AND monitored = "True"' + else: + monitored_only_query_string = "" + conn_db = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'), timeout=30) c_db = conn_db.cursor() - episodes_details = c_db.execute("SELECT path, missing_subtitles, sonarrEpisodeId, scene_name FROM table_episodes WHERE sonarrSeriesId = ?", (no,)).fetchall() + 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 FROM table_shows WHERE sonarrSeriesId = ?", (no,)).fetchone() enabled_providers = c_db.execute("SELECT * FROM table_settings_providers WHERE enabled = 1").fetchall() c_db.close() @@ -133,11 +138,12 @@ def series_download_subtitles(no): for episode in episodes_details: for language in ast.literal_eval(episode[1]): - message = download_subtitle(path_replace(episode[0]), str(alpha3_from_alpha2(language)), series_details[0], providers_list, providers_auth, episode[3], 'series') - if message is not None: - store_subtitles(path_replace(episode[0])) - history_log(1, no, episode[2], message) - send_notifications(no, episode[2], message) + if language is not None: + message = download_subtitle(path_replace(episode[0]), str(alpha3_from_alpha2(language)), series_details[0], providers_list, providers_auth, episode[3], 'series') + if message is not None: + store_subtitles(path_replace(episode[0])) + history_log(1, no, episode[2], message) + send_notifications(no, episode[2], message) list_missing_subtitles(no) @@ -166,11 +172,12 @@ def movies_download_subtitles(no): providers_auth = None for language in ast.literal_eval(movie[1]): - message = download_subtitle(path_replace_movie(movie[0]), str(alpha3_from_alpha2(language)), movie[4], providers_list, providers_auth, movie[3], 'movies') - if message is not None: - store_subtitles_movie(path_replace_movie(movie[0])) - history_log_movie(1, no, message) - send_notifications_movie(no, message) + if language is not None: + message = download_subtitle(path_replace_movie(movie[0]), str(alpha3_from_alpha2(language)), movie[4], providers_list, providers_auth, movie[3], 'movies') + if message is not None: + store_subtitles_movie(path_replace_movie(movie[0])) + history_log_movie(1, no, message) + send_notifications_movie(no, message) list_missing_subtitles_movies(no) @@ -248,10 +255,15 @@ def wanted_search_missing_subtitles(): db.create_function("path_substitution_movie", 1, path_replace_movie) c = db.cursor() - c.execute("SELECT path_substitution(path) FROM table_episodes WHERE missing_subtitles != '[]'") + if get_general_settings()[24] == "True": + monitored_only_query_string = ' AND monitored = "True"' + else: + monitored_only_query_string = "" + + c.execute("SELECT path_substitution(path) FROM table_episodes WHERE missing_subtitles != '[]'" + monitored_only_query_string) episodes = c.fetchall() - c.execute("SELECT path_substitution_movie(path) FROM table_movies WHERE missing_subtitles != '[]'") + c.execute("SELECT path_substitution_movie(path) FROM table_movies WHERE missing_subtitles != '[]'" + monitored_only_query_string) movies = c.fetchall() c.close() diff --git a/list_subtitles.py b/list_subtitles.py index 6dc6f3766..3d094c91f 100644 --- a/list_subtitles.py +++ b/list_subtitles.py @@ -133,7 +133,7 @@ def list_missing_subtitles(*no): c_db.close() missing_subtitles_global = [] - use_embedded_subs = get_general_settings()[22] + use_embedded_subs = get_general_settings()[23] for episode_subtitles in episodes_subtitles: actual_subtitles_temp = [] actual_subtitles = [] @@ -180,7 +180,7 @@ def list_missing_subtitles_movies(*no): c_db.close() missing_subtitles_global = [] - use_embedded_subs = get_general_settings()[22] + use_embedded_subs = get_general_settings()[23] for movie_subtitles in movies_subtitles: actual_subtitles_temp = [] actual_subtitles = [] diff --git a/update_db.py b/update_db.py index 0608a35c6..3e5f45c3b 100644 --- a/update_db.py +++ b/update_db.py @@ -200,14 +200,48 @@ if os.path.exists(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db')) c.execute('alter table table_episodes add column "scene_name" TEXT') db.commit() except: - db.close() pass else: - db.close() from scheduler import execute_now from get_general_settings import get_general_settings integration = get_general_settings() if integration[12] == "True": - execute_now('update_all_episodes') + execute_now('sync_episodes') if integration[13] == "True": - execute_now('update_all_movies') \ No newline at end of file + execute_now('update_movies') + + + + try: + c.execute('alter table table_settings_general add column "only_monitored" "text"') + db.commit() + except: + pass + else: + c.execute('UPDATE table_settings_general SET only_monitored="False"') + + try: + c.execute('alter table table_episodes add column "monitored" TEXT') + db.commit() + except: + pass + else: + from scheduler import execute_now + from get_general_settings import get_general_settings + integration = get_general_settings() + if integration[12] == "True": + execute_now('sync_episodes') + + try: + c.execute('alter table table_movies add column "monitored" TEXT') + db.commit() + except: + pass + else: + from scheduler import execute_now + from get_general_settings import get_general_settings + integration = get_general_settings() + if integration[13] == "True": + execute_now('update_movies') + + db.close() \ No newline at end of file diff --git a/views/episodes.tpl b/views/episodes.tpl index 007c753d6..3b6be2437 100644 --- a/views/episodes.tpl +++ b/views/episodes.tpl @@ -148,6 +148,7 @@
Episode | Title | Existing subtitles | @@ -157,6 +158,13 @@||||||||
---|---|---|---|---|---|---|---|---|---|---|
+ %if episode[9] == "True": + + %else: + + %end + | {{episode[3]}} | {{episode[0]}} |
diff --git a/views/menu.tpl b/views/menu.tpl
index 84c572bdc..6c0662e79 100644
--- a/views/menu.tpl
+++ b/views/menu.tpl
@@ -23,11 +23,18 @@
% import os
% import sqlite3
+ % from get_general_settings import *
- % conn = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'), timeout=30)
+ %if get_general_settings()[24] == "True":
+ % monitored_only_query_string = ' AND monitored = "True"'
+ %else:
+ % monitored_only_query_string = ""
+ %end
+
+ % conn = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'), timeout=30)
% c = conn.cursor()
- % wanted_series = c.execute("SELECT COUNT(*) FROM table_episodes WHERE missing_subtitles != '[]'").fetchone()
- % wanted_movies = c.execute("SELECT COUNT(*) FROM table_movies WHERE missing_subtitles != '[]'").fetchone()
+ % wanted_series = c.execute("SELECT COUNT(*) FROM table_episodes WHERE missing_subtitles != '[]'" + monitored_only_query_string).fetchone()
+ % wanted_movies = c.execute("SELECT COUNT(*) FROM table_movies WHERE missing_subtitles != '[]'" + monitored_only_query_string).fetchone()
% integration = c.execute("SELECT use_sonarr, use_radarr FROM table_settings_general").fetchone()
{{details[0]}}++ %if details[13] == "True": + + %else: + + %end + {{details[0]}} +{{details[1]}}
{{details[6]}}
diff --git a/views/movies.tpl b/views/movies.tpl
index cd7110912..3a008f4b5 100644
--- a/views/movies.tpl
+++ b/views/movies.tpl
@@ -55,6 +55,7 @@
|
-