diff --git a/bazarr.py b/bazarr.py index 9b4bd1ca3..4d48d46dc 100644 --- a/bazarr.py +++ b/bazarr.py @@ -1,4 +1,4 @@ -bazarr_version = '0.4.5 dev' +bazarr_version = '0.5.0 dev' import gc gc.enable() @@ -339,24 +339,55 @@ def movies(): output = template('movies', __file__=__file__, bazarr_version=bazarr_version, rows=data, languages=languages, missing_count=missing_count, page=page, max_page=max_page, base_url=base_url, single_language=single_language) return output -@route(base_url + 'movie/', method='GET') -def movie(no): - from get_radarr_settings import get_radarr_settings +@route(base_url + 'movieseditor') +def movieseditor(): single_language = get_general_settings()[7] - url_radarr_short = get_radarr_settings()[1] + + db = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'), timeout=30) + db.create_function("path_substitution", 1, path_replace) + c = db.cursor() + + c.execute("SELECT COUNT(*) FROM table_movies") + missing_count = c.fetchone() + missing_count = missing_count[0] + + c.execute("SELECT tmdbId, title, path_substitution(path), languages, hearing_impaired, radarrId, poster, audio_language FROM table_movies ORDER BY title ASC") + data = c.fetchall() + c.execute("SELECT code2, name FROM table_settings_languages WHERE enabled = 1") + languages = c.fetchall() + c.close() + output = template('movieseditor', __file__=__file__, bazarr_version=bazarr_version, rows=data, languages=languages, missing_count=missing_count, base_url=base_url, single_language=single_language) + return output + +@route(base_url + 'edit_movieseditor', method='POST') +def edit_movieseditor(): + ref = request.environ['HTTP_REFERER'] + + movies = request.forms.get('movies') + movies = ast.literal_eval(str('[' + movies + ']')) + lang = request.forms.getall('languages') + hi = request.forms.get('hearing_impaired') conn = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'), timeout=30) - conn.create_function("path_substitution", 1, path_replace) c = conn.cursor() - movies_details = [] - movies_details = c.execute("SELECT title, overview, poster, fanart, hearing_impaired, tmdbid, audio_language, languages, path_substitution(path), subtitles FROM table_movies WHERE radarrId LIKE ?", (str(no),)).fetchone() - tmdbid = movies_details[5] + for movie in movies: + if str(lang) != "[]" and str(lang) != "['']": + if str(lang) == "['None']": + lang = 'None' + else: + lang = str(lang) + c.execute("UPDATE table_movies SET languages = ? WHERE radarrId LIKE ?", (lang, movie)) + if hi != '': + c.execute("UPDATE table_movies SET hearing_impaired = ? WHERE radarrId LIKE ?", (hi, movie)) - languages = c.execute("SELECT code2, name FROM table_settings_languages WHERE enabled = 1").fetchall() + conn.commit() c.close() - return template('movie', __file__=__file__, bazarr_version=bazarr_version, no=no, details=movies_details, languages=languages, url_radarr_short=url_radarr_short, base_url=base_url, tmdbid=tmdbid) + for movie in movies: + list_missing_subtitles_movies(movie) + + redirect(ref) @route(base_url + 'edit_movie/', method='POST') def edit_movie(no): @@ -388,6 +419,25 @@ def edit_movie(no): redirect(ref) +@route(base_url + 'movie/', method='GET') +def movie(no): + from get_radarr_settings import get_radarr_settings + single_language = get_general_settings()[7] + url_radarr_short = get_radarr_settings()[1] + + conn = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'), timeout=30) + conn.create_function("path_substitution", 1, path_replace) + 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() + tmdbid = movies_details[5] + + languages = c.execute("SELECT code2, name FROM table_settings_languages WHERE enabled = 1").fetchall() + c.close() + + return template('movie', __file__=__file__, bazarr_version=bazarr_version, no=no, details=movies_details, languages=languages, url_radarr_short=url_radarr_short, base_url=base_url, tmdbid=tmdbid) + @route(base_url + 'scan_disk/', method='GET') def scan_disk(no): ref = request.environ['HTTP_REFERER'] @@ -422,6 +472,10 @@ def search_missing_subtitles_movie(no): @route(base_url + 'history') def history(): + return template('history', __file__=__file__, bazarr_version=bazarr_version, base_url=base_url) + +@route(base_url + 'historyseries') +def historyseries(): db = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'), timeout=30) c = db.cursor() @@ -453,10 +507,49 @@ def history(): data = c.fetchall() c.close() data = reversed(sorted(data, key=operator.itemgetter(4))) - return template('history', __file__=__file__, bazarr_version=bazarr_version, rows=data, row_count=row_count, page=page, max_page=max_page, stats=stats, base_url=base_url) + return template('historyseries', __file__=__file__, bazarr_version=bazarr_version, rows=data, row_count=row_count, page=page, max_page=max_page, stats=stats, base_url=base_url) + +@route(base_url + 'historymovies') +def historymovies(): + db = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'), timeout=30) + c = db.cursor() + + c.execute("SELECT COUNT(*) FROM table_history_movie") + row_count = c.fetchone() + row_count = row_count[0] + page = request.GET.page + if page == "": + page = "1" + offset = (int(page) - 1) * 15 + max_page = int(math.ceil(row_count / 15.0)) + + now = datetime.now() + today = [] + thisweek = [] + thisyear = [] + stats = c.execute("SELECT timestamp FROM table_history_movie WHERE action LIKE '1'").fetchall() + total = len(stats) + for stat in stats: + if now - timedelta(hours=24) <= datetime.fromtimestamp(stat[0]) <= now: + today.append(datetime.fromtimestamp(stat[0]).date()) + if now - timedelta(weeks=1) <= datetime.fromtimestamp(stat[0]) <= now: + thisweek.append(datetime.fromtimestamp(stat[0]).date()) + if now - timedelta(weeks=52) <= datetime.fromtimestamp(stat[0]) <= now: + thisyear.append(datetime.fromtimestamp(stat[0]).date()) + 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 15 OFFSET ?", (offset,)) + data = c.fetchall() + c.close() + data = reversed(sorted(data, key=operator.itemgetter(2))) + return template('historymovies', __file__=__file__, bazarr_version=bazarr_version, rows=data, row_count=row_count, page=page, max_page=max_page, stats=stats, base_url=base_url) @route(base_url + 'wanted') def wanted(): + return template('wanted', __file__=__file__, bazarr_version=bazarr_version, base_url=base_url) + +@route(base_url + 'wantedseries') +def wantedseries(): db = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'), timeout=30) db.create_function("path_substitution", 1, path_replace) c = db.cursor() @@ -473,7 +566,27 @@ def wanted(): 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 15 OFFSET ?", (offset,)) data = c.fetchall() c.close() - return template('wanted', __file__=__file__, bazarr_version=bazarr_version, rows=data, missing_count=missing_count, page=page, max_page=max_page, base_url=base_url) + 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) + +@route(base_url + 'wantedmovies') +def wantedmovies(): + db = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'), timeout=30) + db.create_function("path_substitution", 1, path_replace) + c = db.cursor() + + c.execute("SELECT COUNT(*) FROM table_movies WHERE missing_subtitles != '[]'") + missing_count = c.fetchone() + missing_count = missing_count[0] + page = request.GET.page + if page == "": + page = "1" + offset = (int(page) - 1) * 15 + max_page = int(math.ceil(missing_count / 15.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 15 OFFSET ?", (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) @route(base_url + 'wanted_search_missing_subtitles') def wanted_search_missing_subtitles_list(): @@ -864,6 +977,7 @@ def execute_task(taskid): redirect(ref) + @route(base_url + 'remove_subtitles', method='POST') def remove_subtitles(): episodePath = request.forms.get('episodePath') @@ -871,7 +985,6 @@ def remove_subtitles(): subtitlesPath = request.forms.get('subtitlesPath') sonarrSeriesId = request.forms.get('sonarrSeriesId') sonarrEpisodeId = request.forms.get('sonarrEpisodeId') - tvdbid = request.forms.get('tvdbid') try: os.remove(subtitlesPath) @@ -882,6 +995,24 @@ def remove_subtitles(): store_subtitles(unicode(episodePath)) list_missing_subtitles(sonarrSeriesId) + +@route(base_url + 'remove_subtitles_movie', method='POST') +def remove_subtitles_movie(): + moviePath = request.forms.get('moviePath') + language = request.forms.get('language') + subtitlesPath = request.forms.get('subtitlesPath') + radarrId = request.forms.get('radarrId') + + try: + os.remove(subtitlesPath) + result = pycountry.languages.lookup(language).name + " subtitles deleted from disk." + history_log_movie(0, radarrId, result) + except OSError: + pass + store_subtitles_movie(unicode(moviePath)) + list_missing_subtitles_movies(radarrId) + + @route(base_url + 'get_subtitle', method='POST') def get_subtitle(): ref = request.environ['HTTP_REFERER'] @@ -918,7 +1049,7 @@ def get_subtitle(): providers_auth = None try: - result = download_subtitle(episodePath, language, hi, providers_list, providers_auth, sceneName) + result = download_subtitle(episodePath, language, hi, providers_list, providers_auth, sceneName, 'series') if result is not None: history_log(1, sonarrSeriesId, sonarrEpisodeId, result) send_notifications(sonarrSeriesId, sonarrEpisodeId, result) @@ -928,6 +1059,51 @@ def get_subtitle(): except OSError: pass +@route(base_url + 'get_subtitle_movie', method='POST') +def get_subtitle_movie(): + ref = request.environ['HTTP_REFERER'] + + moviePath = request.forms.get('moviePath') + sceneName = request.forms.get('sceneName') + language = request.forms.get('language') + hi = request.forms.get('hi') + radarrId = request.forms.get('radarrId') + tmdbid = request.forms.get('tmdbid') + + db = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'), timeout=30) + c = db.cursor() + c.execute("SELECT * FROM table_settings_providers WHERE enabled = 1") + enabled_providers = c.fetchall() + c.close() + + providers_list = [] + providers_auth = {} + if len(enabled_providers) > 0: + for provider in enabled_providers: + providers_list.append(provider[0]) + try: + if provider[2] is not '' and provider[3] is not '': + provider_auth = providers_auth.append(provider[0]) + provider_auth.update({'username':providers[2], 'password':providers[3]}) + else: + providers_auth = None + except: + providers_auth = None + else: + providers_list = None + providers_auth = None + + try: + result = download_subtitle(moviePath, language, hi, providers_list, providers_auth, sceneName, 'movies') + if result is not None: + history_log_movie(1, radarrId, result) + send_notifications_movie(radarrId, result) + store_subtitles_movie(unicode(moviePath)) + list_missing_subtitles_movies(radarrId) + redirect(ref) + except OSError: + pass + def configured(): conn = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'), timeout=30) c = conn.cursor() diff --git a/get_episodes.py b/get_episodes.py index bdac470f7..fa27f9b80 100644 --- a/get_episodes.py +++ b/get_episodes.py @@ -6,7 +6,7 @@ import logging from get_general_settings import * from list_subtitles import * -def update_all_episodes(): +def update_all_episodes_and_movies(): full_scan_subtitles() logging.info('All existing subtitles indexed from disk.') list_missing_subtitles() diff --git a/get_movies.py b/get_movies.py index b368b6a01..9b089387b 100644 --- a/get_movies.py +++ b/get_movies.py @@ -36,7 +36,7 @@ def update_movies(): overview = "" try: poster_big = movie['images'][0]['url'] - poster = os.path.splitext(poster_big)[0] + '-250' + os.path.splitext(poster_big)[1] + poster = os.path.splitext(poster_big)[0] + '-500' + os.path.splitext(poster_big)[1] except: poster = "" try: diff --git a/get_subtitle.py b/get_subtitle.py index b0144229d..1c09f3111 100644 --- a/get_subtitle.py +++ b/get_subtitle.py @@ -15,8 +15,12 @@ from notifier import send_notifications, send_notifications_movie # configure the cache region.configure('dogpile.cache.memory') -def download_subtitle(path, language, hi, providers, providers_auth, sceneName): - minimum_score = float(get_general_settings()[8]) / 100 * 359 +def download_subtitle(path, language, hi, providers, providers_auth, sceneName, type): + if type == 'series': + type_of_score = 359 + elif type == 'movies': + type_of_score = 119 + minimum_score = float(get_general_settings()[8]) / 100 * type_of_score use_scenename = get_general_settings()[9] use_postprocessing = get_general_settings()[10] postprocessing_cmd = get_general_settings()[11] @@ -45,7 +49,7 @@ def download_subtitle(path, language, hi, providers, providers_auth, sceneName): else: single = get_general_settings()[7] try: - score = round(float(compute_score(best_subtitle, video)) / 359 * 100, 2) + score = round(float(compute_score(best_subtitle, video)) / type_of_score * 100, 2) if used_sceneName == True: video = scan_video(path) if single == 'True': @@ -122,7 +126,7 @@ 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(pycountry.languages.lookup(language).alpha_3), series_details[0], providers_list, providers_auth, episode[3]) + message = download_subtitle(path_replace(episode[0]), str(pycountry.languages.lookup(language).alpha_3), 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) @@ -155,7 +159,7 @@ def movies_download_subtitles(no): providers_auth = None for language in ast.literal_eval(movie[1]): - message = download_subtitle(path_replace(movie[0]), str(pycountry.languages.lookup(language).alpha_3), movie[4], providers_list, providers_auth, movie[3]) + message = download_subtitle(path_replace(movie[0]), str(pycountry.languages.lookup(language).alpha_3), movie[4], providers_list, providers_auth, movie[3], 'movies') if message is not None: store_subtitles_movie(path_replace(movie[0])) history_log_movie(1, no, message) @@ -189,7 +193,7 @@ def wanted_download_subtitles(path): for episode in episodes_details: for language in ast.literal_eval(episode[1]): - message = download_subtitle(path_replace(episode[0]), str(pycountry.languages.lookup(language).alpha_3), episode[4], providers_list, providers_auth, episode[5]) + message = download_subtitle(path_replace(episode[0]), str(pycountry.languages.lookup(language).alpha_3), episode[4], providers_list, providers_auth, episode[5], 'series') if message is not None: store_subtitles(path_replace(episode[0])) list_missing_subtitles(episode[3]) @@ -201,11 +205,15 @@ def wanted_search_missing_subtitles(): db.create_function("path_substitution", 1, path_replace) c = db.cursor() - c.execute("SELECT path_substitution(path) FROM table_episodes WHERE table_episodes.missing_subtitles != '[]'") - data = c.fetchall() + c.execute("SELECT path_substitution(path) FROM table_episodes WHERE missing_subtitles != '[]'") + episodes = c.fetchall() + + c.execute("SELECT path_substitution(path) FROM table_movies WHERE missing_subtitles != '[]'") + movies = c.fetchall() + c.close() - for episode in data: + for episode in episodes: wanted_download_subtitles(episode[0]) - logging.info('Finished searching for missing subtitles. Check history for more information.') + logging.info('Finished searching for missing subtitles. Check histories for more information.') diff --git a/scheduler.py b/scheduler.py index 82ea1dcbd..9d7fc9ef6 100644 --- a/scheduler.py +++ b/scheduler.py @@ -2,6 +2,7 @@ from get_general_settings import * from get_sonarr_settings import get_sonarr_settings from get_series import * from get_episodes import * +from get_movies import * from list_subtitles import * from get_subtitle import * from check_update import * @@ -15,11 +16,11 @@ from tzlocal import get_localzone def sonarr_full_update(): full_update = get_sonarr_settings()[3] if full_update == "Daily": - scheduler.add_job(update_all_episodes, 'cron', hour=4, max_instances=1, coalesce=True, misfire_grace_time=15, id='update_all_episodes', name='Update all episodes from Sonarr', replace_existing=True) + scheduler.add_job(update_all_episodes_and_movies, 'cron', hour=4, max_instances=1, coalesce=True, misfire_grace_time=15, id='update_all_episodes_and_movies', name='Update all subtitles from disk', replace_existing=True) elif full_update == "Weekly": - scheduler.add_job(update_all_episodes, 'cron', day_of_week='sun', hour=4, max_instances=1, coalesce=True, misfire_grace_time=15, id='update_all_episodes', name='Update all episodes from Sonarr', replace_existing=True) + scheduler.add_job(update_all_episodes_and_movies, 'cron', day_of_week='sun', hour=4, max_instances=1, coalesce=True, misfire_grace_time=15, id='update_all_episodes_and_movies', name='Update all subtitles from disk', replace_existing=True) elif full_update == "Manually": - scheduler.add_job(update_all_episodes, 'cron', year='2100', hour=4, max_instances=1, coalesce=True, misfire_grace_time=15, id='update_all_episodes', name='Update all episodes from Sonarr', replace_existing=True) + scheduler.add_job(update_all_episodes_and_movies, 'cron', year='2100', hour=4, max_instances=1, coalesce=True, misfire_grace_time=15, id='update_all_episodes_and_movies', name='Update all subtitles from disk', replace_existing=True) def execute_now(taskid): scheduler.modify_job(taskid, jobstore=None, next_run_time=datetime.now()) @@ -36,6 +37,7 @@ else: scheduler.add_job(check_and_apply_update, 'cron', year='2100', hour=4, id='update_bazarr', name='Update bazarr from source on Github') scheduler.add_job(update_series, 'interval', minutes=1, max_instances=1, coalesce=True, misfire_grace_time=15, id='update_series', name='Update series list from Sonarr') scheduler.add_job(sync_episodes, 'interval', minutes=5, max_instances=1, coalesce=True, misfire_grace_time=15, id='sync_episodes', name='Sync episodes with Sonarr') +scheduler.add_job(update_movies, 'interval', minutes=1, max_instances=1, coalesce=True, misfire_grace_time=15, id='update_movies', name='Update movies list from Radarr') scheduler.add_job(wanted_search_missing_subtitles, 'interval', hours=3, max_instances=1, coalesce=True, misfire_grace_time=15, id='wanted_search_missing_subtitles', name='Search for wanted subtitles') sonarr_full_update() scheduler.start() \ No newline at end of file diff --git a/update_db.py b/update_db.py index 49e472483..7b3106250 100644 --- a/update_db.py +++ b/update_db.py @@ -107,7 +107,7 @@ if os.path.exists(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db')) pass else: from scheduler import execute_now - execute_now('update_all_episodes') + execute_now('update_all_episodes_and_movies') # Close database connection db.close() diff --git a/views/history.tpl b/views/history.tpl index de2435d2d..c20613bed 100644 --- a/views/history.tpl +++ b/views/history.tpl @@ -1,214 +1,109 @@ - - - - - - - - - - - - - - - - - - History - Bazarr - - - - -
-
Loading...
-
- % include('menu.tpl') - -
- - - - - - - - - - - - - %import time - %import pretty - %for row in rows: - - - - - - - - - %end - -
SeriesEpisodeEpisode TitleDateDescription
- %if row[0] == 0: -
- -
- %elif row[0] == 1: -
- -
- %end -
- {{row[1]}} - - %if row[2] is not None: - % episode = row[2].split('x') - {{episode[0] + 'x' + episode[1].zfill(2)}} - %end - - %if row[3] is not None: - {{row[3]}} - %else: - Deleted episode - %end - -
- {{pretty.date(int(row[4]))}} -
-
{{row[5]}}
-
-
-
-
- - - {{page}} / {{max_page}} - - -
-
Total records: {{row_count}}
-
-
-
- - - % include('footer.tpl') -



