From b9651d1ed02f6fd31ab7bf22ff11e9256a5b9c76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morav=C4=8D=C3=ADk=2C=20Marian?= Date: Thu, 28 Nov 2019 12:34:37 +0100 Subject: [PATCH] Initial Commit --- bazarr/main.py | 1005 +++++++++-------- views/_main.html | 130 +++ views/{menu.tpl => menu.html} | 0 views/{providers.tpl => providers.html} | 16 +- views/{settings.tpl => settings.html} | 14 +- views/settings_general.html | 935 +++++++++++++++ views/settings_general.tpl | 896 --------------- views/settings_notifications.html | 78 ++ views/settings_notifications.tpl | 72 -- ...ttings_radarr.tpl => settings_radarr.html} | 6 +- ...ttings_sonarr.tpl => settings_sonarr.html} | 6 +- views/settings_subtitles.html | 876 ++++++++++++++ views/settings_subtitles.tpl | 831 -------------- views/{wizard.tpl => wizard.html} | 10 +- views/wizard_general.html | 201 ++++ views/wizard_general.tpl | 231 ---- .../{wizard_radarr.tpl => wizard_radarr.html} | 0 .../{wizard_sonarr.tpl => wizard_sonarr.html} | 0 ...rd_subtitles.tpl => wizard_subtitles.html} | 40 +- 19 files changed, 2769 insertions(+), 2578 deletions(-) create mode 100644 views/_main.html rename views/{menu.tpl => menu.html} (100%) rename views/{providers.tpl => providers.html} (98%) rename views/{settings.tpl => settings.html} (95%) create mode 100644 views/settings_general.html delete mode 100644 views/settings_general.tpl create mode 100644 views/settings_notifications.html delete mode 100644 views/settings_notifications.tpl rename views/{settings_radarr.tpl => settings_radarr.html} (98%) rename views/{settings_sonarr.tpl => settings_sonarr.html} (98%) create mode 100644 views/settings_subtitles.html delete mode 100644 views/settings_subtitles.tpl rename views/{wizard.tpl => wizard.html} (97%) create mode 100644 views/wizard_general.html delete mode 100644 views/wizard_general.tpl rename views/{wizard_radarr.tpl => wizard_radarr.html} (100%) rename views/{wizard_sonarr.tpl => wizard_sonarr.html} (100%) rename views/{wizard_subtitles.tpl => wizard_subtitles.html} (95%) diff --git a/bazarr/main.py b/bazarr/main.py index 48e2c6a1a..f70951e15 100644 --- a/bazarr/main.py +++ b/bazarr/main.py @@ -14,7 +14,7 @@ import six from six.moves import zip from functools import reduce -import bottle +# import bottle import itertools import operator import pretty @@ -26,9 +26,9 @@ import warnings import queueconfig import platform import apprise -import operator from calendar import day_name + from get_args import args from logger import empty_log from config import settings, url_sonarr, url_radarr, url_radarr_short, url_sonarr_short, base_url @@ -45,9 +45,10 @@ from io import BytesIO from six import text_type from beaker.middleware import SessionMiddleware from cork import Cork -from bottle import route, template, static_file, request, redirect, response, HTTPError, app, hook, abort +# from bottle import route, template, static_file, request, redirect, response, HTTPError, app, hook, abort from datetime import timedelta from get_languages import load_language_in_db, language_from_alpha3, language_from_alpha2, alpha2_from_alpha3 +from flask import Flask, make_response, request, redirect, abort, render_template from get_providers import get_providers, get_providers_auth, list_throttled_providers from get_series import * @@ -70,6 +71,9 @@ if six.PY2: sys.setdefaultencoding('utf8') gc.enable() +# Flask Setup +app = Flask(__name__, template_folder=os.path.join(os.path.dirname(__file__), '..', 'views'), static_folder=os.path.join(os.path.dirname(__file__), '..', 'static')) + # Check and install update on startup when running on Windows from installer if args.release_update: check_and_apply_update() @@ -84,12 +88,12 @@ if settings.proxy.type != 'None': os.environ['HTTPS_PROXY'] = str(proxy) os.environ['NO_PROXY'] = str(settings.proxy.exclude) -bottle.TEMPLATE_PATH.insert(0, os.path.join(os.path.dirname(__file__), '../views/')) -if "PYCHARM_HOSTED" in os.environ: - bottle.debug(True) - bottle.TEMPLATES.clear() -else: - bottle.ERROR_PAGE_TEMPLATE = bottle.ERROR_PAGE_TEMPLATE.replace('if DEBUG and', 'if') +# bottle.TEMPLATE_PATH.insert(0, os.path.join(os.path.dirname(__file__), '../views/')) +# if "PYCHARM_HOSTED" in os.environ: +# bottle.debug(True) +# bottle.TEMPLATES.clear() +# else: +# bottle.ERROR_PAGE_TEMPLATE = bottle.ERROR_PAGE_TEMPLATE.replace('if DEBUG and', 'if') # Reset restart required warning on start database.execute("UPDATE system SET configured='0', updated='0'") @@ -99,16 +103,16 @@ load_language_in_db() aaa = Cork(os.path.normpath(os.path.join(args.config_dir, 'config'))) -app = app() -session_opts = { - 'session.cookie_expires': True, - 'session.key': 'Bazarr', - 'session.httponly': True, - 'session.timeout': 3600 * 24, # 1 day - 'session.type': 'cookie', - 'session.validate_key': True -} -app = SessionMiddleware(app, session_opts) +# app = app() +# session_opts = { +# 'session.cookie_expires': True, +# 'session.key': 'Bazarr', +# 'session.httponly': True, +# 'session.timeout': 3600 * 24, # 1 day +# 'session.type': 'cookie', +# 'session.validate_key': True +# } +# app = SessionMiddleware(app, session_opts) login_auth = settings.auth.type @@ -121,7 +125,7 @@ def custom_auth_basic(check): if settings.auth.type == 'basic': user, password = request.auth or (None, None) if user is None or not check(user, password): - err = HTTPError(401, "Access denied") + err = abort(401, "Access denied") err.add_header('WWW-Authenticate', 'Basic realm="Bazarr"') return err return func(*a, **ka) @@ -161,19 +165,19 @@ def post_get(name, default=''): return request.POST.get(name, default).strip() -@hook('before_request') -def enable_cors(): - if response: - response.headers['Access-Control-Allow-Origin'] = '*' - +# @app.before_request +# def enable_cors(): +# if request: +# request.headers['Access-Control-Allow-Origin'] = '*' +## todo: add cors lib -@route(base_url + 'login') +@app.route(base_url + 'login/') def login_form(): - msg = bottle.request.query.get('msg', '') - return template('login', base_url=base_url, msg=msg) + msg = request.query.get('msg', '') + return render_template('login', base_url=base_url, msg=msg) -@route(base_url + 'login', method='POST') +@app.route(base_url + 'login/', methods=['POST']) def login(): aaa = Cork(os.path.normpath(os.path.join(args.config_dir, 'config'))) username = post_get('username') @@ -181,7 +185,7 @@ def login(): aaa.login(username, password, success_redirect=base_url, fail_redirect=(base_url + 'login?msg=fail')) -@route(base_url + 'logout') +@app.route(base_url + 'logout/') def logout(): if settings.auth.type == 'form': aaa.logout(success_redirect=(base_url + 'login')) @@ -191,15 +195,15 @@ def logout(): aaa.logout(success_redirect=(base_url)) -@route('/') -@custom_auth_basic(check_credentials) -def redirect_root(): - authorize() - redirect(base_url) +# @app.route('/') +# # @custom_auth_basic(check_credentials) +# def redirect_root(): +# authorize() +# redirect(base_url) -@route(base_url + 'shutdown') -@custom_auth_basic(check_credentials) +@app.route(base_url + 'shutdown/') +# @custom_auth_basic(check_credentials) def shutdown(): authorize() try: @@ -218,8 +222,8 @@ def shutdown(): sys.exit(0) -@route(base_url + 'restart') -@custom_auth_basic(check_credentials) +@app.route(base_url + 'restart/') +# @custom_auth_basic(check_credentials) def restart(): authorize() try: @@ -239,8 +243,8 @@ def restart(): sys.exit(0) -@route(base_url + 'wizard') -@custom_auth_basic(check_credentials) +@app.route(base_url + 'wizard/') +# @custom_auth_basic(check_credentials) def wizard(): authorize() @@ -249,64 +253,65 @@ def wizard(): # Get providers list settings_providers = sorted(provider_manager.names()) - return template('wizard', bazarr_version=bazarr_version, settings=settings, + return render_template('wizard.html', bazarr_version=bazarr_version, settings=settings, settings_languages=settings_languages, settings_providers=settings_providers, - base_url=base_url) + base_url=base_url, ast=ast) -@route(base_url + 'save_wizard', method='POST') -@custom_auth_basic(check_credentials) +@app.route(base_url + 'save_wizard', methods=['POST']) +# @custom_auth_basic(check_credentials) def save_wizard(): authorize() + test = request.form - settings_general_ip = request.forms.get('settings_general_ip') - settings_general_port = request.forms.get('settings_general_port') - settings_general_baseurl = request.forms.get('settings_general_baseurl') + settings_general_ip = request.form.get('settings_general_ip') + settings_general_port = request.form.get('settings_general_port') + settings_general_baseurl = request.form.get('settings_general_baseurl') if not settings_general_baseurl.endswith('/'): settings_general_baseurl += '/' - settings_general_sourcepath = request.forms.getall('settings_general_sourcepath') - settings_general_destpath = request.forms.getall('settings_general_destpath') + settings_general_sourcepath = request.form.getlist('settings_general_sourcepath[]') + settings_general_destpath = request.form.getlist('settings_general_destpath[]') settings_general_pathmapping = [] settings_general_pathmapping.extend([list(a) for a in zip(settings_general_sourcepath, settings_general_destpath)]) - settings_general_sourcepath_movie = request.forms.getall('settings_general_sourcepath_movie') - settings_general_destpath_movie = request.forms.getall('settings_general_destpath_movie') + settings_general_sourcepath_movie = request.form.getlist('settings_general_sourcepath_movie[]') + settings_general_destpath_movie = request.form.getlist('settings_general_destpath_movie[]') settings_general_pathmapping_movie = [] settings_general_pathmapping_movie.extend( [list(a) for a in zip(settings_general_sourcepath_movie, settings_general_destpath_movie)]) - settings_general_single_language = request.forms.get('settings_general_single_language') + settings_general_single_language = request.form.get('settings_general_single_language') if settings_general_single_language is None: settings_general_single_language = 'False' else: settings_general_single_language = 'True' - settings_general_use_sonarr = request.forms.get('settings_general_use_sonarr') + settings_general_use_sonarr = request.form.get('settings_general_use_sonarr') if settings_general_use_sonarr is None: settings_general_use_sonarr = 'False' else: settings_general_use_sonarr = 'True' - settings_general_use_radarr = request.forms.get('settings_general_use_radarr') + settings_general_use_radarr = request.form.get('settings_general_use_radarr') if settings_general_use_radarr is None: settings_general_use_radarr = 'False' else: settings_general_use_radarr = 'True' - settings_general_embedded = request.forms.get('settings_general_embedded') + settings_general_embedded = request.form.get('settings_general_embedded') if settings_general_embedded is None: settings_general_embedded = 'False' else: 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') + settings_subfolder = request.form.get('settings_subfolder') + settings_subfolder_custom = request.form.get('settings_subfolder_custom') + settings_upgrade_subs = request.form.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') + settings_days_to_upgrade_subs = request.form.get('settings_days_to_upgrade_subs') + settings_upgrade_manual = request.form.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) @@ -321,183 +326,176 @@ def save_wizard(): 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') - settings_sonarr_ssl = request.forms.get('settings_sonarr_ssl') + + settings_sonarr_ip = request.form.get('settings_sonarr_ip') + settings_sonarr_port = request.form.get('settings_sonarr_port') + settings_sonarr_baseurl = request.form.get('settings_sonarr_baseurl') + settings_sonarr_ssl = request.form.get('settings_sonarr_ssl') if settings_sonarr_ssl is None: settings_sonarr_ssl = 'False' else: settings_sonarr_ssl = 'True' - settings_sonarr_apikey = request.forms.get('settings_sonarr_apikey') - settings_sonarr_only_monitored = request.forms.get('settings_sonarr_only_monitored') + settings_sonarr_apikey = request.form.get('settings_sonarr_apikey') + settings_sonarr_only_monitored = request.form.get('settings_sonarr_only_monitored') if settings_sonarr_only_monitored is None: settings_sonarr_only_monitored = 'False' else: settings_sonarr_only_monitored = 'True' - + settings.sonarr.ip = text_type(settings_sonarr_ip) settings.sonarr.port = text_type(settings_sonarr_port) settings.sonarr.base_url = text_type(settings_sonarr_baseurl) settings.sonarr.ssl = text_type(settings_sonarr_ssl) settings.sonarr.apikey = text_type(settings_sonarr_apikey) settings.sonarr.only_monitored = text_type(settings_sonarr_only_monitored) - - settings_radarr_ip = request.forms.get('settings_radarr_ip') - settings_radarr_port = request.forms.get('settings_radarr_port') - settings_radarr_baseurl = request.forms.get('settings_radarr_baseurl') - settings_radarr_ssl = request.forms.get('settings_radarr_ssl') + + settings_radarr_ip = request.form.get('settings_radarr_ip') + settings_radarr_port = request.form.get('settings_radarr_port') + settings_radarr_baseurl = request.form.get('settings_radarr_baseurl') + settings_radarr_ssl = request.form.get('settings_radarr_ssl') if settings_radarr_ssl is None: settings_radarr_ssl = 'False' else: settings_radarr_ssl = 'True' - settings_radarr_apikey = request.forms.get('settings_radarr_apikey') - settings_radarr_only_monitored = request.forms.get('settings_radarr_only_monitored') + settings_radarr_apikey = request.form.get('settings_radarr_apikey') + settings_radarr_only_monitored = request.form.get('settings_radarr_only_monitored') if settings_radarr_only_monitored is None: settings_radarr_only_monitored = 'False' else: settings_radarr_only_monitored = 'True' - + settings.radarr.ip = text_type(settings_radarr_ip) settings.radarr.port = text_type(settings_radarr_port) settings.radarr.base_url = text_type(settings_radarr_baseurl) settings.radarr.ssl = text_type(settings_radarr_ssl) settings.radarr.apikey = text_type(settings_radarr_apikey) settings.radarr.only_monitored = text_type(settings_radarr_only_monitored) - - settings_subliminal_providers = request.forms.getall('settings_subliminal_providers') + + settings_subliminal_providers = request.form.getlist('settings_subliminal_providers') settings.general.enabled_providers = u'' if not settings_subliminal_providers else ','.join( settings_subliminal_providers) - - settings_addic7ed_random_agents = request.forms.get('settings_addic7ed_random_agents') + + settings_addic7ed_random_agents = request.form.get('settings_addic7ed_random_agents') if settings_addic7ed_random_agents is None: settings_addic7ed_random_agents = 'False' else: settings_addic7ed_random_agents = 'True' - - settings_opensubtitles_vip = request.forms.get('settings_opensubtitles_vip') + + settings_opensubtitles_vip = request.form.get('settings_opensubtitles_vip') if settings_opensubtitles_vip is None: settings_opensubtitles_vip = 'False' else: settings_opensubtitles_vip = 'True' - - settings_opensubtitles_ssl = request.forms.get('settings_opensubtitles_ssl') + + settings_opensubtitles_ssl = request.form.get('settings_opensubtitles_ssl') if settings_opensubtitles_ssl is None: settings_opensubtitles_ssl = 'False' else: settings_opensubtitles_ssl = 'True' - - settings_opensubtitles_skip_wrong_fps = request.forms.get('settings_opensubtitles_skip_wrong_fps') + + settings_opensubtitles_skip_wrong_fps = request.form.get('settings_opensubtitles_skip_wrong_fps') if settings_opensubtitles_skip_wrong_fps is None: settings_opensubtitles_skip_wrong_fps = 'False' else: settings_opensubtitles_skip_wrong_fps = 'True' - - settings.addic7ed.username = request.forms.get('settings_addic7ed_username') - settings.addic7ed.password = request.forms.get('settings_addic7ed_password') - settings.addic7ed.random_agents = text_type(settings_addic7ed_random_agents) - settings.assrt.token = request.forms.get('settings_assrt_token') - settings.legendastv.username = request.forms.get('settings_legendastv_username') - settings.legendastv.password = request.forms.get('settings_legendastv_password') - settings.opensubtitles.username = request.forms.get('settings_opensubtitles_username') - settings.opensubtitles.password = request.forms.get('settings_opensubtitles_password') + + settings.addic7ed.username = request.form.get('settings_addic7ed_username') or '' + settings.addic7ed.password = request.form.get('settings_addic7ed_password') or '' + settings.addic7ed.random_agents = text_type(settings_addic7ed_random_agents) or '' + settings.assrt.token = request.form.get('settings_assrt_token') or '' + settings.legendastv.username = request.form.get('settings_legendastv_username') or '' + settings.legendastv.password = request.form.get('settings_legendastv_password') or '' + settings.opensubtitles.username = request.form.get('settings_opensubtitles_username') or '' + settings.opensubtitles.password = request.form.get('settings_opensubtitles_password') or '' settings.opensubtitles.vip = text_type(settings_opensubtitles_vip) settings.opensubtitles.ssl = text_type(settings_opensubtitles_ssl) settings.opensubtitles.skip_wrong_fps = text_type(settings_opensubtitles_skip_wrong_fps) - settings.xsubs.username = request.forms.get('settings_xsubs_username') - settings.xsubs.password = request.forms.get('settings_xsubs_password') - settings.napisy24.username = request.forms.get('settings_napisy24_username') - settings.napisy24.password = request.forms.get('settings_napisy24_password') - settings.subscene.username = request.forms.get('settings_subscene_username') - settings.subscene.password = request.forms.get('settings_subscene_password') - settings.titlovi.username = request.forms.get('settings_titlovi_username') - settings.titlovi.password = request.forms.get('settings_titlovi_password') - settings.betaseries.token = request.forms.get('settings_betaseries_token') - - settings_subliminal_languages = request.forms.getall('settings_subliminal_languages') + settings.xsubs.username = request.form.get('settings_xsubs_username') or '' + settings.xsubs.password = request.form.get('settings_xsubs_password') or '' + settings.napisy24.username = request.form.get('settings_napisy24_username') or '' + settings.napisy24.password = request.form.get('settings_napisy24_password') or '' + settings.subscene.username = request.form.get('settings_subscene_username') or '' + settings.subscene.password = request.form.get('settings_subscene_password') or '' + settings.titlovi.username = request.form.get('settings_titlovi_username') or '' + settings.titlovi.password = request.form.get('settings_titlovi_password') or '' + settings.betaseries.token = request.form.get('settings_betaseries_token') or '' + + settings_subliminal_languages = request.form.getlist('settings_subliminal_languages') # Disable all languages in DB database.execute("UPDATE table_settings_languages SET enabled=0") for item in settings_subliminal_languages: # Enable each desired language in DB database.execute("UPDATE table_settings_languages SET enabled=1 WHERE code2=?", item) - - settings_serie_default_enabled = request.forms.get('settings_serie_default_enabled') + + settings_serie_default_enabled = request.form.get('settings_serie_default_enabled') if settings_serie_default_enabled is None: settings_serie_default_enabled = 'False' else: settings_serie_default_enabled = 'True' settings.general.serie_default_enabled = text_type(settings_serie_default_enabled) - - settings_serie_default_languages = str(request.forms.getall('settings_serie_default_languages')) + + settings_serie_default_languages = str(request.form.getlist('settings_serie_default_languages')) if settings_serie_default_languages == "['None']": settings_serie_default_languages = 'None' settings.general.serie_default_language = text_type(settings_serie_default_languages) - - settings_serie_default_hi = request.forms.get('settings_serie_default_hi') + + settings_serie_default_hi = request.form.get('settings_serie_default_hi') if settings_serie_default_hi is None: settings_serie_default_hi = 'False' else: settings_serie_default_hi = 'True' settings.general.serie_default_hi = text_type(settings_serie_default_hi) - - settings_movie_default_enabled = request.forms.get('settings_movie_default_enabled') + + settings_movie_default_enabled = request.form.get('settings_movie_default_enabled') if settings_movie_default_enabled is None: settings_movie_default_enabled = 'False' else: settings_movie_default_enabled = 'True' settings.general.movie_default_enabled = text_type(settings_movie_default_enabled) - - settings_movie_default_languages = str(request.forms.getall('settings_movie_default_languages')) + + settings_movie_default_languages = str(request.form.getlist('settings_movie_default_languages')) if settings_movie_default_languages == "['None']": settings_movie_default_languages = 'None' settings.general.movie_default_language = text_type(settings_movie_default_languages) - - settings_movie_default_hi = request.forms.get('settings_movie_default_hi') + + settings_movie_default_hi = request.form.get('settings_movie_default_hi') if settings_movie_default_hi is None: settings_movie_default_hi = 'False' else: settings_movie_default_hi = 'True' settings.general.movie_default_hi = text_type(settings_movie_default_hi) - - settings_movie_default_forced = str(request.forms.get('settings_movie_default_forced')) + + settings_movie_default_forced = str(request.form.get('settings_movie_default_forced')) settings.general.movie_default_forced = text_type(settings_movie_default_forced) - + with open(os.path.join(args.config_dir, 'config', 'config.ini'), 'w+') as handle: settings.write(handle) configured() - redirect(base_url) - + return redirect(base_url) -@route(base_url + 'static/:path#.+#', name='static') -@custom_auth_basic(check_credentials) -def static(path): - authorize() - return static_file(path, root=os.path.join(os.path.dirname(__file__), '../static')) - -@route(base_url + 'emptylog') -@custom_auth_basic(check_credentials) +@app.route(base_url + 'emptylog') +# @custom_auth_basic(check_credentials) def emptylog(): authorize() ref = request.environ['HTTP_REFERER'] - + empty_log() logging.info('BAZARR Log file emptied') - + redirect(ref) -@route(base_url + 'bazarr.log') -@custom_auth_basic(check_credentials) +@app.route(base_url + 'bazarr.log') +# @custom_auth_basic(check_credentials) def download_log(): authorize() return static_file('bazarr.log', root=os.path.join(args.config_dir, 'log/'), download='bazarr.log') -@route(base_url + 'image_proxy/', method='GET') -@custom_auth_basic(check_credentials) +@app.route(base_url + 'image_proxy/', methods=['GET']) +# @custom_auth_basic(check_credentials) def image_proxy(url): authorize() apikey = settings.sonarr.apikey @@ -510,12 +508,12 @@ def image_proxy(url): else: image_buffer.seek(0) bytes = image_buffer.read() - response.set_header('Content-type', 'image/jpeg') + request.set_header('Content-type', 'image/jpeg') return bytes -@route(base_url + 'image_proxy_movies/', method='GET') -@custom_auth_basic(check_credentials) +@app.route(base_url + 'image_proxy_movies/', methods=['GET']) +# @custom_auth_basic(check_credentials) def image_proxy_movies(url): authorize() apikey = settings.radarr.apikey @@ -530,27 +528,26 @@ def image_proxy_movies(url): else: image_buffer.seek(0) bytes = image_buffer.read() - response.set_header('Content-type', 'image/jpeg') + request.set_header('Content-type', 'image/jpeg') return bytes -@route(base_url) -@route(base_url.rstrip('/')) -@custom_auth_basic(check_credentials) +@app.route(base_url) +# @custom_auth_basic(check_credentials) def redirect_root(): authorize() if settings.general.getboolean('use_sonarr'): - redirect(base_url + 'series') + return redirect(base_url + 'series') elif settings.general.getboolean('use_radarr'): - redirect(base_url + 'movies') + return redirect(base_url + 'movies') elif not settings.general.enabled_providers: - redirect(base_url + 'wizard') + return redirect(base_url + 'wizard') else: - redirect(base_url + 'settings') + return redirect(base_url + 'settings') -@route(base_url + 'series') -@custom_auth_basic(check_credentials) +@app.route(base_url + 'series/') +# @custom_auth_basic(check_credentials) def series(): authorize() @@ -561,7 +558,7 @@ def series(): page_size = int(settings.general.page_size) offset = (int(page) - 1) * page_size max_page = int(math.ceil(series_count / (page_size + 0.0))) - + # Get list of series data = database.execute("SELECT tvdbId, title, path, languages, hearing_impaired, sonarrSeriesId, poster, " "audio_language, forced FROM table_shows ORDER BY sortTitle ASC LIMIT ? OFFSET ?", @@ -599,18 +596,18 @@ def series(): "table_episodes.sonarrSeriesId WHERE table_shows.languages IS NOT 'None'" + total_subtitles_clause + " GROUP BY table_shows.sonarrSeriesId") - return template('series', bazarr_version=bazarr_version, rows=data, missing_subtitles_list=missing_subtitles_list, + return render_template('series', bazarr_version=bazarr_version, rows=data, missing_subtitles_list=missing_subtitles_list, total_subtitles_list=total_subtitles_list, languages=languages, missing_count=series_count, page=page, max_page=max_page, base_url=base_url, single_language=settings.general.getboolean('single_language'), page_size=page_size, current_port=settings.general.port) -@route(base_url + 'serieseditor') -@custom_auth_basic(check_credentials) +@app.route(base_url + 'serieseditor/') +# @custom_auth_basic(check_credentials) def serieseditor(): authorize() - + # Get missing count missing_count = database.execute("SELECT COUNT(*) as count FROM table_shows", only_one=True)['count'] @@ -623,13 +620,13 @@ def serieseditor(): # Get languages list languages = database.execute("SELECT code2, name FROM table_settings_languages WHERE enabled=1") - return template('serieseditor', bazarr_version=bazarr_version, rows=data, languages=languages, + return render_template('serieseditor', bazarr_version=bazarr_version, rows=data, languages=languages, missing_count=missing_count, base_url=base_url, single_language=settings.general.getboolean('single_language'), current_port=settings.general.port) -@route(base_url + 'search_json/', method='GET') -@custom_auth_basic(check_credentials) +@app.route(base_url + 'search_json/', methods=['GET']) +# @custom_auth_basic(check_credentials) def search_json(query): authorize() @@ -643,7 +640,7 @@ def search_json(query): for serie in series: search_list.append(dict([('name', re.sub(r'\ \(\d{4}\)', '', serie['title']) + ' (' + serie['year'] + ')'), ('url', base_url + 'episodes/' + str(serie['sonarrSeriesId']))])) - + if settings.general.getboolean('use_radarr'): # Get matching movies movies = database.execute("SELECT title, radarrId, year FROM table_movies WHERE title LIKE ? ORDER BY " @@ -652,22 +649,22 @@ def search_json(query): search_list.append(dict([('name', re.sub(r'\ \(\d{4}\)', '', movie['title']) + ' (' + movie['year'] + ')'), ('url', base_url + 'movie/' + str(movie['radarrId']))])) - response.content_type = 'application/json' + request.content_type = 'application/json' return dict(items=search_list) -@route(base_url + 'edit_series/', method='POST') -@custom_auth_basic(check_credentials) +@app.route(base_url + 'edit_series/', methods=['POST']) +# @custom_auth_basic(check_credentials) def edit_series(no): authorize() ref = request.environ['HTTP_REFERER'] - - lang = request.forms.getall('languages') + + lang = request.form.getlist('languages') if len(lang) > 0: pass else: lang = 'None' - + single_language = settings.general.getboolean('single_language') if single_language: if str(lang) == "['None']": @@ -677,10 +674,10 @@ def edit_series(no): else: if str(lang) == "['']": lang = '[]' - - hi = request.forms.get('hearing_impaired') - forced = request.forms.get('forced') - + + hi = request.form.get('hearing_impaired') + forced = request.form.get('forced') + if hi == "on": hi = "True" else: @@ -690,21 +687,21 @@ def edit_series(no): "sonarrSeriesId=?", (str(lang), hi, forced, no)) list_missing_subtitles(no=no) - + redirect(ref) -@route(base_url + 'edit_serieseditor', method='POST') -@custom_auth_basic(check_credentials) +@app.route(base_url + 'edit_serieseditor', methods=['POST']) +# @custom_auth_basic(check_credentials) def edit_serieseditor(): authorize() ref = request.environ['HTTP_REFERER'] - - series = request.forms.get('series') + + series = request.form.get('series') series = ast.literal_eval(str('[' + series + ']')) - lang = request.forms.getall('languages') - hi = request.forms.get('hearing_impaired') - forced = request.forms.get('forced') + lang = request.form.getlist('languages') + hi = request.form.get('hearing_impaired') + forced = request.form.get('forced') for serie in series: if str(lang) != "[]" and str(lang) != "['']": @@ -717,15 +714,15 @@ def edit_serieseditor(): database.execute("UPDATE table_shows SET hearing_impaired=? WHERE sonarrSeriesId=?", (hi, serie)) if forced != '': database.execute("UPDATE table_shows SET forced=? WHERE sonarrSeriesId=?", (forced, serie)) - + for serie in series: list_missing_subtitles(no=serie) - + redirect(ref) -@route(base_url + 'episodes/', method='GET') -@custom_auth_basic(check_credentials) +@app.route(base_url + 'episodes/', methods=['GET']) +# @custom_auth_basic(check_credentials) def episodes(no): authorize() @@ -734,7 +731,7 @@ def episodes(no): "sonarrSeriesId=?", (no,), only_one=True) # path_replace dict_mapper.path_replace(series_details) - + tvdbid = series_details['tvdbId'] episodes = database.execute("SELECT title, path, season, episode, subtitles, sonarrSeriesId, missing_subtitles, " @@ -751,13 +748,13 @@ def episodes(no): for key, season in itertools.groupby(episodes, lambda x: x['season']): seasons_list.append(list(season)) - return template('episodes', bazarr_version=bazarr_version, no=no, details=series_details, + return render_template('episodes', bazarr_version=bazarr_version, no=no, details=series_details, languages=languages, seasons=seasons_list, url_sonarr_short=url_sonarr_short(), base_url=base_url, tvdbid=tvdbid, number=number, current_port=settings.general.port) -@route(base_url + 'movies') -@custom_auth_basic(check_credentials) +@app.route(base_url + 'movies') +# @custom_auth_basic(check_credentials) def movies(): authorize() @@ -777,17 +774,17 @@ def movies(): languages = database.execute("SELECT code2, name FROM table_settings_languages WHERE enabled=1") - return template('movies', bazarr_version=bazarr_version, rows=data, languages=languages, + return render_template('movies', bazarr_version=bazarr_version, rows=data, languages=languages, missing_count=missing_count, page=page, max_page=max_page, base_url=base_url, single_language=settings.general.getboolean('single_language'), page_size=page_size, current_port=settings.general.port) -@route(base_url + 'movieseditor') -@custom_auth_basic(check_credentials) +@app.route(base_url + 'movieseditor') +# @custom_auth_basic(check_credentials) def movieseditor(): authorize() - + 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, " @@ -797,22 +794,22 @@ def movieseditor(): languages = database.execute("SELECT code2, name FROM table_settings_languages WHERE enabled=1") - return template('movieseditor', bazarr_version=bazarr_version, rows=data, languages=languages, + return render_template('movieseditor', bazarr_version=bazarr_version, rows=data, languages=languages, missing_count=missing_count, base_url=base_url, single_language= settings.general.getboolean('single_language'), current_port=settings.general.port) -@route(base_url + 'edit_movieseditor', method='POST') -@custom_auth_basic(check_credentials) +@app.route(base_url + 'edit_movieseditor', methods=['POST']) +# @custom_auth_basic(check_credentials) def edit_movieseditor(): authorize() ref = request.environ['HTTP_REFERER'] - - movies = request.forms.get('movies') + + movies = request.form.get('movies') movies = ast.literal_eval(str('[' + movies + ']')) - lang = request.forms.getall('languages') - hi = request.forms.get('hearing_impaired') - forced = request.forms.get('forced') + lang = request.form.getlist('languages') + hi = request.form.get('hearing_impaired') + forced = request.form.get('forced') for movie in movies: if str(lang) != "[]" and str(lang) != "['']": @@ -825,25 +822,25 @@ def edit_movieseditor(): database.execute("UPDATE table_movies SET hearing_impaired=? WHERE radarrId=?", (hi, movie)) if forced != '': database.execute("UPDATE table_movies SET forced=? WHERE radarrId=?", (forced, movie)) - + for movie in movies: list_missing_subtitles_movies(movie) - + redirect(ref) -@route(base_url + 'edit_movie/', method='POST') -@custom_auth_basic(check_credentials) +@app.route(base_url + 'edit_movie/', methods=['POST']) +# @custom_auth_basic(check_credentials) def edit_movie(no): authorize() ref = request.environ['HTTP_REFERER'] - - lang = request.forms.getall('languages') + + lang = request.form.getlist('languages') if len(lang) > 0: pass else: lang = 'None' - + single_language = settings.general.getboolean('single_language') if single_language: if str(lang) == "['None']": @@ -853,10 +850,10 @@ def edit_movie(no): else: if str(lang) == "['']": lang = '[]' - - hi = request.forms.get('hearing_impaired') - forced = request.forms.get('forced') - + + hi = request.form.get('hearing_impaired') + forced = request.form.get('forced') + if hi == "on": hi = "True" else: @@ -866,12 +863,12 @@ def edit_movie(no): (str(lang), hi, forced, no)) list_missing_subtitles_movies(no) - + redirect(ref) -@route(base_url + 'movie/', method='GET') -@custom_auth_basic(check_credentials) +@app.route(base_url + 'movie/', methods=['GET']) +# @custom_auth_basic(check_credentials) def movie(no): authorize() @@ -886,64 +883,64 @@ def movie(no): languages = database.execute("SELECT code2, name FROM table_settings_languages WHERE enabled=1") - return template('movie', bazarr_version=bazarr_version, no=no, details=movies_details, + return render_template('movie', bazarr_version=bazarr_version, no=no, details=movies_details, languages=languages, url_radarr_short=url_radarr_short(), base_url=base_url, tmdbid=tmdbid, current_port=settings.general.port) -@route(base_url + 'scan_disk/', method='GET') -@custom_auth_basic(check_credentials) +@app.route(base_url + 'scan_disk/', methods=['GET']) +# @custom_auth_basic(check_credentials) def scan_disk(no): authorize() ref = request.environ['HTTP_REFERER'] - + series_scan_subtitles(no) - + redirect(ref) -@route(base_url + 'scan_disk_movie/', method='GET') -@custom_auth_basic(check_credentials) +@app.route(base_url + 'scan_disk_movie/', methods=['GET']) +# @custom_auth_basic(check_credentials) def scan_disk_movie(no): authorize() ref = request.environ['HTTP_REFERER'] - + movies_scan_subtitles(no) - + redirect(ref) -@route(base_url + 'search_missing_subtitles/', method='GET') -@custom_auth_basic(check_credentials) +@app.route(base_url + 'search_missing_subtitles/', methods=['GET']) +# @custom_auth_basic(check_credentials) def search_missing_subtitles(no): authorize() ref = request.environ['HTTP_REFERER'] - + add_job(series_download_subtitles, args=[no], name=('search_missing_subtitles_' + str(no))) - + redirect(ref) -@route(base_url + 'search_missing_subtitles_movie/', method='GET') -@custom_auth_basic(check_credentials) +@app.route(base_url + 'search_missing_subtitles_movie/', methods=['GET']) +# @custom_auth_basic(check_credentials) def search_missing_subtitles_movie(no): authorize() ref = request.environ['HTTP_REFERER'] - + add_job(movies_download_subtitles, args=[no], name=('movies_download_subtitles_' + str(no))) - + redirect(ref) -@route(base_url + 'history') -@custom_auth_basic(check_credentials) +@app.route(base_url + 'history') +# @custom_auth_basic(check_credentials) def history(): authorize() - return template('history', bazarr_version=bazarr_version, base_url=base_url, current_port=settings.general.port) + return render_template('history', bazarr_version=bazarr_version, base_url=base_url, current_port=settings.general.port) -@route(base_url + 'historyseries') -@custom_auth_basic(check_credentials) +@app.route(base_url + 'historyseries') +# @custom_auth_basic(check_credentials) def historyseries(): authorize() @@ -956,7 +953,7 @@ def historyseries(): page_size = int(settings.general.page_size) offset = (int(page) - 1) * page_size max_page = int(math.ceil(row_count / (page_size + 0.0))) - + now = datetime.now() today = [] thisweek = [] @@ -1015,14 +1012,14 @@ def historyseries(): else: if int(upgradable_episode['score']) < 360: upgradable_episodes_not_perfect.append(upgradable_episode) - - return template('historyseries', bazarr_version=bazarr_version, rows=data, row_count=row_count, + + return render_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, upgradable_episodes=upgradable_episodes_not_perfect) -@route(base_url + 'historymovies') -@custom_auth_basic(check_credentials) +@app.route(base_url + 'historymovies') +# @custom_auth_basic(check_credentials) def historymovies(): authorize() @@ -1035,7 +1032,7 @@ def historymovies(): page_size = int(settings.general.page_size) offset = (int(page) - 1) * page_size max_page = int(math.ceil(row_count / (page_size + 0.0))) - + now = datetime.now() today = [] thisweek = [] @@ -1050,14 +1047,14 @@ def historymovies(): if now - timedelta(weeks=52) <= datetime.fromtimestamp(stat['timestamp']) <= now: thisyear.append(datetime.fromtimestamp(stat['timestamp']).date()) stats = [len(today), len(thisweek), len(thisyear), total] - + data = database.execute("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, table_movies.forced FROM table_history_movie " "LEFT JOIN table_movies on table_movies.radarrId = table_history_movie.radarrId " "ORDER BY timestamp DESC LIMIT ? OFFSET ?", (page_size, offset,)) - + upgradable_movies = [] upgradable_movies_not_perfect = [] if settings.general.getboolean('upgrade_subs'): @@ -1093,20 +1090,20 @@ def historymovies(): if int(upgradable_movie['score']) < 120: upgradable_movies_not_perfect.append(upgradable_movie) - return template('historymovies', bazarr_version=bazarr_version, rows=data, row_count=row_count, + return render_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, upgradable_movies=upgradable_movies_not_perfect) -@route(base_url + 'wanted') -@custom_auth_basic(check_credentials) +@app.route(base_url + 'wanted') +# @custom_auth_basic(check_credentials) def wanted(): authorize() - return template('wanted', bazarr_version=bazarr_version, base_url=base_url, current_port=settings.general.port) + return render_template('wanted', bazarr_version=bazarr_version, base_url=base_url, current_port=settings.general.port) -@route(base_url + 'wantedseries') -@custom_auth_basic(check_credentials) +@app.route(base_url + 'wantedseries') +# @custom_auth_basic(check_credentials) def wantedseries(): authorize() @@ -1114,7 +1111,7 @@ def wantedseries(): monitored_only_query_string = " AND monitored='True'" else: monitored_only_query_string = '' - + missing_count = database.execute("SELECT COUNT(*) as count FROM table_episodes WHERE missing_subtitles != '[]'" + monitored_only_query_string, only_one=True)['count'] page = request.GET.page @@ -1135,12 +1132,12 @@ def wantedseries(): # path_replace dict_mapper.path_replace(data) - return template('wantedseries', bazarr_version=bazarr_version, rows=data, missing_count=missing_count, page=page, + return render_template('wantedseries', bazarr_version=bazarr_version, rows=data, missing_count=missing_count, page=page, max_page=max_page, base_url=base_url, page_size=page_size, current_port=settings.general.port) -@route(base_url + 'wantedmovies') -@custom_auth_basic(check_credentials) +@app.route(base_url + 'wantedmovies') +# @custom_auth_basic(check_credentials) def wantedmovies(): authorize() @@ -1165,24 +1162,24 @@ def wantedmovies(): # path_replace dict_mapper.path_replace_movie(data) - return template('wantedmovies', bazarr_version=bazarr_version, rows=data, + return render_template('wantedmovies', bazarr_version=bazarr_version, rows=data, missing_count=missing_count, page=page, max_page=max_page, base_url=base_url, page_size=page_size, current_port=settings.general.port) -@route(base_url + 'wanted_search_missing_subtitles') -@custom_auth_basic(check_credentials) +@app.route(base_url + 'wanted_search_missing_subtitles') +# @custom_auth_basic(check_credentials) def wanted_search_missing_subtitles_list(): authorize() ref = request.environ['HTTP_REFERER'] - + add_job(wanted_search_missing_subtitles, name='manual_wanted_search_missing_subtitles') - + redirect(ref) -@route(base_url + 'settings') -@custom_auth_basic(check_credentials) +@app.route(base_url + 'settings/') +# @custom_auth_basic(check_credentials) def _settings(): authorize() @@ -1190,139 +1187,139 @@ def _settings(): settings_providers = sorted(provider_manager.names()) settings_notifier = database.execute("SELECT * FROM table_settings_notifier ORDER BY name") - return template('settings', bazarr_version=bazarr_version, settings=settings, settings_languages=settings_languages, + return render_template('settings.html', bazarr_version=bazarr_version, settings=settings, settings_languages=settings_languages, settings_providers=settings_providers, settings_notifier=settings_notifier, base_url=base_url, - current_port=settings.general.port) + current_port=settings.general.port, ast=ast, args=args, sys=sys) -@route(base_url + 'save_settings', method='POST') -@custom_auth_basic(check_credentials) +@app.route(base_url + 'save_settings', methods=['POST']) +# @custom_auth_basic(check_credentials) def save_settings(): authorize() ref = request.environ['HTTP_REFERER'] - settings_general_ip = request.forms.get('settings_general_ip') - settings_general_port = request.forms.get('settings_general_port') - settings_general_baseurl = request.forms.get('settings_general_baseurl') + settings_general_ip = request.form.get('settings_general_ip') + settings_general_port = request.form.get('settings_general_port') + settings_general_baseurl = request.form.get('settings_general_baseurl') if not settings_general_baseurl.endswith('/'): settings_general_baseurl += '/' - settings_general_debug = request.forms.get('settings_general_debug') + settings_general_debug = request.form.get('settings_general_debug') if settings_general_debug is None: settings_general_debug = 'False' else: settings_general_debug = 'True' - settings_general_chmod_enabled = request.forms.get('settings_general_chmod_enabled') + settings_general_chmod_enabled = request.form.get('settings_general_chmod_enabled') if settings_general_chmod_enabled is None: settings_general_chmod_enabled = 'False' else: settings_general_chmod_enabled = 'True' - settings_general_chmod = request.forms.get('settings_general_chmod') - settings_general_sourcepath = request.forms.getall('settings_general_sourcepath') - settings_general_destpath = request.forms.getall('settings_general_destpath') + settings_general_chmod = request.form.get('settings_general_chmod') + settings_general_sourcepath = request.form.getlist('settings_general_sourcepath') + settings_general_destpath = request.form.getlist('settings_general_destpath') settings_general_pathmapping = [] settings_general_pathmapping.extend([list(a) for a in zip(settings_general_sourcepath, settings_general_destpath)]) - settings_general_sourcepath_movie = request.forms.getall('settings_general_sourcepath_movie') - settings_general_destpath_movie = request.forms.getall('settings_general_destpath_movie') + settings_general_sourcepath_movie = request.form.getlist('settings_general_sourcepath_movie') + settings_general_destpath_movie = request.form.getlist('settings_general_destpath_movie') settings_general_pathmapping_movie = [] settings_general_pathmapping_movie.extend( [list(a) for a in zip(settings_general_sourcepath_movie, settings_general_destpath_movie)]) - settings_general_branch = request.forms.get('settings_general_branch') - settings_general_automatic = request.forms.get('settings_general_automatic') + settings_general_branch = request.form.get('settings_general_branch') + settings_general_automatic = request.form.get('settings_general_automatic') if settings_general_automatic is None: settings_general_automatic = 'False' else: settings_general_automatic = 'True' - settings_general_update_restart = request.forms.get('settings_general_update_restart') + settings_general_update_restart = request.form.get('settings_general_update_restart') if settings_general_update_restart is None: settings_general_update_restart = 'False' else: settings_general_update_restart = 'True' - settings_analytics_enabled = request.forms.get('settings_analytics_enabled') + settings_analytics_enabled = request.form.get('settings_analytics_enabled') if settings_analytics_enabled is None: settings_analytics_enabled = 'False' else: settings_analytics_enabled = 'True' - settings_general_single_language = request.forms.get('settings_general_single_language') + settings_general_single_language = request.form.get('settings_general_single_language') if settings_general_single_language is None: settings_general_single_language = 'False' else: settings_general_single_language = 'True' - settings_general_wanted_search_frequency = request.forms.get('settings_general_wanted_search_frequency') - settings_general_scenename = request.forms.get('settings_general_scenename') + settings_general_wanted_search_frequency = request.form.get('settings_general_wanted_search_frequency') + settings_general_scenename = request.form.get('settings_general_scenename') if settings_general_scenename is None: settings_general_scenename = 'False' else: settings_general_scenename = 'True' - settings_general_embedded = request.forms.get('settings_general_embedded') + settings_general_embedded = request.form.get('settings_general_embedded') if settings_general_embedded is None: settings_general_embedded = 'False' else: settings_general_embedded = 'True' - settings_general_utf8_encode = request.forms.get('settings_general_utf8_encode') + settings_general_utf8_encode = request.form.get('settings_general_utf8_encode') if settings_general_utf8_encode is None: settings_general_utf8_encode = 'False' else: settings_general_utf8_encode = 'True' - settings_general_ignore_pgs = request.forms.get('settings_general_ignore_pgs') + settings_general_ignore_pgs = request.form.get('settings_general_ignore_pgs') if settings_general_ignore_pgs is None: settings_general_ignore_pgs = 'False' else: settings_general_ignore_pgs = 'True' - settings_general_adaptive_searching = request.forms.get('settings_general_adaptive_searching') + settings_general_adaptive_searching = request.form.get('settings_general_adaptive_searching') if settings_general_adaptive_searching is None: settings_general_adaptive_searching = 'False' else: settings_general_adaptive_searching = 'True' - settings_general_multithreading = request.forms.get('settings_general_multithreading') + settings_general_multithreading = request.form.get('settings_general_multithreading') if settings_general_multithreading is None: settings_general_multithreading = 'False' else: settings_general_multithreading = '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') + settings_general_minimum_score = request.form.get('settings_general_minimum_score') + settings_general_minimum_score_movies = request.form.get('settings_general_minimum_score_movies') + settings_general_use_postprocessing = request.form.get('settings_general_use_postprocessing') if settings_general_use_postprocessing is None: settings_general_use_postprocessing = 'False' else: settings_general_use_postprocessing = 'True' - settings_general_postprocessing_cmd = request.forms.get('settings_general_postprocessing_cmd') - settings_general_use_sonarr = request.forms.get('settings_general_use_sonarr') + settings_general_postprocessing_cmd = request.form.get('settings_general_postprocessing_cmd') + settings_general_use_sonarr = request.form.get('settings_general_use_sonarr') if settings_general_use_sonarr is None: settings_general_use_sonarr = 'False' else: settings_general_use_sonarr = 'True' - settings_general_use_radarr = request.forms.get('settings_general_use_radarr') + settings_general_use_radarr = request.form.get('settings_general_use_radarr') if settings_general_use_radarr is None: settings_general_use_radarr = 'False' else: settings_general_use_radarr = 'True' - 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') + settings_page_size = request.form.get('settings_page_size') + settings_subfolder = request.form.get('settings_subfolder') + settings_subfolder_custom = request.form.get('settings_subfolder_custom') + settings_upgrade_subs = request.form.get('settings_upgrade_subs') if settings_upgrade_subs is None: settings_upgrade_subs = 'False' else: settings_upgrade_subs = 'True' - settings_upgrade_subs_frequency = request.forms.get('settings_upgrade_subs_frequency') - settings_days_to_upgrade_subs = request.forms.get('settings_days_to_upgrade_subs') - settings_upgrade_manual = request.forms.get('settings_upgrade_manual') + settings_upgrade_subs_frequency = request.form.get('settings_upgrade_subs_frequency') + settings_days_to_upgrade_subs = request.form.get('settings_days_to_upgrade_subs') + settings_upgrade_manual = request.form.get('settings_upgrade_manual') if settings_upgrade_manual is None: settings_upgrade_manual = 'False' else: settings_upgrade_manual = 'True' - settings_anti_captcha_provider = request.forms.get('settings_anti_captcha_provider') - settings_anti_captcha_key = request.forms.get('settings_anti_captcha_key') - settings_death_by_captcha_username = request.forms.get('settings_death_by_captcha_username') - settings_death_by_captcha_password = request.forms.get('settings_death_by_captcha_password') - + settings_anti_captcha_provider = request.form.get('settings_anti_captcha_provider') + settings_anti_captcha_key = request.form.get('settings_anti_captcha_key') + settings_death_by_captcha_username = request.form.get('settings_death_by_captcha_username') + settings_death_by_captcha_password = request.form.get('settings_death_by_captcha_password') + before = (six.text_type(settings.general.ip), int(settings.general.port), six.text_type(settings.general.base_url), six.text_type(settings.general.path_mappings), six.text_type(settings.general.getboolean('use_sonarr')), six.text_type(settings.general.getboolean('use_radarr')), six.text_type(settings.general.path_mappings_movie)) after = (six.text_type(settings_general_ip), int(settings_general_port), six.text_type(settings_general_baseurl), six.text_type(settings_general_pathmapping), six.text_type(settings_general_use_sonarr), six.text_type(settings_general_use_radarr), six.text_type(settings_general_pathmapping_movie)) - + 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) @@ -1357,7 +1354,7 @@ def save_settings(): settings.anticaptcha.anti_captcha_key = text_type(settings_anti_captcha_key) settings.deathbycaptcha.username = text_type(settings_death_by_captcha_username) settings.deathbycaptcha.password = text_type(settings_death_by_captcha_password) - + # set anti-captcha provider and key if settings.general.anti_captcha_provider == 'anti-captcha': os.environ["ANTICAPTCHA_CLASS"] = 'AntiCaptchaProxyLess' @@ -1368,24 +1365,24 @@ def save_settings(): {settings.deathbycaptcha.username, settings.deathbycaptcha.password})) else: os.environ["ANTICAPTCHA_CLASS"] = '' - + settings.general.minimum_score_movie = text_type(settings_general_minimum_score_movies) settings.general.use_embedded_subs = text_type(settings_general_embedded) settings.general.utf8_encode = text_type(settings_general_utf8_encode) settings.general.ignore_pgs_subs = text_type(settings_general_ignore_pgs) settings.general.adaptive_searching = text_type(settings_general_adaptive_searching) settings.general.multithreading = text_type(settings_general_multithreading) - + if after != before: configured() - - settings_proxy_type = request.forms.get('settings_proxy_type') - settings_proxy_url = request.forms.get('settings_proxy_url') - settings_proxy_port = request.forms.get('settings_proxy_port') - settings_proxy_username = request.forms.get('settings_proxy_username') - settings_proxy_password = request.forms.get('settings_proxy_password') - settings_proxy_exclude = request.forms.get('settings_proxy_exclude') - + + settings_proxy_type = request.form.get('settings_proxy_type') + settings_proxy_url = request.form.get('settings_proxy_url') + settings_proxy_port = request.form.get('settings_proxy_port') + settings_proxy_username = request.form.get('settings_proxy_username') + settings_proxy_password = request.form.get('settings_proxy_password') + settings_proxy_exclude = request.form.get('settings_proxy_exclude') + before_proxy_password = (six.text_type(settings.proxy.type), six.text_type(settings.proxy.exclude)) if before_proxy_password[0] != settings_proxy_type: configured() @@ -1402,11 +1399,11 @@ def save_settings(): settings.proxy.username = text_type(settings_proxy_username) settings.proxy.password = text_type(settings_proxy_password) settings.proxy.exclude = text_type(settings_proxy_exclude) - - settings_auth_type = request.forms.get('settings_auth_type') - settings_auth_username = request.forms.get('settings_auth_username') - settings_auth_password = request.forms.get('settings_auth_password') - + + settings_auth_type = request.form.get('settings_auth_type') + settings_auth_username = request.form.get('settings_auth_username') + settings_auth_password = request.form.get('settings_auth_password') + if settings.auth.type != settings_auth_type: configured() if settings.auth.password == settings_auth_password: @@ -1439,25 +1436,25 @@ def save_settings(): pass else: aaa._beaker_session.delete() - settings.auth.apikey = request.forms.get('settings_auth_apikey') + settings.auth.apikey = request.form.get('settings_auth_apikey') - 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') - settings_sonarr_ssl = request.forms.get('settings_sonarr_ssl') + settings_sonarr_ip = request.form.get('settings_sonarr_ip') + settings_sonarr_port = request.form.get('settings_sonarr_port') + settings_sonarr_baseurl = request.form.get('settings_sonarr_baseurl') + settings_sonarr_ssl = request.form.get('settings_sonarr_ssl') if settings_sonarr_ssl is None: settings_sonarr_ssl = 'False' else: settings_sonarr_ssl = 'True' - settings_sonarr_apikey = request.forms.get('settings_sonarr_apikey') - settings_sonarr_only_monitored = request.forms.get('settings_sonarr_only_monitored') + settings_sonarr_apikey = request.form.get('settings_sonarr_apikey') + settings_sonarr_only_monitored = request.form.get('settings_sonarr_only_monitored') if settings_sonarr_only_monitored is None: settings_sonarr_only_monitored = 'False' else: settings_sonarr_only_monitored = 'True' - settings_sonarr_sync = request.forms.get('settings_sonarr_sync') - settings_sonarr_sync_day = request.forms.get('settings_sonarr_sync_day') - settings_sonarr_sync_hour = request.forms.get('settings_sonarr_sync_hour') + settings_sonarr_sync = request.form.get('settings_sonarr_sync') + settings_sonarr_sync_day = request.form.get('settings_sonarr_sync_day') + settings_sonarr_sync_hour = request.form.get('settings_sonarr_sync_hour') settings.sonarr.ip = text_type(settings_sonarr_ip) settings.sonarr.port = text_type(settings_sonarr_port) @@ -1469,23 +1466,23 @@ def save_settings(): settings.sonarr.full_update_day = text_type(settings_sonarr_sync_day) settings.sonarr.full_update_hour = text_type(settings_sonarr_sync_hour) - settings_radarr_ip = request.forms.get('settings_radarr_ip') - settings_radarr_port = request.forms.get('settings_radarr_port') - settings_radarr_baseurl = request.forms.get('settings_radarr_baseurl') - settings_radarr_ssl = request.forms.get('settings_radarr_ssl') + settings_radarr_ip = request.form.get('settings_radarr_ip') + settings_radarr_port = request.form.get('settings_radarr_port') + settings_radarr_baseurl = request.form.get('settings_radarr_baseurl') + settings_radarr_ssl = request.form.get('settings_radarr_ssl') if settings_radarr_ssl is None: settings_radarr_ssl = 'False' else: settings_radarr_ssl = 'True' - settings_radarr_apikey = request.forms.get('settings_radarr_apikey') - settings_radarr_only_monitored = request.forms.get('settings_radarr_only_monitored') + settings_radarr_apikey = request.form.get('settings_radarr_apikey') + settings_radarr_only_monitored = request.form.get('settings_radarr_only_monitored') if settings_radarr_only_monitored is None: settings_radarr_only_monitored = 'False' else: settings_radarr_only_monitored = 'True' - settings_radarr_sync = request.forms.get('settings_radarr_sync') - settings_radarr_sync_day = request.forms.get('settings_radarr_sync_day') - settings_radarr_sync_hour = request.forms.get('settings_radarr_sync_hour') + settings_radarr_sync = request.form.get('settings_radarr_sync') + settings_radarr_sync_day = request.form.get('settings_radarr_sync_day') + settings_radarr_sync_hour = request.form.get('settings_radarr_sync_hour') settings.radarr.ip = text_type(settings_radarr_ip) settings.radarr.port = text_type(settings_radarr_port) @@ -1497,102 +1494,102 @@ def save_settings(): settings.radarr.full_update_day = text_type(settings_radarr_sync_day) settings.radarr.full_update_hour = text_type(settings_radarr_sync_hour) - settings_subliminal_providers = request.forms.getall('settings_subliminal_providers') + settings_subliminal_providers = request.form.getlist('settings_subliminal_providers') settings.general.enabled_providers = u'' if not settings_subliminal_providers else ','.join( settings_subliminal_providers) - - settings_addic7ed_random_agents = request.forms.get('settings_addic7ed_random_agents') + + settings_addic7ed_random_agents = request.form.get('settings_addic7ed_random_agents') if settings_addic7ed_random_agents is None: settings_addic7ed_random_agents = 'False' else: settings_addic7ed_random_agents = 'True' - - settings_opensubtitles_vip = request.forms.get('settings_opensubtitles_vip') + + settings_opensubtitles_vip = request.form.get('settings_opensubtitles_vip') if settings_opensubtitles_vip is None: settings_opensubtitles_vip = 'False' else: settings_opensubtitles_vip = 'True' - - settings_opensubtitles_ssl = request.forms.get('settings_opensubtitles_ssl') + + settings_opensubtitles_ssl = request.form.get('settings_opensubtitles_ssl') if settings_opensubtitles_ssl is None: settings_opensubtitles_ssl = 'False' else: settings_opensubtitles_ssl = 'True' - - settings_opensubtitles_skip_wrong_fps = request.forms.get('settings_opensubtitles_skip_wrong_fps') + + settings_opensubtitles_skip_wrong_fps = request.form.get('settings_opensubtitles_skip_wrong_fps') if settings_opensubtitles_skip_wrong_fps is None: settings_opensubtitles_skip_wrong_fps = 'False' else: settings_opensubtitles_skip_wrong_fps = 'True' - - settings.addic7ed.username = request.forms.get('settings_addic7ed_username') - settings.addic7ed.password = request.forms.get('settings_addic7ed_password') + + settings.addic7ed.username = request.form.get('settings_addic7ed_username') + settings.addic7ed.password = request.form.get('settings_addic7ed_password') settings.addic7ed.random_agents = text_type(settings_addic7ed_random_agents) - settings.assrt.token = request.forms.get('settings_assrt_token') - settings.legendastv.username = request.forms.get('settings_legendastv_username') - settings.legendastv.password = request.forms.get('settings_legendastv_password') - settings.opensubtitles.username = request.forms.get('settings_opensubtitles_username') - settings.opensubtitles.password = request.forms.get('settings_opensubtitles_password') + settings.assrt.token = request.form.get('settings_assrt_token') + settings.legendastv.username = request.form.get('settings_legendastv_username') + settings.legendastv.password = request.form.get('settings_legendastv_password') + settings.opensubtitles.username = request.form.get('settings_opensubtitles_username') + settings.opensubtitles.password = request.form.get('settings_opensubtitles_password') settings.opensubtitles.vip = text_type(settings_opensubtitles_vip) settings.opensubtitles.ssl = text_type(settings_opensubtitles_ssl) settings.opensubtitles.skip_wrong_fps = text_type(settings_opensubtitles_skip_wrong_fps) - settings.xsubs.username = request.forms.get('settings_xsubs_username') - settings.xsubs.password = request.forms.get('settings_xsubs_password') - settings.napisy24.username = request.forms.get('settings_napisy24_username') - settings.napisy24.password = request.forms.get('settings_napisy24_password') - settings.subscene.username = request.forms.get('settings_subscene_username') - settings.subscene.password = request.forms.get('settings_subscene_password') - settings.titlovi.username = request.forms.get('settings_titlovi_username') - settings.titlovi.password = request.forms.get('settings_titlovi_password') - settings.betaseries.token = request.forms.get('settings_betaseries_token') - - settings_subliminal_languages = request.forms.getall('settings_subliminal_languages') + settings.xsubs.username = request.form.get('settings_xsubs_username') + settings.xsubs.password = request.form.get('settings_xsubs_password') + settings.napisy24.username = request.form.get('settings_napisy24_username') + settings.napisy24.password = request.form.get('settings_napisy24_password') + settings.subscene.username = request.form.get('settings_subscene_username') + settings.subscene.password = request.form.get('settings_subscene_password') + settings.titlovi.username = request.form.get('settings_titlovi_username') + settings.titlovi.password = request.form.get('settings_titlovi_password') + settings.betaseries.token = request.form.get('settings_betaseries_token') + + settings_subliminal_languages = request.form.getlist('settings_subliminal_languages') database.execute("UPDATE table_settings_languages SET enabled=0") for item in settings_subliminal_languages: database.execute("UPDATE table_settings_languages SET enabled=1 WHERE code2=?", (item,)) - - settings_serie_default_enabled = request.forms.get('settings_serie_default_enabled') + + settings_serie_default_enabled = request.form.get('settings_serie_default_enabled') if settings_serie_default_enabled is None: settings_serie_default_enabled = 'False' else: settings_serie_default_enabled = 'True' settings.general.serie_default_enabled = text_type(settings_serie_default_enabled) - - settings_serie_default_languages = str(request.forms.getall('settings_serie_default_languages')) + + settings_serie_default_languages = str(request.form.getlist('settings_serie_default_languages')) if settings_serie_default_languages == "['None']": settings_serie_default_languages = 'None' settings.general.serie_default_language = text_type(settings_serie_default_languages) - - settings_serie_default_hi = request.forms.get('settings_serie_default_hi') + + settings_serie_default_hi = request.form.get('settings_serie_default_hi') if settings_serie_default_hi is None: settings_serie_default_hi = 'False' else: settings_serie_default_hi = 'True' settings.general.serie_default_hi = text_type(settings_serie_default_hi) - - settings_serie_default_forced = str(request.forms.get('settings_serie_default_forced')) + + settings_serie_default_forced = str(request.form.get('settings_serie_default_forced')) settings.general.serie_default_forced = text_type(settings_serie_default_forced) - - settings_movie_default_enabled = request.forms.get('settings_movie_default_enabled') + + settings_movie_default_enabled = request.form.get('settings_movie_default_enabled') if settings_movie_default_enabled is None: settings_movie_default_enabled = 'False' else: settings_movie_default_enabled = 'True' settings.general.movie_default_enabled = text_type(settings_movie_default_enabled) - - settings_movie_default_languages = str(request.forms.getall('settings_movie_default_languages')) + + settings_movie_default_languages = str(request.form.getlist('settings_movie_default_languages')) if settings_movie_default_languages == "['None']": settings_movie_default_languages = 'None' settings.general.movie_default_language = text_type(settings_movie_default_languages) - settings_movie_default_hi = request.forms.get('settings_movie_default_hi') + settings_movie_default_hi = request.form.get('settings_movie_default_hi') if settings_movie_default_hi is None: settings_movie_default_hi = 'False' else: settings_movie_default_hi = 'True' settings.general.movie_default_hi = text_type(settings_movie_default_hi) - settings_movie_default_forced = str(request.forms.get('settings_movie_default_forced')) + settings_movie_default_forced = str(request.form.get('settings_movie_default_forced')) settings.general.movie_default_forced = text_type(settings_movie_default_forced) with open(os.path.join(args.config_dir, 'config', 'config.ini'), 'w+') as handle: @@ -1602,12 +1599,12 @@ def save_settings(): notifiers = database.execute("SELECT * FROM table_settings_notifier ORDER BY name") for notifier in notifiers: - enabled = request.forms.get('settings_notifier_' + notifier['name'] + '_enabled') + enabled = request.form.get('settings_notifier_' + notifier['name'] + '_enabled') if enabled == 'on': enabled = 1 else: enabled = 0 - notifier_url = request.forms.get('settings_notifier_' + notifier['name'] + '_url') + notifier_url = request.form.get('settings_notifier_' + notifier['name'] + '_url') database.execute("UPDATE table_settings_notifier SET enabled=?, url=? WHERE name=?", (enabled,notifier_url,notifier['name'])) @@ -1625,8 +1622,8 @@ def save_settings(): redirect(ref + "?saved=true") -@route(base_url + 'check_update') -@custom_auth_basic(check_credentials) +@app.route(base_url + 'check_update') +# @custom_auth_basic(check_credentials) def check_update(): authorize() ref = request.environ['HTTP_REFERER'] @@ -1637,8 +1634,8 @@ def check_update(): redirect(ref) -@route(base_url + 'system') -@custom_auth_basic(check_credentials) +@app.route(base_url + 'system') +# @custom_auth_basic(check_credentials) def system(): authorize() @@ -1713,7 +1710,7 @@ def system(): page_size = int(settings.general.page_size) - return template('system', bazarr_version=bazarr_version, + return render_template('system', bazarr_version=bazarr_version, sonarr_version=sonarr_version, radarr_version=radarr_version, operating_system=platform.platform(), python_version=platform.python_version(), config_dir=args.config_dir, bazarr_dir=os.path.normcase(os.path.dirname(os.path.dirname(__file__))), @@ -1721,8 +1718,8 @@ def system(): current_port=settings.general.port, throttled_providers=throttled_providers) -@route(base_url + 'logs') -@custom_auth_basic(check_credentials) +@app.route(base_url + 'logs') +# @custom_auth_basic(check_credentials) def get_logs(): authorize() logs = [] @@ -1736,8 +1733,8 @@ def get_logs(): return dict(data=logs) -@route(base_url + 'execute/') -@custom_auth_basic(check_credentials) +@app.route(base_url + 'execute/') +# @custom_auth_basic(check_credentials) def execute_task(taskid): authorize() ref = request.environ['HTTP_REFERER'] @@ -1747,15 +1744,15 @@ def execute_task(taskid): redirect(ref) -@route(base_url + 'remove_subtitles', method='POST') -@custom_auth_basic(check_credentials) +@app.route(base_url + 'remove_subtitles', methods=['POST']) +# @custom_auth_basic(check_credentials) def remove_subtitles(): authorize() - episodePath = request.forms.get('episodePath') - language = request.forms.get('language') - subtitlesPath = request.forms.get('subtitlesPath') - sonarrSeriesId = request.forms.get('sonarrSeriesId') - sonarrEpisodeId = request.forms.get('sonarrEpisodeId') + episodePath = request.form.get('episodePath') + language = request.form.get('language') + subtitlesPath = request.form.get('subtitlesPath') + sonarrSeriesId = request.form.get('sonarrSeriesId') + sonarrEpisodeId = request.form.get('sonarrEpisodeId') try: os.remove(subtitlesPath) @@ -1766,14 +1763,14 @@ def remove_subtitles(): store_subtitles(path_replace_reverse(episodePath), episodePath) -@route(base_url + 'remove_subtitles_movie', method='POST') -@custom_auth_basic(check_credentials) +@app.route(base_url + 'remove_subtitles_movie', methods=['POST']) +# @custom_auth_basic(check_credentials) def remove_subtitles_movie(): authorize() - moviePath = request.forms.get('moviePath') - language = request.forms.get('language') - subtitlesPath = request.forms.get('subtitlesPath') - radarrId = request.forms.get('radarrId') + moviePath = request.form.get('moviePath') + language = request.form.get('language') + subtitlesPath = request.form.get('subtitlesPath') + radarrId = request.form.get('radarrId') try: os.remove(subtitlesPath) @@ -1784,20 +1781,20 @@ def remove_subtitles_movie(): store_subtitles_movie(path_replace_reverse_movie(moviePath), moviePath) -@route(base_url + 'get_subtitle', method='POST') -@custom_auth_basic(check_credentials) +@app.route(base_url + 'get_subtitle', methods=['POST']) +# @custom_auth_basic(check_credentials) def get_subtitle(): authorize() ref = request.environ['HTTP_REFERER'] - episodePath = request.forms.get('episodePath') - sceneName = request.forms.get('sceneName') - language = request.forms.get('language') - hi = request.forms.get('hi') - forced = request.forms.get('forced') - sonarrSeriesId = request.forms.get('sonarrSeriesId') - sonarrEpisodeId = request.forms.get('sonarrEpisodeId') - title = request.forms.get('title') + episodePath = request.form.get('episodePath') + sceneName = request.form.get('sceneName') + language = request.form.get('language') + hi = request.form.get('hi') + forced = request.form.get('forced') + sonarrSeriesId = request.form.get('sonarrSeriesId') + sonarrEpisodeId = request.form.get('sonarrEpisodeId') + title = request.form.get('title') providers_list = get_providers() providers_auth = get_providers_auth() @@ -1820,17 +1817,17 @@ def get_subtitle(): pass -@route(base_url + 'manual_search', method='POST') -@custom_auth_basic(check_credentials) +@app.route(base_url + 'manual_search', methods=['POST']) +# @custom_auth_basic(check_credentials) def manual_search_json(): authorize() - episodePath = request.forms.get('episodePath') - sceneName = request.forms.get('sceneName') - language = request.forms.get('language') - hi = request.forms.get('hi') - forced = request.forms.get('forced') - title = request.forms.get('title') + episodePath = request.form.get('episodePath') + sceneName = request.form.get('sceneName') + language = request.form.get('language') + hi = request.form.get('hi') + forced = request.form.get('forced') + title = request.form.get('title') providers_list = get_providers() providers_auth = get_providers_auth() @@ -1839,22 +1836,22 @@ def manual_search_json(): return dict(data=data) -@route(base_url + 'manual_get_subtitle', method='POST') -@custom_auth_basic(check_credentials) +@app.route(base_url + 'manual_get_subtitle', methods=['POST']) +# @custom_auth_basic(check_credentials) def manual_get_subtitle(): authorize() ref = request.environ['HTTP_REFERER'] - episodePath = request.forms.get('episodePath') - sceneName = request.forms.get('sceneName') - language = request.forms.get('language') - hi = request.forms.get('hi') - forced = request.forms.get('forced') - selected_provider = request.forms.get('provider') - subtitle = request.forms.get('subtitle') - sonarrSeriesId = request.forms.get('sonarrSeriesId') - sonarrEpisodeId = request.forms.get('sonarrEpisodeId') - title = request.forms.get('title') + episodePath = request.form.get('episodePath') + sceneName = request.form.get('sceneName') + language = request.form.get('language') + hi = request.form.get('hi') + forced = request.form.get('forced') + selected_provider = request.form.get('provider') + subtitle = request.form.get('subtitle') + sonarrSeriesId = request.form.get('sonarrSeriesId') + sonarrEpisodeId = request.form.get('sonarrEpisodeId') + title = request.form.get('title') providers_auth = get_providers_auth() @@ -1877,20 +1874,20 @@ def manual_get_subtitle(): pass -@route(base_url + 'manual_upload_subtitle', method='POST') -@custom_auth_basic(check_credentials) +@app.route(base_url + 'manual_upload_subtitle', methods=['POST']) +# @custom_auth_basic(check_credentials) def perform_manual_upload_subtitle(): authorize() ref = request.environ['HTTP_REFERER'] - episodePath = request.forms.get('episodePath') - sceneName = request.forms.get('sceneName') - language = request.forms.get('language') - forced = True if request.forms.get('forced') == '1' else False + episodePath = request.form.get('episodePath') + sceneName = request.form.get('sceneName') + language = request.form.get('language') + forced = True if request.form.get('forced') == '1' else False upload = request.files.get('upload') - sonarrSeriesId = request.forms.get('sonarrSeriesId') - sonarrEpisodeId = request.forms.get('sonarrEpisodeId') - title = request.forms.get('title') + sonarrSeriesId = request.form.get('sonarrSeriesId') + sonarrEpisodeId = request.form.get('sonarrEpisodeId') + title = request.form.get('title') _, ext = os.path.splitext(upload.filename) @@ -1921,19 +1918,19 @@ def perform_manual_upload_subtitle(): pass -@route(base_url + 'get_subtitle_movie', method='POST') -@custom_auth_basic(check_credentials) +@app.route(base_url + 'get_subtitle_movie', methods=['POST']) +# @custom_auth_basic(check_credentials) def get_subtitle_movie(): authorize() 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') - forced = request.forms.get('forced') - radarrId = request.forms.get('radarrId') - title = request.forms.get('title') + moviePath = request.form.get('moviePath') + sceneName = request.form.get('sceneName') + language = request.form.get('language') + hi = request.form.get('hi') + forced = request.form.get('forced') + radarrId = request.form.get('radarrId') + title = request.form.get('title') providers_list = get_providers() providers_auth = get_providers_auth() @@ -1956,17 +1953,17 @@ def get_subtitle_movie(): pass -@route(base_url + 'manual_search_movie', method='POST') -@custom_auth_basic(check_credentials) +@app.route(base_url + 'manual_search_movie', methods=['POST']) +# @custom_auth_basic(check_credentials) def manual_search_movie_json(): authorize() - moviePath = request.forms.get('moviePath') - sceneName = request.forms.get('sceneName') - language = request.forms.get('language') - hi = request.forms.get('hi') - forced = request.forms.get('forced') - title = request.forms.get('title') + moviePath = request.form.get('moviePath') + sceneName = request.form.get('sceneName') + language = request.form.get('language') + hi = request.form.get('hi') + forced = request.form.get('forced') + title = request.form.get('title') providers_list = get_providers() providers_auth = get_providers_auth() @@ -1975,21 +1972,21 @@ def manual_search_movie_json(): return dict(data=data) -@route(base_url + 'manual_get_subtitle_movie', method='POST') -@custom_auth_basic(check_credentials) +@app.route(base_url + 'manual_get_subtitle_movie', methods=['POST']) +# @custom_auth_basic(check_credentials) def manual_get_subtitle_movie(): authorize() 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') - forced = request.forms.get('forced') - selected_provider = request.forms.get('provider') - subtitle = request.forms.get('subtitle') - radarrId = request.forms.get('radarrId') - title = request.forms.get('title') + moviePath = request.form.get('moviePath') + sceneName = request.form.get('sceneName') + language = request.form.get('language') + hi = request.form.get('hi') + forced = request.form.get('forced') + selected_provider = request.form.get('provider') + subtitle = request.form.get('subtitle') + radarrId = request.form.get('radarrId') + title = request.form.get('title') providers_auth = get_providers_auth() @@ -2011,19 +2008,19 @@ def manual_get_subtitle_movie(): pass -@route(base_url + 'manual_upload_subtitle_movie', method='POST') -@custom_auth_basic(check_credentials) +@app.route(base_url + 'manual_upload_subtitle_movie', methods=['POST']) +# @custom_auth_basic(check_credentials) def perform_manual_upload_subtitle_movie(): authorize() ref = request.environ['HTTP_REFERER'] - moviePath = request.forms.get('moviePath') - sceneName = request.forms.get('sceneName') - language = request.forms.get('language') - forced = True if request.forms.get('forced') == '1' else False + moviePath = request.form.get('moviePath') + sceneName = request.form.get('sceneName') + language = request.form.get('language') + forced = True if request.form.get('forced') == '1' else False upload = request.files.get('upload') - radarrId = request.forms.get('radarrId') - title = request.forms.get('title') + radarrId = request.form.get('radarrId') + title = request.form.get('title') _, ext = os.path.splitext(upload.filename) @@ -2058,7 +2055,7 @@ def configured(): database.execute("UPDATE system SET configured = 1") -@route(base_url + 'api/series/wanted') +@app.route(base_url + 'api/series/wanted') def api_wanted(): data = database.execute("SELECT table_shows.title as seriesTitle, table_episodes.season || 'x' || table_episodes.episode as episode_number, " "table_episodes.title as episodeTitle, table_episodes.missing_subtitles FROM table_episodes " @@ -2073,7 +2070,7 @@ def api_wanted(): return dict(subtitles=wanted_subs) -@route(base_url + 'api/series/history') +@app.route(base_url + 'api/series/history') def api_history(): data = database.execute("SELECT table_shows.title as seriesTitle, " "table_episodes.season || 'x' || table_episodes.episode as episode_number, " @@ -2091,8 +2088,8 @@ def api_history(): return dict(subtitles=history_subs) -@route(base_url + 'api/movies/wanted') -def api_wanted(): +@app.route(base_url + 'api/movies/wanted/') +def api_movies_wanted(): data = database.execute("SELECT table_movies.title, table_movies.missing_subtitles FROM table_movies " "WHERE table_movies.missing_subtitles != '[]' ORDER BY table_movies._rowid_ DESC LIMIT 10") @@ -2103,8 +2100,8 @@ def api_wanted(): return dict(subtitles=wanted_subs) -@route(base_url + 'api/movies/history') -def api_history(): +@app.route(base_url + 'api/movies/history/') +def api_movies_history(): data = database.execute("SELECT table_movies.title, strftime('%Y-%m-%d', " "datetime(table_history_movie.timestamp, 'unixepoch')) as date, " "table_history_movie.description FROM table_history_movie " @@ -2118,8 +2115,8 @@ def api_history(): return dict(subtitles=history_subs) -@route(base_url + 'test_url//', method='GET') -@custom_auth_basic(check_credentials) +@app.route(base_url + 'test_url//', methods=['GET']) +# @custom_auth_basic(check_credentials) def test_url(protocol, url): authorize() url = six.moves.urllib.parse.unquote(url) @@ -2131,8 +2128,8 @@ def test_url(protocol, url): return dict(status=True, version=result) -@route(base_url + 'test_notification//', method='GET') -@custom_auth_basic(check_credentials) +@app.route(base_url + 'test_notification//', methods=['GET']) +# @custom_auth_basic(check_credentials) def test_notification(protocol, provider): authorize() provider = six.moves.urllib.parse.unquote(provider) @@ -2145,8 +2142,8 @@ def test_notification(protocol, provider): ) -@route(base_url + 'notifications') -@custom_auth_basic(check_credentials) +@app.route(base_url + 'notifications') +# @custom_auth_basic(check_credentials) def notifications(): authorize() if queueconfig.notifications: @@ -2155,15 +2152,15 @@ def notifications(): return None -@route(base_url + 'running_tasks') -@custom_auth_basic(check_credentials) +@app.route(base_url + 'running_tasks') +# @custom_auth_basic(check_credentials) def running_tasks_list(): authorize() return dict(tasks=running_tasks) -@route(base_url + 'episode_history/') -@custom_auth_basic(check_credentials) +@app.route(base_url + 'episode_history/') +# @custom_auth_basic(check_credentials) def episode_history(no): authorize() episode_history = database.execute("SELECT action, timestamp, language, provider, score FROM table_history " @@ -2201,8 +2198,8 @@ def episode_history(no): return dict(data=episode_history) -@route(base_url + 'movie_history/') -@custom_auth_basic(check_credentials) +@app.route(base_url + 'movie_history/') +# @custom_auth_basic(check_credentials) def movie_history(no): authorize() movie_history = database.execute("SELECT action, timestamp, language, provider, score FROM table_history_movie " @@ -2242,7 +2239,7 @@ def movie_history(no): # Don't put any route under this one -@route(base_url + 'api/help') +@app.route(base_url + 'api/help') def api_help(): endpoints = [] for route in app.app.routes: @@ -2254,10 +2251,14 @@ def api_help(): # Mute DeprecationWarning warnings.simplefilter("ignore", DeprecationWarning) -server = CherryPyWSGIServer((str(settings.general.ip), (int(args.port) if args.port else int(settings.general.port))), app) +if args.debug: + server = app.run( + host=str(settings.general.ip), port=(int(args.port) if args.port else int(settings.general.port)), debug=True) +else: + server = CherryPyWSGIServer((str(settings.general.ip), (int(args.port) if args.port else int(settings.general.port))), app) try: logging.info('BAZARR is started and waiting for request on http://' + str(settings.general.ip) + ':' + (str( args.port) if args.port else str(settings.general.port)) + str(base_url)) - server.start() + # server.start() except KeyboardInterrupt: shutdown() diff --git a/views/_main.html b/views/_main.html new file mode 100644 index 000000000..f0982d4a9 --- /dev/null +++ b/views/_main.html @@ -0,0 +1,130 @@ + + + + {% block title %} {% endblock %} + + {% block head_meta %} + + + + + + + + + + + + + + + {% endblock head_meta %} + + + + {% block head_css %} + + + + + + + + + + + + + + + + + + + + + {% endblock head_css %} + + {% block head %} + {% endblock head %} + + {% block head_tail %} + {% endblock head_tail %} + + + + +{% if password %} + {% include "password_change.html" %} +{% endif %} + +{% block page_body %} + + + {% block body %} + + {% endblock body %} + +{% endblock page_body %} + +{% block tail_js %} + + + + + + + + + + + + + + + + + + + + + + + + + + + + +{% endblock tail_js %} +{% block tail %} +{% endblock tail %} + + + \ No newline at end of file diff --git a/views/menu.tpl b/views/menu.html similarity index 100% rename from views/menu.tpl rename to views/menu.html diff --git a/views/providers.tpl b/views/providers.html similarity index 98% rename from views/providers.tpl rename to views/providers.html index e8c694411..6e0955c13 100644 --- a/views/providers.tpl +++ b/views/providers.html @@ -782,14 +782,14 @@ @@ -823,7 +823,7 @@ } $('#settings_providers').dropdown('clear'); - $('#settings_providers').dropdown('set selected',{{!enabled_providers}}); + $('#settings_providers').dropdown('set selected',{{ enabled_providers|safe }}); $('#settings_providers').dropdown(); $('#settings_providers').dropdown('setting', 'onChange', function(){ diff --git a/views/settings.tpl b/views/settings.html similarity index 95% rename from views/settings.tpl rename to views/settings.html index 6c9dc2cc0..0d87fb0a0 100644 --- a/views/settings.tpl +++ b/views/settings.html @@ -42,7 +42,7 @@
Saving settings...
- % include('menu.tpl') +{% include 'menu.html' %}
@@ -58,27 +58,27 @@
- % include('settings_general.tpl') + {% include 'settings_general.html' %}
- % include('settings_sonarr.tpl') + {% include 'settings_sonarr.html' %}
- % include('settings_radarr.tpl') + {% include 'settings_radarr.html' %}
- % include('settings_subtitles.tpl') + {% include 'settings_subtitles.html' %}
- % include('settings_notifications.tpl') + {% include 'settings_notifications.html' %}
- % include('footer.tpl') + {% include 'footer.tpl' %} diff --git a/views/settings_general.html b/views/settings_general.html new file mode 100644 index 000000000..66b5ddfa8 --- /dev/null +++ b/views/settings_general.html @@ -0,0 +1,935 @@ +
Start-Up
+
+
+
+
+ +
+
+
+
+ +
+
+
+ + + +
+ +
+
+ +
+
+
+
+ +
+
+
+ + + +
+ +
+
+ +
+
+
+ {% if settings.general.base_url == None %} + {% set base_url = "/" %} + {% else %} + {% set base_url = settings.general.base_url %} + {% endif %} + +
+
+ + + +
+ +
+
+ +
+
+
+ + +
+
+ +
+
+
+ +
+
+
+ + +
+
+
+
+
+ +
+
+
+
+ + +
+
+
+ +
+ +
+
+ +
+
+ +
+ + +
+
+
+ +
Proxy settings
+
+
+
+
+ +
+
+ +
+ + + + +
+ +
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+
+ + +
+ +
+
+ +
+
+
+
+ +
+
+
+ + + +
+ +
+
+ +
+
+
+
+ +
+
+
+ + +
+
+
+ +
Security Settings
+
+
+
+
+ +
+
+ + +
+ + + + +
+ +
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+
+ + +
+ +
+
+ +
+
+
+
+ + +
+
+
+
+
+
+ +
Integration settings
+
+
+
+
+ +
+
+
+ + +
+
+ +
+ +
+
+ +
+
+
+ + +
+
+ +
+
+
+ +
Path Mappings For TV Shows
+
+
+ {% if settings.general.path_mappings != None %} + {% set path_substitutions = ast.literal_eval(settings.general.path_mappings) %} + {% else %} + {% set path_substitutions = [] %} + {% endif %} +
+
+ +
+
+
+