- - - - - + + + + + + + + + + + + + + History - Bazarr + + + + +
+
Loading...
+
+ % include('menu.tpl') + +
+ +
+
+
+
+
+
+
+
+
+
+
+ % include('footer.tpl') + + + + + \ No newline at end of file diff --git a/views/historymovies.tpl b/views/historymovies.tpl new file mode 100644 index 000000000..f92cba9ce --- /dev/null +++ b/views/historymovies.tpl @@ -0,0 +1,199 @@ + + + + + + + + + + + + + + + + + + History - Bazarr + + + + +
+
Loading...
+
+ +
+ + + + + + + + + + + %import time + %import pretty + %for row in rows: + + + + + + + %end + +
NameDateDescription
+ %if row[0] == 0: +
+ +
+ %elif row[0] == 1: +
+ +
+ %end +
+ {{row[1]}} + +
+ {{pretty.date(int(row[2]))}} +
+
{{row[3]}}
+
+
+
+
+ + + {{page}} / {{max_page}} + + +
+
Total records: {{row_count}}
+
+
+
+ + +



+ + + + + \ No newline at end of file diff --git a/views/historyseries.tpl b/views/historyseries.tpl new file mode 100644 index 000000000..7ab7e01ce --- /dev/null +++ b/views/historyseries.tpl @@ -0,0 +1,214 @@ + + + + + + + + + + + + + + + + + + History - Bazarr + + + + +
+
Loading...
+
+ +
+ + + + + + + + + + + + + %import time + %import pretty + %for row in rows: + + + + + + + + + %end + +
NameEpisodeEpisode TitleDateDescription
+ %if row[0] == 0: +
+ +
+ %elif row[0] == 1: +
+ +
+ %end +
+ {{row[1]}} + + %if row[2] is not None: + % episode = row[2].split('x') + {{episode[0] + 'x' + episode[1].zfill(2)}} + %end + + %if row[3] is not None: + {{row[3]}} + %else: + Deleted episode + %end + +
+ {{pretty.date(int(row[4]))}} +
+
{{row[5]}}
+
+
+
+
+ + + {{page}} / {{max_page}} + + +
+
Total records: {{row_count}}
+
+
+
+ + +



+ + + + + \ No newline at end of file diff --git a/views/menu.tpl b/views/menu.tpl index 370096f9e..b0754981f 100644 --- a/views/menu.tpl +++ b/views/menu.tpl @@ -26,7 +26,8 @@ % conn = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'), timeout=30) % c = conn.cursor() - % wanted = c.execute("SELECT COUNT(*) FROM table_episodes WHERE missing_subtitles != '[]'").fetchone() + % 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()
@@ -55,11 +56,12 @@ - % if wanted[0] > 0: -
- {{wanted[0]}} +
+ {{wanted_series[0]}} +
+
+ {{wanted_movies[0]}}
- % end
Wanted
diff --git a/views/movie.tpl b/views/movie.tpl index 40028e3a7..eb34e3941 100644 --- a/views/movie.tpl +++ b/views/movie.tpl @@ -47,6 +47,7 @@ padding-left: 2em; padding-right: 2em; padding-bottom: 1em; + text-color: black; } .ui.basic.button:hover, .ui.basic.buttons .button:hover { background: transparent !important; @@ -75,7 +76,7 @@
- +
@@ -104,19 +105,65 @@
-

Subtitles

- + + + + <% + subtitles_files = ast.literal_eval(str(details[9])) + if subtitles_files is not None: + for subtitles_file in subtitles_files: + %> - + + + + <% + end + if len(subtitles_files) == 0: + %> + + <% + end + end + %>
Existing subtitlesSubtitles pathLanguage
{{details[9]}}{{path_replace(subtitles_file[1]) if subtitles_file[1] is not None else 'Video file subtitles track'}}
{{pycountry.languages.lookup(str(subtitles_file[0])).name}}
+ %if subtitles_file[1] is not None: + + + + %end +
No subtitles detected for this movie.
+ <% + missing_subs_languages = ast.literal_eval(str(details[11])) + missing_subs_languages_list = [] + if missing_subs_languages is not None: + %> + + + + + + +
Missing subtitles
+ <% + for missing_subs_language in missing_subs_languages: + %> + + {{pycountry.languages.lookup(str(missing_subs_language)).name}} + + + <% + end + end + %>
@@ -192,15 +239,14 @@ $('.remove_subtitles').click(function(){ var values = { - episodePath: $(this).attr("data-episodePath"), + moviePath: $(this).attr("data-moviePath"), language: $(this).attr("data-language"), subtitlesPath: $(this).attr("data-subtitlesPath"), - sonarrmovieId: $(this).attr("data-sonarrmovieId"), - sonarrEpisodeId: $(this).attr("data-sonarrEpisodeId"), + radarrId: $(this).attr("data-radarrId"), tmdbid: {{tmdbid}} }; $.ajax({ - url: "{{base_url}}remove_subtitles", + url: "{{base_url}}remove_subtitles_movie", type: "POST", dataType: "json", data: values @@ -215,16 +261,15 @@ $('.get_subtitle').click(function(){ var values = { - episodePath: $(this).attr("data-episodePath"), + moviePath: $(this).attr("data-moviePath"), sceneName: $(this).attr("data-sceneName"), language: $(this).attr("data-language"), hi: $(this).attr("data-hi"), - sonarrmovieId: $(this).attr("data-sonarrmovieId"), - sonarrEpisodeId: $(this).attr("data-sonarrEpisodeId"), + radarrId: $(this).attr("data-radarrId"), tmdbid: {{tmdbid}} }; $.ajax({ - url: "{{base_url}}get_subtitle", + url: "{{base_url}}get_subtitle_movie", type: "POST", dataType: "json", data: values diff --git a/views/movieseditor.tpl b/views/movieseditor.tpl new file mode 100644 index 000000000..ab2bd5796 --- /dev/null +++ b/views/movieseditor.tpl @@ -0,0 +1,181 @@ + + + + + + + + + + + + + + + + + + Movies Editor - Bazarr + + + + +
+
Loading...
+
+ % include('menu.tpl') + +
+ + + + + + + + + + + + %import ast + %import os + %for row in rows: + + + + + + + + %end + +
+
+ + +
+
NameAudio languageSubtitles languagesHearing-impaired
+
+ + +
+
{{row[1]}}{{row[7]}} + %subs_languages = ast.literal_eval(str(row[3])) + %if subs_languages is not None: + %for subs_language in subs_languages: +
{{subs_language}}
+ %end + %end +
{{!"" if row[4] == None else row[4]}}
+
+ + + % include('footer.tpl') +



+ + + + + \ No newline at end of file diff --git a/views/series.tpl b/views/series.tpl index a391ad904..bb14fd43a 100644 --- a/views/series.tpl +++ b/views/series.tpl @@ -14,7 +14,7 @@ - Bazarr + Series - Bazarr - %import ast - %import pycountry + % import os + % import sqlite3 + + % 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() + % c.close() +
Loading...
% include('menu.tpl')
-
- + - - - - - - - - - - - %import time - %import pretty - %for row in rows: - - - - - - - %end - -
SeriesEpisodeEpisode TitleMissing subtitles
{{row[0]}} - <%episode = row[1].split('x')%> - {{episode[0] + 'x' + episode[1].zfill(2)}} - {{row[2]}} - %missing_languages = ast.literal_eval(row[3]) - %if missing_languages is not None: - %for language in missing_languages: - - {{language}} - - - %end - %end -
-
-
-
-
- - - {{page}} / {{max_page}} - - -
-
Total records: {{missing_count}}
+
+
+
+
+
+
+
+
@@ -122,44 +84,43 @@ \ No newline at end of file diff --git a/views/wantedmovies.tpl b/views/wantedmovies.tpl new file mode 100644 index 000000000..f83eb9b7a --- /dev/null +++ b/views/wantedmovies.tpl @@ -0,0 +1,160 @@ + + + + + + + + + + + + + + + + + + Wanted - Bazarr + + + + + %import ast + %import pycountry +
+
Loading...
+
+ +
+
+ +
+ + + + + + + + + %import time + %import pretty + %if len(rows) == 0: + + + + %end + %for row in rows: + + + + + %end + +
MoviesMissing subtitles
No missing movie subtitles.
{{row[0]}} + %missing_languages = ast.literal_eval(row[1]) + %if missing_languages is not None: + %for language in missing_languages: + + {{language}} + + + %end + %end +
+
+
+
+
+ + + {{page}} / {{max_page}} + + +
+
Total records: {{missing_count}}
+
+
+
+ + + + + \ No newline at end of file diff --git a/views/wantedseries.tpl b/views/wantedseries.tpl new file mode 100644 index 000000000..a44465f22 --- /dev/null +++ b/views/wantedseries.tpl @@ -0,0 +1,168 @@ + + + + + + + + + + + + + + + + + + Wanted - Bazarr + + + + + %import ast + %import pycountry +
+
Loading...
+
+ +
+
+ +
+ + + + + + + + + + + %import time + %import pretty + %if len(rows) == 0: + + + + %end + %for row in rows: + + + + + + + %end + +
SeriesEpisodeEpisode TitleMissing subtitles
No missing episode subtitles.
{{row[0]}} + <%episode = row[1].split('x')%> + {{episode[0] + 'x' + episode[1].zfill(2)}} + {{row[2]}} + %missing_languages = ast.literal_eval(row[3]) + %if missing_languages is not None: + %for language in missing_languages: + + {{language}} + + + %end + %end +
+
+
+
+
+ + + {{page}} / {{max_page}} + + +
+
Total records: {{missing_count}}
+
+
+
+ + + + + \ No newline at end of file