+ Path for Sonarr: +

+
+
+ +
+ +
+
+
+

+ Path for Bazarr: +

+
+
+ +
+ {% for x in range(0, 5) %} + {% set path = [] %} + {% if path_substitutions[x] %} + {% set path = path_substitutions[x] %} + {% else %} + {% set path = ["", ""] %} + {% endif %} +
+
+ +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+ {% endfor %} +
+
+ +
Path Mappings For Movies
+
+
+ {% if settings.general.path_mappings_movie != None %} + {% set path_substitutions_movie = ast.literal_eval(settings.general.path_mappings_movie) %} + {% else %} + {% set path_substitutions_movie = [] %} + {% endif %} +
+
+ +
+
+
+

+ Path for Radarr: +

+
+
+ +
+ +
+
+
+

+ Path for Bazarr: +

+
+
+ +
+ {% for x in range(0, 5) %} + {% set path_movie = [] %} + {% if path_substitutions_movie[x] %} + {% set path_movie = path_substitutions_movie[x] %} + {% else %} + {% set path_movie = ["", ""] %} + {% endif %} +
+
+ +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+ {% endfor %} +
+
+ +
Post-processing
+
+
+

Be aware that the execution of post-processing command will prevent the user interface from being accessible + until completion, when downloading subtitles in interactive mode (meaning you'll see a loader during + post-processing).

+
+
+
+
+ +
+
+
+ + +
+
+ +
+ +
+
+ +
+
+
+ +
+
+
+ +
+
+ +
+
+
+
+
{{directory}}
+ The full path of the episode file parent directory. +
+
+
{{episode}}
+ The full path of the episode file. +
+
+
{{episode_name}}
+ The filename of the episode without parent directory or extension. +
+
+
{{subtitles}}
+ The full path of the subtitles file. +
+
+
{{subtitles_language}}
+ The language of the subtitles file. +
+
+
{{subtitles_language_code2}}
+ The 2-letter ISO-639 language code of the subtitles language. +
+
+
{{subtitles_language_code3}}
+ The 3-letter ISO-639 language code of the subtitles language. +
+
+
+
+
+
+ +
+
Updates
+
+
+
+
+ +
+
+ +
+ +
+ +
+
+ +
+
+
+ + +
+
+ +
+ +
+
+ +
+
+
+ + +
+
+ +
+
+
+
+ +
Analytics
+
+
+
+
+ +
+
+
+ + +
+
+
+
+
+ +
+
+ +
+
+ Send anonymous usage information, nothing that can identify you. This includes information on which + providers you use, what languages you search for, Bazarr, Python, Sonarr, Radarr and what OS version you + are using. We will use this information to prioritize features and bug fixes. Please, keep this enabled + as this is the only way we have to better understand how you use Bazarr. +
+
+
+
+ + + + \ No newline at end of file diff --git a/views/settings_general.tpl b/views/settings_general.tpl deleted file mode 100644 index d057b05eb..000000000 --- a/views/settings_general.tpl +++ /dev/null @@ -1,896 +0,0 @@ -
Start-Up
-
-
-
-
- -
-
-
-
- -
-
-
- - - -
- -
-
- -
-
-
-
- -
-
-
- - - -
- -
-
- -
-
-
- %if settings.general.base_url is None: - % base_url = "/" - %else: - % base_url = settings.general.base_url - %end - -
-
- - - -
- -
-
- -
-
-
- - -
-
- -
-
-
- -
-
-
- - -
-
-
-
-
- -
-
-
-
- - -
-
-
- -
- -
-
- -
-
- -
- - -
-
-
- -
Proxy settings
-
-
-
-
- -
-
- -
- - - - -
- -
-
- -
-
-
-
- -
-
-
-
- -
-
- -
-
-
-
- -
-
-
-
- -
-
- -
-
-
-
- -
-
-
- - -
- -
-
- -
-
-
-
- -
-
-
- - - -
- -
-
- -
-
-
-
- -
-
-
- - -
-
-
- -
Security Settings
-
-
-
-
- -
-
- - -
- - - - -
- -
-
- -
-
-
-
- -
-
-
-
- -
-
- -
-
-
-
- -
-
-
- - -
- -
-
- -
-
-
-
- - -
-
-
-
-
-
- -
Integration settings
-
-
-
-
- -
-
-
- - -
-
- -
- -
-
- -
-
-
- - -
-
- -
-
-
- -
Path Mappings For TV Shows
-
-
- %import ast - %if settings.general.path_mappings is not None: - % path_substitutions = ast.literal_eval(settings.general.path_mappings) - %else: - % path_substitutions = [] - %end -
-
- -
-
-
-

- Path for Sonarr: -

-
-
- -
- -
-
-
-

- Path for Bazarr: -

-
-
- -
- %for x in range(0, 5): - % path = [] - % try: - % path = path_substitutions[x] - % except IndexError: - % path = ["", ""] - % end -
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- %end -
-
- -
Path Mappings For Movies
-
-
- %import ast - %if settings.general.path_mappings_movie is not None: - % path_substitutions_movie = ast.literal_eval(settings.general.path_mappings_movie) - %else: - % path_substitutions_movie = [] - %end -
-
- -
-
-
-

- Path for Radarr: -

-
-
- -
- -
-
-
-

- Path for Bazarr: -

-
-
- -
- %for x in range(0, 5): - % path_movie = [] - % try: - % path_movie = path_substitutions_movie[x] - % except IndexError: - % path_movie = ["", ""] - % end -
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- %end -
-
- -
Post-processing
-
-
-

Be aware that the execution of post-processing command will prevent the user interface from being accessible until completion, when downloading subtitles in interactive mode (meaning you'll see a loader during post-processing).

-
-
-
-
- -
-
-
- - -
-
- -
- -
-
- -
-
-
- -
-
-
- -
-
- -
-
-
-
-
{{directory}}
- The full path of the episode file parent directory. -
-
-
{{episode}}
- The full path of the episode file. -
-
-
{{episode_name}}
- The filename of the episode without parent directory or extension. -
-
-
{{subtitles}}
- The full path of the subtitles file. -
-
-
{{subtitles_language}}
- The language of the subtitles file. -
-
-
{{subtitles_language_code2}}
- The 2-letter ISO-639 language code of the subtitles language. -
-
-
{{subtitles_language_code3}}
- The 3-letter ISO-639 language code of the subtitles language. -
-
-
-
-
-
- -
-
Updates
-
-
-
-
- -
-
- -
- -
- -
-
- -
-
-
- - -
-
- -
- -
-
- -
-
-
- - -
-
- -
-
-
-
- -
Analytics
-
-
-
-
- -
-
-
- - -
-
-
-
-
- -
-
- -
-
- Send anonymous usage information, nothing that can identify you. This includes information on which providers you use, what languages you search for, Bazarr, Python, Sonarr, Radarr and what OS version you are using. We will use this information to prioritize features and bug fixes. Please, keep this enabled as this is the only way we have to better understand how you use Bazarr. -
-
-
-
- - - - \ No newline at end of file diff --git a/views/settings_notifications.html b/views/settings_notifications.html new file mode 100644 index 000000000..6e48c28c3 --- /dev/null +++ b/views/settings_notifications.html @@ -0,0 +1,78 @@ +
Notifications settings
+
+
+

Thanks to caronc for his work on apprise, + which is based the notifications system.

+
+
+

Please follow instructions on his Wiki + to configure your notification providers.

+
+
+ {% for notifier in settings_notifier %} +
+
+ +
+
+
+ + +
+
+
+
+
+ +
Test + Notification +
+
+
+
+
+ {% endfor %} +
+
+ + diff --git a/views/settings_notifications.tpl b/views/settings_notifications.tpl deleted file mode 100644 index e56f8fb3c..000000000 --- a/views/settings_notifications.tpl +++ /dev/null @@ -1,72 +0,0 @@ -
Notifications settings
-
-
-

Thanks to caronc for his work on apprise, which is based the notifications system.

-
-
-

Please follow instructions on his Wiki to configure your notification providers.

-
-
- %for notifier in settings_notifier: -
-
- -
-
-
- - -
-
-
-
-
- -
Test Notification
-
-
-
-
- %end -
-
- - diff --git a/views/settings_radarr.tpl b/views/settings_radarr.html similarity index 98% rename from views/settings_radarr.tpl rename to views/settings_radarr.html index f6c0c116e..d547a9d9c 100644 --- a/views/settings_radarr.tpl +++ b/views/settings_radarr.html @@ -187,13 +187,13 @@ }); $('#settings_radarr_sync').dropdown('clear'); - $('#settings_radarr_sync').dropdown('set selected','{{!settings.radarr.full_update}}'); + $('#settings_radarr_sync').dropdown('set selected','{{settings.radarr.full_update|safe}}'); $('#settings_radarr_sync').dropdown('refresh'); $('#settings_radarr_sync_day').dropdown('clear'); - $('#settings_radarr_sync_day').dropdown('set selected','{{!settings.radarr.full_update_day}}'); + $('#settings_radarr_sync_day').dropdown('set selected','{{settings.radarr.full_update_day|safe}}'); $('#settings_radarr_sync_day').dropdown('refresh'); $('#settings_radarr_sync_hour').dropdown('clear'); - $('#settings_radarr_sync_hour').dropdown('set selected','{{!settings.radarr.full_update_hour}}'); + $('#settings_radarr_sync_hour').dropdown('set selected','{{settings.radarr.full_update_hour|safe}}'); $('#settings_radarr_sync_hour').dropdown('refresh'); $('#radarr_validate').on('click', function() { diff --git a/views/settings_sonarr.tpl b/views/settings_sonarr.html similarity index 98% rename from views/settings_sonarr.tpl rename to views/settings_sonarr.html index d5d7e8988..7fba9a63e 100644 --- a/views/settings_sonarr.tpl +++ b/views/settings_sonarr.html @@ -187,13 +187,13 @@ }); $('#settings_sonarr_sync').dropdown('clear'); - $('#settings_sonarr_sync').dropdown('set selected','{{!settings.sonarr.full_update}}'); + $('#settings_sonarr_sync').dropdown('set selected','{{settings.sonarr.full_update|safe}}'); $('#settings_sonarr_sync').dropdown('refresh'); $('#settings_sonarr_sync_day').dropdown('clear'); - $('#settings_sonarr_sync_day').dropdown('set selected','{{!settings.sonarr.full_update_day}}'); + $('#settings_sonarr_sync_day').dropdown('set selected','{{settings.sonarr.full_update_day|safe}}'); $('#settings_sonarr_sync_day').dropdown('refresh'); $('#settings_sonarr_sync_hour').dropdown('clear'); - $('#settings_sonarr_sync_hour').dropdown('set selected','{{!settings.sonarr.full_update_hour}}'); + $('#settings_sonarr_sync_hour').dropdown('set selected','{{settings.sonarr.full_update_hour|safe}}'); $('#settings_sonarr_sync_hour').dropdown('refresh'); $('#sonarr_validate').on('click', function() { diff --git a/views/settings_subtitles.html b/views/settings_subtitles.html new file mode 100644 index 000000000..c03d30330 --- /dev/null +++ b/views/settings_subtitles.html @@ -0,0 +1,876 @@ +
Subtitle Options
+
+
+
+
+ +
+
+
+ +
+
+
+ +
+
+ +
+
+
+ + +
+
+ +
+ +
+
+ +
+
+
+
+ +
+
+
+ +
+ +
+
+ +
+
+
+
+ +
+
+
+ +
+ +
+
+ +
+
+ +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+
+
+ + +
+ +
+
+ +
+
+
+ + +
+
+ + +
+ +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+ +
+
+
+ + +
+
+ + +
+ +
+
+ +
+
+
+ + +
+
+ +
+ +
+
+ +
+
+
+ + +
+
+ +
+ +
+
+ +
+
+
+ + +
+
+ +
+ +
+
+ +
+
+
+ + +
+
+ +
+ +
+
+ +
+
+
+ + +
+
+ +
+
+
+ +
Anti-Captcha Options
+
+
+
+
+ +
+
+ +
+ + +
+ +
+
+
+ +
+ +
+ +
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+ +
+ +
+ +
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+ +
+
+
+
+ +
+
+
+
+
+
+ +% include('providers.tpl') + +
Subtitles languages
+
+
+
+
+ +
+
+
+ + +
+
+ +
+ +
+
+ +
+
+
+ +
+
+
+
+
+ +
Series Default Settings
+
+
+
+
+ +
+
+
+
+ + +
+
+
+ +
+ +
+
+ +
+
+
+ +
+
+
+ +
+
+ +
+
+
+
+ + +
+
+
+
+ +
+
+ +
+
+
+ +
+
+
+
+
+ +
Movie Default Settings
+
+
+
+
+ +
+
+
+
+ + +
+
+
+ +
+ +
+
+ +
+
+
+ +
+
+
+ +
+
+ +
+
+
+
+ + +
+
+
+
+ +
+
+ +
+
+
+ +
+
+
+
+
+ + diff --git a/views/settings_subtitles.tpl b/views/settings_subtitles.tpl deleted file mode 100644 index 5d8126526..000000000 --- a/views/settings_subtitles.tpl +++ /dev/null @@ -1,831 +0,0 @@ -
Subtitle Options
-
-
-
-
- -
-
-
- -
-
-
- -
-
- -
-
-
- - -
-
- -
- -
-
- -
-
-
-
- -
-
-
- -
- -
-
- -
-
-
-
- -
-
-
- -
- -
-
- -
-
- -
- - -
- -
-
-
- -
-
-
-
- -
-
-
- - -
- -
-
- -
-
-
- - -
-
- - -
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
-
- -
-
-
-
- -
-
-
- -
-
-
- - -
-
- - -
- -
-
- -
-
-
- - -
-
- -
- -
-
- -
-
-
- - -
-
- -
- -
-
- -
-
-
- - -
-
- -
- -
-
- -
-
-
- - -
-
- -
- -
-
- -
-
-
- - -
-
- -
-
-
- -
Anti-Captcha Options
-
-
-
-
- -
-
- -
- - -
- -
-
-
- -
- -
- -
-
-
- -
-
-
-
- -
-
-
-
- -
-
-
- -
- -
- -
-
-
- -
-
-
-
- -
-
-
-
- -
-
-
- -
-
-
-
- -
-
-
-
-
-
- - % include('providers.tpl') - -
Subtitles languages
-
-
-
-
- -
-
-
- - -
-
- -
- -
-
- -
-
-
- -
-
-
-
-
- -
Series Default Settings
-
-
-
-
- -
-
-
-
- - -
-
-
- -
- -
-
- -
-
-
- -
-
-
- -
-
- -
-
-
-
- - -
-
-
-
- -
-
- -
-
-
- -
-
-
-
-
- -
Movie Default Settings
-
-
-
-
- -
-
-
-
- - -
-
-
- -
- -
-
- -
-
-
- -
-
-
- -
-
- -
-
-
-
- - -
-
-
-
- -
-
- -
-
-
- -
-
-
-
-
- - diff --git a/views/wizard.tpl b/views/wizard.html similarity index 97% rename from views/wizard.tpl rename to views/wizard.html index 69de43e4c..7583eed4c 100644 --- a/views/wizard.tpl +++ b/views/wizard.html @@ -96,7 +96,7 @@ Next - % include('wizard_general.tpl') + {% include 'wizard_general.html' %}
@@ -111,7 +111,7 @@
- % include('wizard_subtitles') + {% include 'wizard_subtitles.html' %}
- % include('wizard_sonarr.tpl') + {% include 'wizard_sonarr.html' %}
@@ -133,11 +133,11 @@ Prev
- % include('wizard_radarr') + {% include 'wizard_radarr.html' %} - % include('footer.tpl') + {% include 'footer.tpl' %} diff --git a/views/wizard_general.html b/views/wizard_general.html new file mode 100644 index 000000000..06d45dd42 --- /dev/null +++ b/views/wizard_general.html @@ -0,0 +1,201 @@ +
Start-Up
+
+
+
+
+ +
+
+
+
+ +
+
+
+ + + +
+ +
+
+ +
+
+
+
+ +
+
+
+ + + +
+ +
+
+ +
+
+
+ {% if settings.general.base_url == None %} + {% set base_url = "/" %} + {% else %} + {% set base_url = settings.general.base_url %} + {% endif %} + +
+
+ + + +
+
+
+ +
Path Mappings For TV Shows
+
+
+ {% if settings.general.path_mappings != None %} + {% set path_substitutions = ast.literal_eval(settings.general.path_mappings) %} + {% else %} + {% set path_substitutions = [] %} + {% endif %}
+ +

Path for Sonarr:

+ +

Path for Bazarr:

+ {% for x in range(0, 5) %} + {% set path = [] %} + {% if path_substitutions[x] %} + {% set path = path_substitutions[x] %} + {% else %} + {% set path = ["", ""] %} + {% endif %} +
+
+ +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+ {% endfor %} +
+
+ +
Path Mappings For Movies
+
+
+ {% if settings.general.path_mappings_movie != None %} + {% set path_substitutions_movie = ast.literal_eval(settings.general.path_mappings_movie) %} + {% else %} + {% set path_substitutions_movie = [] %} + {% endif %} +
+
+ +
+
+
+

+ Path for Radarr: +

+
+
+ +
+ +
+
+
+

+ Path for Bazarr: +

+
+
+ +
+ {% for x in range(0, 5) %} + {% set path_movie = [] %} + {% if path_substitutions_movie[x] %} + {% set path_movie = path_substitutions_movie[x] %} + {% else %} + {% set path_movie = ["", ""] %} + {% endif %} +
+
+ +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+ {% endfor %} +
+
+ + diff --git a/views/wizard_general.tpl b/views/wizard_general.tpl deleted file mode 100644 index 5cc3e8d2c..000000000 --- a/views/wizard_general.tpl +++ /dev/null @@ -1,231 +0,0 @@ -
Start-Up
-
-
-
-
- -
-
-
-
- -
-
-
- - - -
- -
-
- -
-
-
-
- -
-
-
- - - -
- -
-
- -
-
-
- %if settings.general.base_url is None: - % base_url = "/" - %else: - % base_url = settings.general.base_url - %end - -
-
- - - -
-
-
- -
Path Mappings For TV Shows
-
-
- %import ast - %if settings.general.path_mappings is not None: - % path_substitutions = ast.literal_eval(settings.general.path_mappings) - %else: - % path_substitutions = [] - %end -
-
- -
-
-
-

- Path for Sonarr: -

-
-
- -
- -
-
-
-

- Path for Bazarr: -

-
-
- -
- %for x in range(0, 5): - % path = [] - % try: - % path = path_substitutions[x] - % except IndexError: - % path = ["", ""] - % end -
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- %end -
-
- -
Path Mappings For Movies
-
-
- %import ast - %if settings.general.path_mappings_movie is not None: - % path_substitutions_movie = ast.literal_eval(settings.general.path_mappings_movie) - %else: - % path_substitutions_movie = [] - %end -
-
- -
-
-
-

- Path for Radarr: -

-
-
- -
- -
-
-
-

- Path for Bazarr: -

-
-
- -
- %for x in range(0, 5): - % path_movie = [] - % try: - % path_movie = path_substitutions_movie[x] - % except IndexError: - % path_movie = ["", ""] - % end -
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- %end -
-
- - diff --git a/views/wizard_radarr.tpl b/views/wizard_radarr.html similarity index 100% rename from views/wizard_radarr.tpl rename to views/wizard_radarr.html diff --git a/views/wizard_sonarr.tpl b/views/wizard_sonarr.html similarity index 100% rename from views/wizard_sonarr.tpl rename to views/wizard_sonarr.html diff --git a/views/wizard_subtitles.tpl b/views/wizard_subtitles.html similarity index 95% rename from views/wizard_subtitles.tpl rename to views/wizard_subtitles.html index cb8dff36a..0dd985979 100644 --- a/views/wizard_subtitles.tpl +++ b/views/wizard_subtitles.html @@ -71,7 +71,7 @@ - % include('providers.tpl') +{% include('providers.html') %}
Subtitles languages
@@ -103,13 +103,13 @@
@@ -148,11 +148,11 @@
@@ -396,19 +396,19 @@ }); $('#settings_languages').dropdown('clear'); - $('#settings_languages').dropdown('set selected',{{!enabled_languages}}); + $('#settings_languages').dropdown('set selected',{{ enabled_languages }}); $('#settings_subfolder').dropdown('clear'); - $('#settings_subfolder').dropdown('set selected', '{{!settings.general.subfolder}}'); + $('#settings_subfolder').dropdown('set selected', '{{ settings.general.subfolder }}'); - %if settings.general.serie_default_language != 'None': - $('#settings_serie_default_languages').dropdown('set selected',{{!settings.general.serie_default_language}}); - %end - %if settings.general.movie_default_language != 'None': - $('#settings_movie_default_languages').dropdown('set selected',{{!settings.general.movie_default_language}}); - %end + {% if settings.general.serie_default_language != 'None' %} + $('#settings_serie_default_languages').dropdown('set selected',{{ settings.general.serie_default_language }}); + {% endif %} + {% if settings.general.movie_default_language != 'None' %} + $('#settings_movie_default_languages').dropdown('set selected',{{ settings.general.movie_default_language }}); + {% endif %} - $('#settings_serie_default_forced').dropdown('set selected','{{!settings.general.serie_default_forced}}'); - $('#settings_movie_default_forced').dropdown('set selected','{{!settings.general.movie_default_forced}}'); + $('#settings_serie_default_forced').dropdown('set selected','{{ settings.general.serie_default_forced }}'); + $('#settings_movie_default_forced').dropdown('set selected','{{ settings.general.movie_default_forced }}'); $('#settings_languages').dropdown('setting', 'onChange', function(){ $('.form').form('validate field', 'settings_subliminal_languages');