pull/884/head
Louis Vézina 5 years ago
parent ae46a0fc49
commit e0b98337b2

@ -586,422 +586,10 @@ def wantedmovies():
return render_template('wantedmovies.html')
@app.route('/settings/')
@app.route('/settingsgeneral/')
@login_required
def _settings():
settings_languages = database.execute("SELECT * FROM table_settings_languages ORDER BY name")
settings_providers = sorted(provider_manager.names())
settings_notifier = database.execute("SELECT * FROM table_settings_notifier ORDER BY name")
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, ast=ast, args=args, sys=sys)
@app.route('/save_settings', methods=['POST'])
@login_required
def save_settings():
ref = request.environ['HTTP_REFERER']
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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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 = (str(settings.general.ip), int(settings.general.port), str(settings.general.base_url),
str(settings.general.path_mappings), str(settings.general.getboolean('use_sonarr')),
str(settings.general.getboolean('use_radarr')), str(settings.general.path_mappings_movie))
after = (str(settings_general_ip), int(settings_general_port), str(settings_general_baseurl),
str(settings_general_pathmapping), str(settings_general_use_sonarr),
str(settings_general_use_radarr), str(settings_general_pathmapping_movie))
settings.general.ip = str(settings_general_ip)
settings.general.port = str(settings_general_port)
settings.general.base_url = str(settings_general_baseurl)
settings.general.path_mappings = str(settings_general_pathmapping)
settings.general.debug = str(settings_general_debug)
settings.general.chmod_enabled = str(settings_general_chmod_enabled)
settings.general.chmod = str(settings_general_chmod)
settings.general.branch = str(settings_general_branch)
settings.general.auto_update = str(settings_general_automatic)
settings.general.update_restart = str(settings_general_update_restart)
settings.analytics.enabled = str(settings_analytics_enabled)
settings.general.single_language = str(settings_general_single_language)
settings.general.minimum_score = str(settings_general_minimum_score)
settings.general.wanted_search_frequency = str(settings_general_wanted_search_frequency)
settings.general.use_scenename = str(settings_general_scenename)
settings.general.use_postprocessing = str(settings_general_use_postprocessing)
settings.general.postprocessing_cmd = str(settings_general_postprocessing_cmd)
settings.general.use_sonarr = str(settings_general_use_sonarr)
settings.general.use_radarr = str(settings_general_use_radarr)
settings.general.path_mappings_movie = str(settings_general_pathmapping_movie)
settings.general.page_size = str(settings_page_size)
settings.general.subfolder = str(settings_subfolder)
if settings.general.subfolder == 'current':
settings.general.subfolder_custom = ''
else:
settings.general.subfolder_custom = str(settings_subfolder_custom)
settings.general.upgrade_subs = str(settings_upgrade_subs)
settings.general.upgrade_frequency = str(settings_upgrade_subs_frequency)
settings.general.days_to_upgrade_subs = str(settings_days_to_upgrade_subs)
settings.general.upgrade_manual = str(settings_upgrade_manual)
settings.general.anti_captcha_provider = str(settings_anti_captcha_provider)
settings.anticaptcha.anti_captcha_key = str(settings_anti_captcha_key)
settings.deathbycaptcha.username = str(settings_death_by_captcha_username)
settings.deathbycaptcha.password = str(settings_death_by_captcha_password)
# set anti-captcha provider and key
if settings.general.anti_captcha_provider == 'anti-captcha':
os.environ["ANTICAPTCHA_CLASS"] = 'AntiCaptchaProxyLess'
os.environ["ANTICAPTCHA_ACCOUNT_KEY"] = str(settings.anticaptcha.anti_captcha_key)
elif settings.general.anti_captcha_provider == 'death-by-captcha':
os.environ["ANTICAPTCHA_CLASS"] = 'DeathByCaptchaProxyLess'
os.environ["ANTICAPTCHA_ACCOUNT_KEY"] = str(':'.join(
{settings.deathbycaptcha.username, settings.deathbycaptcha.password}))
else:
os.environ["ANTICAPTCHA_CLASS"] = ''
settings.general.minimum_score_movie = str(settings_general_minimum_score_movies)
settings.general.use_embedded_subs = str(settings_general_embedded)
settings.general.utf8_encode = str(settings_general_utf8_encode)
settings.general.ignore_pgs_subs = str(settings_general_ignore_pgs)
settings.general.adaptive_searching = str(settings_general_adaptive_searching)
settings.general.multithreading = str(settings_general_multithreading)
if after != before:
configured()
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 = (str(settings.proxy.type), str(settings.proxy.exclude))
if before_proxy_password[0] != settings_proxy_type:
configured()
if before_proxy_password[1] == settings_proxy_password:
settings.proxy.type = str(settings_proxy_type)
settings.proxy.url = str(settings_proxy_url)
settings.proxy.port = str(settings_proxy_port)
settings.proxy.username = str(settings_proxy_username)
settings.proxy.exclude = str(settings_proxy_exclude)
else:
settings.proxy.type = str(settings_proxy_type)
settings.proxy.url = str(settings_proxy_url)
settings.proxy.port = str(settings_proxy_port)
settings.proxy.username = str(settings_proxy_username)
settings.proxy.password = str(settings_proxy_password)
settings.proxy.exclude = str(settings_proxy_exclude)
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:
settings.auth.type = str(settings_auth_type)
settings.auth.username = str(settings_auth_username)
else:
settings.auth.type = str(settings_auth_type)
settings.auth.username = str(settings_auth_username)
settings.auth.password = hashlib.md5(settings_auth_password.encode('utf-8')).hexdigest()
settings.auth.apikey = request.form.get('settings_auth_apikey')
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.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.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 = str(settings_sonarr_ip)
settings.sonarr.port = str(settings_sonarr_port)
settings.sonarr.base_url = str(settings_sonarr_baseurl)
settings.sonarr.ssl = str(settings_sonarr_ssl)
settings.sonarr.apikey = str(settings_sonarr_apikey)
settings.sonarr.only_monitored = str(settings_sonarr_only_monitored)
settings.sonarr.full_update = str(settings_sonarr_sync)
settings.sonarr.full_update_day = str(settings_sonarr_sync_day)
settings.sonarr.full_update_hour = str(settings_sonarr_sync_hour)
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.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.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 = str(settings_radarr_ip)
settings.radarr.port = str(settings_radarr_port)
settings.radarr.base_url = str(settings_radarr_baseurl)
settings.radarr.ssl = str(settings_radarr_ssl)
settings.radarr.apikey = str(settings_radarr_apikey)
settings.radarr.only_monitored = str(settings_radarr_only_monitored)
settings.radarr.full_update = str(settings_radarr_sync)
settings.radarr.full_update_day = str(settings_radarr_sync_day)
settings.radarr.full_update_hour = str(settings_radarr_sync_hour)
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.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.form.get('settings_opensubtitles_vip')
if settings_opensubtitles_vip is None:
settings_opensubtitles_vip = 'False'
else:
settings_opensubtitles_vip = 'True'
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.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.form.get('settings_addic7ed_username')
settings.addic7ed.password = request.form.get('settings_addic7ed_password')
settings.addic7ed.random_agents = str(settings_addic7ed_random_agents)
settings.assrt.token = request.form.get('settings_assrt_token')
settings.legendasdivx.username = request.form.get('settings_legendasdivx_username')
settings.legendasdivx.password = request.form.get('settings_legendasdivx_password')
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 = str(settings_opensubtitles_vip)
settings.opensubtitles.ssl = str(settings_opensubtitles_ssl)
settings.opensubtitles.skip_wrong_fps = str(settings_opensubtitles_skip_wrong_fps)
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.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 = str(settings_serie_default_enabled)
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 = str(settings_serie_default_languages)
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 = str(settings_serie_default_hi)
settings_serie_default_forced = str(request.form.get('settings_serie_default_forced'))
settings.general.serie_default_forced = str(settings_serie_default_forced)
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 = str(settings_movie_default_enabled)
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 = str(settings_movie_default_languages)
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 = str(settings_movie_default_hi)
settings_movie_default_forced = str(request.form.get('settings_movie_default_forced'))
settings.general.movie_default_forced = str(settings_movie_default_forced)
with open(os.path.join(args.config_dir, 'config', 'config.ini'), 'w+') as handle:
settings.write(handle)
configure_logging(settings.general.getboolean('debug') or args.debug)
notifiers = database.execute("SELECT * FROM table_settings_notifier ORDER BY name")
for notifier in notifiers:
enabled = request.form.get('settings_notifier_' + notifier['name'] + '_enabled')
if enabled == 'on':
enabled = 1
else:
enabled = 0
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']))
scheduler.update_configurable_tasks()
logging.info('BAZARR Settings saved succesfully.')
if ref.find('saved=true') > 0:
return redirect(ref)
else:
return redirect(ref + "?saved=true")
def settingsgeneral():
return render_template('settingsgeneral.html')
@app.route('/check_update')

@ -177,7 +177,7 @@
<li><a href="#"><i
class="fas fa-cogs"></i><span class="hide-menu"> Settings</span></a>
<ul aria-expanded="false" class="collapse">
<li><a href="/"> General</a></li>
<li><a href="{{ url_for('settingsgeneral') }}"> General</a></li>
<li><a href="/"> Sonarr</a></li>
<li><a href="/"> Radarr</a></li>
<li><a href="/"> Subtitles</a></li>

@ -1,216 +0,0 @@
{% extends '_main.html' %}
{%- from 'settings_general.html' import settings_general with context %}
{%- from 'settings_subtitles.html' import settings_subtitles with context %}
{%- from 'settings_notifications.html' import settings_notifications with context %}
{%- from 'settings_radarr.html' import settings_radarr with context %}
{%- from 'settings_sonarr.html' import settings_sonarr with context %}
{%- from 'providers.html' import settings_providers1 with context %}
{% block title %}Settings - Bazarr{% endblock %}
{% block body %}
<div class="container-fluid">
<!-- ============================================================== -->
<!-- Bread crumb and right sidebar toggle -->
<!-- ============================================================== -->
<div class="row page-titles">
<div class="col-md-5 col-8 align-self-center">
<h3 class="text-themecolor m-b-0 m-t-0"><i class="fas fa-sync"></i></h3>
</div>
<div class="col-md-7 col-4 align-self-center">
<div class="d-flex m-t-10 justify-content-end">
<div class="d-flex m-r-20 m-l-10 hidden-md-down">
<div class="chart-text m-r-10">
<h5 class="m-t-0 text-white">Some page settings</h5></div>
</div>
</div>
</div>
</div>
<!-- ============================================================== -->
<!-- End Bread crumb and right sidebar toggle -->
<!-- ============================================================== -->
<form name="settings_form" id="settings_form" action="{{ base_url }}save_settings" method="post" class="ui form"
autocomplete="off">
<div id="form_validation_error" class="ui error message">
<p>Some fields are in error and you can't save settings until you have corrected them. Be sure to check
in
every tabs.</p>
</div>
<div class="ui top attached tabular menu">
<a class="tabs item active" data-tab="general">General</a>
<a class="tabs item" id="sonarr_tab" data-tab="sonarr">Sonarr</a>
<a class="tabs item" id="radarr_tab" data-tab="radarr">Radarr</a>
<a class="tabs item" data-tab="subtitles">Subtitles</a>
<a class="tabs item" data-tab="notifier">Notifications</a>
</div>
<div class="ui bottom attached tab segment active" data-tab="general">
<div class="ui container">
<button class="submit ui blue right floated button" type="submit" value="Submit"
form="settings_form">
Save
</button>
</div>
{% include 'settings_general.html' %}
</div>
<div class="ui bottom attached tab segment" data-tab="sonarr">
<div class="ui container">
<button class="submit ui blue right floated button" type="submit" value="Submit"
form="settings_form">
Save
</button>
</div>
{% include 'settings_sonarr.html' %}
</div>
<div class="ui bottom attached tab segment" data-tab="radarr">
<div class="ui container">
<button class="submit ui blue right floated button" type="submit" value="Submit"
form="settings_form">
Save
</button>
</div>
{% include 'settings_radarr.html' %}
</div>
<div class="ui bottom attached tab segment" data-tab="subtitles">
<div class="ui container">
<button class="submit ui blue right floated button" type="submit" value="Submit"
form="settings_form">
Save
</button>
</div>
{% include 'settings_subtitles.html' %}
</div>
<div class="ui bottom attached tab segment" data-tab="notifier">
<div class="ui container">
<button class="submit ui blue right floated button" type="submit" value="Submit"
form="settings_form">
Save
</button>
</div>
{% include 'settings_notifications.html' %}
</div>
</form>
</div>
{% endblock body %}
{% block tail %}
<script src="{{ url_for('static',filename='js/settings_validation.js') }}" type="text/javascript"></script>
<script>
function getQueryVariable(variable) {
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i = 0; i < vars.length; i++) {
var pair = vars[i].split("=");
if (pair[0] == variable) {
return pair[1];
}
}
return (false);
}
if (getQueryVariable("saved") == 'true') {
new Noty({
text: 'Settings saved.',
timeout: 5000,
progressBar: false,
animation: {
open: null,
close: null
},
killer: true,
type: 'info',
layout: 'bottomRight',
theme: 'semanticui'
}).show();
}
$('.menu .item')
.tab()
;
$('a:not(.tabs), button:not(.cancel, .test, .no_loader)').on('click', function () {
$('#loader').addClass('active');
});
$('a[target="_blank"]').on('click', function () {
$('#loader').removeClass('active');
});
$(function () {
$('.form').form('validate form');
$('#loader').removeClass('active');
});
$(".form :input").on('change paste keyup focusout', function () {
$('.form').form('validate form');
$('#loader').removeClass('active');
});
// Don't move this part to settings_general.tpl as #settings_form is undefined in this template
if ($('#settings_proxy_type').val() === "None") {
$('.proxy_option').hide();
$('#settings_form').form('remove rule', 'settings_proxy_url', 'empty');
$('#settings_form').form('remove rule', 'settings_proxy_port', 'empty');
$('#settings_form').form('remove rule', 'settings_proxy_port', 'integer[1..65535]');
} else {
$('#settings_form').form('add rule', 'settings_proxy_url', {
rules: [{
type: 'empty',
prompt: '"General / Proxy settings / Hostname" must have a value'
}]
});
$('#settings_form').form('add rule', 'settings_proxy_port', {
rules: [{
type: 'empty',
prompt: '"General / Proxy settings / Port" must have a value'
}]
});
$('#settings_form').form('add rule', 'settings_proxy_port', {
rules: [{
type: 'integer[1..65535]',
prompt: '"General / Proxy settings / Port" must be an integer between 1 and 65535'
}]
});
}
// Don't move this part to settings_general.tpl as #settings_form is undefined in this template
$('#settings_proxy_type').dropdown('setting', 'onChange', function () {
if ($('#settings_proxy_type').val() === "None") {
$('.proxy_option').hide();
$('#settings_form').form('remove rule', 'settings_proxy_url', 'empty');
$('#settings_form').form('remove rule', 'settings_proxy_port', 'empty');
$('#settings_form').form('remove rule', 'settings_proxy_port', 'integer[1..65535]');
$('.form').form('validate form');
$('#loader').removeClass('active');
} else {
$('.proxy_option').show();
$('#settings_form').form('add rule', 'settings_proxy_url', {
rules: [{
type: 'empty',
prompt: '"General / Proxy settings / Hostname" must have a value'
}]
});
$('#settings_form').form('add rule', 'settings_proxy_port', {
rules: [{
type: 'empty',
prompt: '"General / Proxy settings / Port" must have a value'
}]
});
$('#settings_form').form('add rule', 'settings_proxy_port', {
rules: [{
type: 'integer[1..65535]',
prompt: '"General / Proxy settings / Port" must be an integer between 1 and 65535'
}]
});
$('.form').form('validate form');
$('#loader').removeClass('active');
}
});
</script>
{{ settings_general() }}
{{ settings_subtitles() }}
{{ settings_notifications() }}
{{ settings_radarr() }}
{{ settings_sonarr() }}
{{ settings_providers1() }}
{% endblock tail %}

@ -1,935 +0,0 @@
<div class="ui dividing header">Start-Up</div>
<div class="twelve wide column">
<div class="ui grid">
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>Listening IP Address</label>
</div>
<div class="five wide column">
<div class='field'>
<div class="ui fluid input">
<input name="settings_general_ip" type="text" value="{{ settings.general.ip }}">
</div>
</div>
</div>
<div class="collapsed center aligned column">
<div class="ui basic icon" data-tooltip="Requires restart to take effect" data-inverted="">
<i class="yellow warning sign icon"></i>
</div>
</div>
<div class="collapsed center aligned column">
<div class="ui basic icon" data-tooltip="Valid IP4 Address or '0.0.0.0' for all interfaces"
data-inverted="">
<i class="help circle large icon"></i>
</div>
</div>
</div>
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>Listening Port</label>
</div>
<div class="five wide column">
<div class='field'>
<div class="ui fluid input">
<input name="settings_general_port" type="text" value="{{ settings.general.port }}">
</div>
</div>
</div>
<div class="collapsed center aligned column">
<div class="ui basic icon" data-tooltip="Requires restart to take effect" data-inverted="">
<i class="yellow warning sign icon"></i>
</div>
</div>
<div class="collapsed center aligned column">
<div class="ui basic icon" data-tooltip="Valid TCP port (default: 6767)" data-inverted="">
<i class="help circle large icon"></i>
</div>
</div>
</div>
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>Base URL</label>
</div>
<div class="five wide column">
<div class="ui fluid input">
{% if settings.general.base_url == None %}
{% set base_url = "/" %}
{% else %}
{% set base_url = settings.general.base_url %}
{% endif %}
<input name="settings_general_baseurl" type="text" value="{{ base_url }}">
</div>
</div>
<div class="collapsed center aligned column">
<div class="ui basic icon" data-tooltip="Requires restart to take effect" data-inverted="">
<i class="yellow warning sign icon"></i>
</div>
</div>
<div class="collapsed center aligned column">
<div class="ui basic icon" data-tooltip="For reverse proxy support, default is '/'" data-inverted="">
<i class="help circle large icon"></i>
</div>
</div>
</div>
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>Enable Debug Logging</label>
</div>
<div class="five wide column">
<div id="settings_debug" class="ui toggle checkbox"
data-debug={{ settings.general.getboolean('debug') }}>
<input name="settings_general_debug" type="checkbox">
<label></label>
</div>
</div>
<div class="collapsed center aligned column">
<div class="ui basic icon" data-tooltip="Debug logging should only be enabled temporarily"
data-inverted="">
<i class="help circle large icon"></i>
</div>
</div>
</div>
<div id="chmod_enabled" class="middle aligned row">
<div class="right aligned four wide column">
<label>Enable CHMOD</label>
</div>
<div class="five wide column">
<div id="settings_chmod_enabled" class="ui toggle checkbox"
data-chmod={{ settings.general.getboolean('chmod_enabled') }}>
<input name="settings_general_chmod_enabled" type="checkbox">
<label></label>
</div>
</div>
</div>
<div id="chmod" class="middle aligned row">
<div class="right aligned four wide column">
<label>Set Subtitle file permissions to</label>
</div>
<div class="five wide column">
<div class='field'>
<div id="settings_chmod" class="ui fluid input">
<input name="settings_general_chmod" type="text"
value={{ settings.general.chmod }}>
<label></label>
</div>
</div>
</div>
<div class="collapsed center aligned column">
<div class="ui basic icon" data-tooltip="Must be 4 digit octal, e.g.: 0775" data-inverted="">
<i class="help circle large icon"></i>
</div>
</div>
</div>
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>Page Size</label>
</div>
<div class="five wide column">
<select name="settings_page_size" id="settings_page_size" class="ui fluid selection dropdown">
<option value="">Page Size</option>
<option value="-1">Unlimited</option>
<option value="25">25</option>
<option value="50">50</option>
<option value="100">100</option>
<option value="250">250</option>
<option value="500">500</option>
<option value="1000">1000</option>
</select>
</div>
<div class="collapsed center aligned column">
<div class="ui basic icon" data-tooltip="How many items to show in a list." data-inverted="">
<i class="help circle large icon"></i>
</div>
</div>
</div>
</div>
</div>
<div class="ui dividing header">Proxy settings</div>
<div class="twelve wide column">
<div class="ui grid">
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>Proxy Type</label>
</div>
<div class="five wide column">
<select name="settings_proxy_type" id="settings_proxy_type" class="ui fluid selection dropdown">
<option value="None">None</option>
<option value="http">HTTP(S)</option>
<option value="socks4">Socks4</option>
<option value="socks5">Socks5</option>
</select>
</div>
<div class="collapsed center aligned column">
<div class="ui basic icon" data-tooltip="Requires restart to take effect" data-inverted="">
<i class="yellow warning sign icon"></i>
</div>
</div>
<div class="collapsed center aligned column">
<div class="ui basic icon" data-tooltip="Type of your proxy." data-inverted="">
<i class="help circle large icon"></i>
</div>
</div>
</div>
<div class="proxy_option middle aligned row">
<div class="right aligned four wide column">
<label>Hostname</label>
</div>
<div class="five wide column">
<div class='field'>
<div class="ui fluid input">
<input id="settings_proxy_url" name="settings_proxy_url" type="text"
value="{{ settings.proxy.url }}">
</div>
</div>
</div>
</div>
<div class="proxy_option middle aligned row">
<div class="right aligned four wide column">
<label>Port</label>
</div>
<div class="five wide column">
<div class='field'>
<div class="ui fluid input">
<input id="settings_proxy_port" name="settings_proxy_port" type="text"
value="{{ settings.proxy.port }}">
</div>
</div>
</div>
</div>
<div class="proxy_option middle aligned row">
<div class="right aligned four wide column">
<label>Username</label>
</div>
<div class="five wide column">
<div class='field'>
<div class="ui fluid input">
<input id="settings_proxy_username" name="settings_proxy_username" type="text"
value="{{ settings.proxy.username }}">
</div>
</div>
</div>
<div class="collapsed center aligned column">
<div class="ui basic icon"
data-tooltip="UYou only need to enter a username and password if one is required. Leave them blank otherwise"
data-inverted="">
<i class="help circle large icon"></i>
</div>
</div>
</div>
<div class="proxy_option middle aligned row">
<div class="right aligned four wide column">
<label>Password</label>
</div>
<div class="five wide column">
<div class='field'>
<div class="ui fluid input">
<input id="settings_proxy_password" name="settings_proxy_password" type="password"
value="{{ settings.proxy.password }}">
</div>
</div>
</div>
<div class="collapsed center aligned column">
<div class="ui basic icon"
data-tooltip="You only need to enter a username and password if one is required. Leave them blank otherwise"
data-inverted="">
<i class="help circle large icon"></i>
</div>
</div>
</div>
<div class="proxy_option middle aligned row">
<div class="right aligned four wide column">
<label>Ignored Addresses</label>
</div>
<div class="five wide column">
<div class='field'>
<div class="ui fluid input">
<input id="settings_proxy_exclude" name="settings_proxy_exclude" type="text"
value="{{ settings.proxy.exclude }}">
</div>
</div>
</div>
<div class="collapsed center aligned column">
<div class="ui basic icon" data-tooltip="Use ',' as a separator, and '*.' as a wildcard for subdomains"
data-inverted="">
<i class="help circle large icon"></i>
</div>
</div>
</div>
</div>
</div>
<div class="ui dividing header">Security Settings</div>
<div class="twelve wide column">
<div class="ui grid">
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>Authentication</label>
</div>
<div class="five wide column">
<select name="settings_auth_type" id="settings_auth_type" class="ui fluid selection dropdown">
<option value="None">None</option>
<option value="basic">Basic (Browser Popup)</option>
<option value="form">Forms (Login Page)</option>
</select>
<label></label>
</div>
<div class="collapsed center aligned column">
<div class="ui basic icon" data-tooltip="Requires restart to take effect" data-inverted="">
<i class="yellow warning sign icon"></i>
</div>
</div>
<div class="collapsed column">
<div class="collapsed center aligned column">
<div class="ui basic icon" data-tooltip="Require Username and Password to access Bazarr."
data-inverted="">
<i class="help circle large icon"></i>
</div>
</div>
</div>
</div>
<div class="auth_option middle aligned row">
<div class="right aligned four wide column">
<label>Username</label>
</div>
<div class="five wide column">
<div class='field'>
<div class="ui fluid input">
<input id="settings_auth_username" name="settings_auth_username" type="text" autocomplete="nope"
value="{{ settings.auth.username }}">
</div>
</div>
</div>
</div>
<div class="auth_option middle aligned row">
<div class="right aligned four wide column">
<label>Password</label>
</div>
<div class="five wide column">
<div class='field'>
<div class="ui fluid input">
<input id="settings_auth_password" name="settings_auth_password" type="password"
autocomplete="new-password" value="{{ settings.auth.password }}">
</div>
</div>
</div>
<div class="collapsed column">
<div class="collapsed center aligned column">
<div class="ui basic icon"
data-tooltip="Authentication send username and password in clear text over the network. You should add SSL encryption through a reverse proxy."
data-inverted="">
<i class="help circle large icon"></i>
</div>
</div>
</div>
</div>
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>API Key</label>
</div>
<div class="six wide column">
<div class='field'>
<div class="ui action input">
<input id="settings_auth_apikey" name="settings_auth_apikey" type="text" readonly
value="{{ settings.auth.apikey }}">
<button class="no_loader ui red icon button" type="button" onclick="generate_apikey()">
<i class="sync icon"></i>
</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="ui dividing header">Integration settings</div>
<div class="twelve wide column">
<div class="ui grid">
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>Use Sonarr</label>
</div>
<div class="one wide column">
<div id="settings_use_sonarr" class="ui toggle checkbox"
data-enabled={{ settings.general.getboolean('use_sonarr') }}>
<input name="settings_general_use_sonarr" type="checkbox">
<label></label>
</div>
</div>
<div class="collapsed column">
<div class="collapsed center aligned column">
<div class="ui basic icon" data-tooltip="Enable Sonarr Integration." data-inverted="">
<i class="help circle large icon"></i>
</div>
</div>
</div>
</div>
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>Use Radarr</label>
</div>
<div class="one wide column">
<div id="settings_use_radarr" class="ui toggle checkbox"
data-enabled={{ settings.general.getboolean('use_radarr') }}>
<input name="settings_general_use_radarr" type="checkbox">
<label></label>
</div>
</div>
<div class="collapsed column">
<div class="collapsed center aligned column">
<div class="ui basic icon" data-tooltip="Enable Radarr Integration." data-inverted="">
<i class="help circle large icon"></i>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="ui dividing header">Path Mappings For TV Shows</div>
<div class="twelve wide column">
<div class="ui grid">
{% if settings.general.path_mappings != None %}
{% set path_substitutions = ast.literal_eval(settings.general.path_mappings) %}
{% else %}
{% set path_substitutions = [] %}
{% endif %}
<div class="middle aligned row">
<div class="right aligned four wide column">
</div>
<div class="two wide column">
<div class="ui fluid input">
<h4 class="ui header">
Path for Sonarr:
</h4>
</div>
</div>
<div class="collapsed column">
<div class="collapsed center aligned column">
<div class="ui basic icon" data-tooltip="Root path to the directory Sonarr accesses."
data-inverted="">
<i class="help circle large icon"></i>
</div>
</div>
</div>
<div class="two wide center aligned column">
</div>
<div class="two wide column">
<div class="ui fluid input">
<h4 class="ui header">
Path for Bazarr:
</h4>
</div>
</div>
<div class="collapsed column">
<div class="collapsed center aligned column">
<div class="ui basic icon"
data-tooltip="Path that Bazarr should use to access the same directory remotely."
data-inverted="">
<i class="help circle large icon"></i>
</div>
</div>
</div>
</div>
{% for x in range(0, 5) %}
{% set path = [] %}
{% if path_substitutions[x] %}
{% set path = path_substitutions[x] %}
{% else %}
{% set path = ["", ""] %}
{% endif %}
<div class="middle aligned row">
<div class="right aligned four wide column">
</div>
<div class="four wide column">
<div class="ui fluid input">
<input name="settings_general_sourcepath" type="text" value="{{ path[0] }}">
</div>
</div>
<div class="center aligned column">
<i class="arrow circle right icon"></i>
</div>
<div class="four wide column">
<div class="ui fluid input">
<input name="settings_general_destpath" type="text" value="{{ path[1] }}">
</div>
</div>
</div>
{% endfor %}
</div>
</div>
<div class="ui dividing header">Path Mappings For Movies</div>
<div class="twelve wide column">
<div class="ui grid">
{% 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 %}
<div class="middle aligned row">
<div class="right aligned four wide column">
</div>
<div class="two wide column">
<div class="ui fluid input">
<h4 class="ui header">
Path for Radarr:
</h4>
</div>
</div>
<div class="collapsed column">
<div class="collapsed center aligned column">
<div class="ui basic icon" data-tooltip="Root path to the directory Radarr accesses."
data-inverted="">
<i class="help circle large icon"></i>
</div>
</div>
</div>
<div class="two wide center aligned column">
</div>
<div class="two wide column">
<div class="ui fluid input">
<h4 class="ui header">
Path for Bazarr:
</h4>
</div>
</div>
<div class="collapsed column">
<div class="collapsed center aligned column">
<div class="ui basic icon"
data-tooltip="Path that Bazarr should use to access the same directory remotely."
data-inverted="">
<i class="help circle large icon"></i>
</div>
</div>
</div>
</div>
{% 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 %}
<div class="middle aligned row">
<div class="right aligned four wide column">
</div>
<div class="four wide column">
<div class="ui fluid input">
<input name="settings_general_sourcepath_movie" type="text" value="{{ path_movie[0] }}">
</div>
</div>
<div class="center aligned column">
<i class="arrow circle right icon"></i>
</div>
<div class="four wide column">
<div class="ui fluid input">
<input name="settings_general_destpath_movie" type="text" value="{{ path_movie[1] }}">
</div>
</div>
</div>
{% endfor %}
</div>
</div>
<div class="ui dividing header">Post-processing</div>
<div class="twelve wide column">
<div class="ui orange message">
<p>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).</p>
</div>
<div class="ui grid">
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>Use post-processing</label>
</div>
<div class="one wide column">
<div id="settings_use_postprocessing" class="ui toggle checkbox"
data-postprocessing={{ settings.general.getboolean('use_postprocessing') }}>
<input name="settings_general_use_postprocessing" type="checkbox">
<label></label>
</div>
</div>
<div class="collapsed column">
<div class="collapsed center aligned column">
<div class="ui basic icon"
data-tooltip="Enable the post-processing execution after downloading a subtitles."
data-inverted="">
<i class="help circle large icon"></i>
</div>
</div>
</div>
</div>
<div class="middle aligned row postprocessing">
<div class="right aligned four wide column">
<label>Post-processing command</label>
</div>
<div class="five wide column">
<div id="settings_general_postprocessing_cmd_div" class="ui fluid input">
<input name="settings_general_postprocessing_cmd" type="text"
value="{{ settings.general.postprocessing_cmd if settings.general.postprocessing_cmd != None else '' }}">
</div>
</div>
</div>
<div class="middle aligned row postprocessing">
<div class="right aligned four wide column">
<label>Variables you can use in your command (include the double curly brace):</label>
</div>
<div class="ten wide column">
<div class="ui list">
<div class="item">
<div class="header">&lbrace;&lbrace;directory&rbrace;&rbrace;</div>
The full path of the episode file parent directory.
</div>
<div class="item">
<div class="header">&lbrace;&lbrace;episode&rbrace;&rbrace;</div>
The full path of the episode file.
</div>
<div class="item">
<div class="header">&lbrace;&lbrace;episode_name&rbrace;&rbrace;</div>
The filename of the episode without parent directory or extension.
</div>
<div class="item">
<div class="header">&lbrace;&lbrace;subtitles&rbrace;&rbrace;</div>
The full path of the subtitles file.
</div>
<div class="item">
<div class="header">&lbrace;&lbrace;subtitles_language&rbrace;&rbrace;</div>
The language of the subtitles file.
</div>
<div class="item">
<div class="header">&lbrace;&lbrace;subtitles_language_code2&rbrace;&rbrace;</div>
The 2-letter ISO-639 language code of the subtitles language.
</div>
<div class="item">
<div class="header">&lbrace;&lbrace;subtitles_language_code3&rbrace;&rbrace;</div>
The 3-letter ISO-639 language code of the subtitles language.
</div>
</div>
</div>
</div>
</div>
</div>
<div id="div_update">
<div class="ui dividing header">Updates</div>
<div class="twelve wide column">
<div class="ui grid">
<div class="middle aligned row" id="div_branch">
<div class="right aligned four wide column">
<label>Branch</label>
</div>
<div class="five wide column">
<select name="settings_general_branch" id="settings_branch" class="ui fluid selection dropdown">
<option value="">Branch</option>
<option value="master">master</option>
<option value="development">development</option>
</select>
</div>
<div class="collapsed column">
<div class="collapsed center aligned column">
<div class="ui basic icon"
data-tooltip="Only select development branch if you want to live on the edge."
data-inverted="">
<i class="help circle large icon"></i>
</div>
</div>
</div>
</div>
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>Automatic</label>
</div>
<div class="one wide column">
<div id="settings_automatic_div" class="ui toggle checkbox"
data-automatic={{ settings.general.getboolean('auto_update') }}>
<input name="settings_general_automatic" type="checkbox">
<label></label>
</div>
</div>
<div class="collapsed column">
<div class="collapsed center aligned column">
<div class="ui basic icon"
data-tooltip="Automatically download and install updates. You will still be able to install from System: Tasks"
data-inverted="">
<i class="help circle large icon"></i>
</div>
</div>
</div>
</div>
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>Restart after update</label>
</div>
<div class="one wide column">
<div id="settings_update_restart" class="ui toggle checkbox"
data-update-restart={{ settings.general.getboolean('update_restart') }}>
<input name="settings_general_update_restart" type="checkbox">
<label></label>
</div>
</div>
<div class="collapsed column">
<div class="collapsed center aligned column">
<div class="ui basic icon"
data-tooltip="Automatically restart after downloading and installing updates. You will still be able to restart manually"
data-inverted="">
<i class="help circle large icon"></i>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="ui dividing header">Analytics</div>
<div class="twelve wide column">
<div class="ui grid">
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>Enable</label>
</div>
<div class="one wide column">
<div id="settings_analytics_enabled" class="ui toggle checkbox"
data-analytics={{ settings.analytics.getboolean('enabled') }}>
<input name="settings_analytics_enabled" type="checkbox">
<label></label>
</div>
</div>
</div>
<div class="middle align row">
<div class="right aligned four wide column">
</div>
<div class="one wide column">
<i class="help circle large icon"></i>
</div>
<div class="ten wide column">
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.
</div>
</div>
</div>
</div>
{% macro settings_general() %}
<script>
{% if args.no_update %}
$("#div_update").hide();
{% elif args.release_update %}
$("#div_branch").hide();
{% endif %}
{%if sys.platform.startswith('win')%}
$("#chmod").hide();
$("#chmod_enabled").hide();
{%endif%}
if ($('#settings_automatic_div').data("automatic") === "True") {
$("#settings_automatic_div").checkbox('check');
} else {
$("#settings_automatic_div").checkbox('uncheck');
}
if ($('#settings_update_restart').data("update-restart") === "True") {
$("#settings_update_restart").checkbox('check');
} else {
$("#settings_update_restart").checkbox('uncheck');
}
if ($('#settings_debug').data("debug") === "True") {
$("#settings_debug").checkbox('check');
} else {
$("#settings_debug").checkbox('uncheck');
}
if ($('#settings_chmod_enabled').data("chmod") === "True") {
$("#settings_chmod_enabled").checkbox('check');
} else {
$("#settings_chmod_enabled").checkbox('uncheck');
}
if ($('#settings_analytics_enabled').data("analytics") === "True") {
$("#settings_analytics_enabled").checkbox('check');
} else {
$("#settings_analytics_enabled").checkbox('uncheck');
}
if ($('#settings_use_postprocessing').data("postprocessing") === "True") {
$("#settings_use_postprocessing").checkbox('check');
$("#settings_general_postprocessing_cmd_div").removeClass('disabled');
} else {
$("#settings_use_postprocessing").checkbox('uncheck');
$("#settings_general_postprocessing_cmd_div").addClass('disabled');
}
$("#settings_use_postprocessing").on('change', function (i, obj) {
if ($("#settings_use_postprocessing").checkbox('is checked')) {
$("#settings_general_postprocessing_cmd_div").removeClass('disabled');
} else {
$("#settings_general_postprocessing_cmd_div").addClass('disabled');
}
});
if ($('#settings_use_postprocessing').data("postprocessing") === "True") {
$('.postprocessing').show();
} else {
$('.postprocessing').hide();
}
$('#settings_use_postprocessing').checkbox({
onChecked: function () {
$('.postprocessing').show();
},
onUnchecked: function () {
$('.postprocessing').hide();
}
});
if ($('#settings_use_sonarr').data("enabled") === "True") {
$("#settings_use_sonarr").checkbox('check');
$("#sonarr_tab").removeClass('disabled');
} else {
$("#settings_use_sonarr").checkbox('uncheck');
$("#sonarr_tab").addClass('disabled');
}
$('#settings_use_sonarr').checkbox({
onChecked: function () {
$("#sonarr_tab").removeClass('disabled');
$('#sonarr_validated').checkbox('uncheck');
$('.form').form('validate form');
$('#loader').removeClass('active');
},
onUnchecked: function () {
$("#sonarr_tab").addClass('disabled');
}
});
if ($('#settings_use_radarr').data("enabled") === "True") {
$("#settings_use_radarr").checkbox('check');
$("#radarr_tab").removeClass('disabled');
} else {
$("#settings_use_radarr").checkbox('uncheck');
$("#radarr_tab").addClass('disabled');
}
$('#settings_use_radarr').checkbox({
onChecked: function () {
$("#radarr_tab").removeClass('disabled');
$('#radarr_validated').checkbox('uncheck');
$('.form').form('validate form');
$('#loader').removeClass('active');
},
onUnchecked: function () {
$("#radarr_tab").addClass('disabled');
}
});
if ($('#settings_chmod_enabled').data("chmod") === "True") {
$('#chmod').show();
} else {
$('#chmod').hide();
}
$('#settings_chmod_enabled').checkbox({
onChecked: function () {
$('#chmod').show();
},
onUnchecked: function () {
$('#chmod').hide();
}
});
if ($('#settings_auth_type').val() === "None") {
$('.auth_option').hide();
}
$('#settings_auth_type').dropdown('setting', 'onChange', function () {
if ($('#settings_auth_type').val() === "None") {
$('.auth_option').hide();
} else {
$('.auth_option').show();
}
});
// Load default value for Settings_auth_type
$('#settings_auth_type').dropdown('clear');
$('#settings_auth_type').dropdown('set selected', '{{settings.auth.type|safe}}');
// Remove value from Password input when changing to Form login to prevent bad password saving
$("#settings_auth_type").on('change', function () {
if ($(this).val() === 'form') {
$('#settings_auth_password').val('');
} else {
$('#settings_auth_password').val('{{settings.auth.password}}');
}
});
$('#settings_loglevel').dropdown('clear');
$('#settings_loglevel').dropdown('set selected', '{{settings.general.getboolean('debug')|safe}}');
$('#settings_page_size').dropdown('clear');
$('#settings_page_size').dropdown('set selected', '{{settings.general.page_size|safe}}');
$('#settings_proxy_type').dropdown('clear');
$('#settings_proxy_type').dropdown('set selected', '{{settings.proxy.type|safe}}');
$('#settings_branch').dropdown('clear');
$('#settings_branch').dropdown('set selected', '{{settings.general.branch|safe}}');
$('#settings_auth_username').on('keyup', function () {
$('#settings_auth_password').val('');
$('.form').form('validate form');
$('#loader').removeClass('active');
});
function generate_apikey() {
var result = '';
var characters = 'abcdef0123456789';
var charactersLength = characters.length;
for (var i = 0; i < 32; i++) {
result += characters.charAt(Math.floor(Math.random() * charactersLength));
}
$("#settings_auth_apikey").val(result);
}
</script>
{% endmacro %}

@ -0,0 +1,251 @@
{% extends '_main.html' %}
{% block title %}General - Bazarr{% endblock %}
{% block bcleft %}
<div class="">
<button class="btn btn-outline" id="save_button">
<div><i class="fas fa-save align-top text-themecolor text-center font-20" aria-hidden="true"></i></div>
<div class="align-bottom text-themecolor small text-center">Save</div>
</button>
</div>
{% endblock bcleft %}
{% block bcright %}
{% endblock bcright %}
{% block body %}
<div class="container-fluid" style="padding-top: 3em;">
<h4>Host</h4>
<hr/>
<div class="row">
<div class="col-sm-2 text-right">
<b>Listening IP Address</b>
</div>
<div class="col-sm-4">
<input type="text" class="form-control" id="settings-general-ip" name="settings-general-ip" value="{{settings.general.ip}}">
</div>
</div>
<br>
<div class="row">
<div class="col-sm-2 text-right">
<b>Listening Port</b>
</div>
<div class="col-sm-4">
<input type="text" class="form-control" id="settings-general-port" name="settings-general-port" value="{{settings.general.port}}">
</div>
</div>
<br>
<div class="row">
<div class="col-sm-2 text-right">
<b>Base URL</b>
</div>
<div class="col-sm-4">
<input type="text" class="form-control" id="settings-general-base_url" name="settings-general-base_url" value="{{settings.general.base_url}}">
</div>
</div>
<br>
<h4>Security</h4>
<hr/>
<div class="row">
<div class="col-sm-2 text-right">
<b>Authentication</b>
</div>
<div class="form-group col-sm-4">
<select class="selectpicker" id="settings-auth-type" name="settings-auth-type">
<option value="None">None</option>
<option value="Basic">Basic</option>
<option value="Form">Form</option>
</select>
</div>
</div>
<div id="authentication_div">
<div class="row">
<div class="col-sm-2 text-right">
<b>Username</b>
</div>
<div class="col-sm-4">
<input type="text" class="form-control" id="settings-auth-username" name="settings-auth-username" value="{{settings.auth.username}}">
</div>
</div>
<br>
<div class="row">
<div class="col-sm-2 text-right">
<b>Password</b>
</div>
<div class="col-sm-4">
<input type="password" class="form-control" id="settings-auth-password" name="settings-auth-password" value="{{settings.auth.password}}">
</div>
</div>
<br>
</div>
<div class="row">
<div class="col-sm-2 text-right">
<b>API Key</b>
</div>
<div class="col-sm-4">
<input type="text" class="form-control" id="settings-auth-apikey" name="settings-auth-apikey" value="{{settings.auth.apikey}}">
</div>
</div>
<br>
<h4>Proxy</h4>
<hr/>
<div class="row">
<div class="col-sm-2 text-right">
<b>Type</b>
</div>
<div class="form-group col-sm-4">
<select class="selectpicker" id="settings-proxy-type" name="settings-proxy-type">
<option value="None">None</option>
<option value="http">HTTP(S)</option>
<option value="socks4">Socks4</option>
<option value="socks5">Socks5</option>
</select>
</div>
</div>
<div id="proxy_div">
<div class="row">
<div class="col-sm-2 text-right">
<b>Hostname</b>
</div>
<div class="col-sm-4">
<input type="text" class="form-control" id="settings-proxy-url" name="settings-proxy-url" value="{{settings.proxy.url}}">
</div>
</div>
<br>
<div class="row">
<div class="col-sm-2 text-right">
<b>Port</b>
</div>
<div class="col-sm-4">
<input type="text" class="form-control" id="settings-proxy-port" name="settings-proxy-port" value="{{settings.proxy.port}}">
</div>
</div>
<br>
<div class="row">
<div class="col-sm-2 text-right">
<b>Username</b>
</div>
<div class="col-sm-4">
<input type="text" class="form-control" id="settings-proxy-username" name="settings-proxy-username" value="{{settings.proxy.username}}">
</div>
</div>
<br>
<div class="row">
<div class="col-sm-2 text-right">
<b>Password</b>
</div>
<div class="col-sm-4">
<input type="password" class="form-control" id="settings-proxy-password" name="settings-proxy-password" value="{{settings.proxy.password}}">
</div>
</div>
<br>
<div class="row">
<div class="col-sm-2 text-right">
<b>Ignored Addresses</b>
</div>
<div class="col-sm-4">
<input type="text" class="form-control" id="settings-proxy-exclude" name="settings-proxy-exclude" value="{{settings.proxy.exclude}}">
</div>
</div>
<br>
</div>
<h4>UI</h4>
<hr/>
<div class="row">
<div class="col-sm-2 text-right">
<b>Page Size</b>
</div>
<div class="form-group col-sm-4">
<select class="selectpicker" id="settings-general-page_size" name="settings-general-page_size">
<option value="-1">Unlimited</option>
<option value="25">25</option>
<option value="50">50</option>
<option value="100">100</option>
<option value="250">250</option>
<option value="500">500</option>
<option value="1000">1000</option>
</select>
</div>
</div>
<br>
<h4>Logging</h4>
<hr/>
<div class="row">
<div class="col-sm-2 text-right">
<b>Debug</b>
</div>
<div class="form-group col-sm-1">
<label class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="settings-general-debug" name="settings-general-debug">
<span class="custom-control-label" for="settings-general-debug"></span>
</label>
</div>
</div>
<br>
<h4>Analytics</h4>
<hr/>
<div class="row">
<div class="col-sm-2 text-right">
<b>Enabled</b>
</div>
<div class="form-group col-sm-1">
<label class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="settings-analytics-enabled" name="settings-analytics-enabled">
<span class="custom-control-label" for="settings-analytics-enabled"></span>
</label>
</div>
</div>
<br>
<h4>Updates</h4>
<hr/>
<div class="row">
<div class="col-sm-2 text-right">
<b>Branch</b>
</div>
<div class="form-group col-sm-4">
<select class="selectpicker" id="settings-general-branch" name="settings-general-branch">
<option value="master">master</option>
<option value="development">development</option>
</select>
</div>
</div>
<div class="row">
<div class="col-sm-2 text-right">
<b>Automatic</b>
</div>
<div class="form-group col-sm-1">
<label class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="settings-general-auto_update" name="settings-general-auto_update">
<span class="custom-control-label" for="settings-general-auto_update"></span>
</label>
</div>
</div>
<div class="row">
<div class="col-sm-2 text-right">
<b>Restart After Update</b>
</div>
<div class="form-group col-sm-1">
<label class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="settings-general-update_restart" name="settings-general-update_restart">
<span class="custom-control-label" for="settings-general-update_restart"></span>
</label>
</div>
</div>
</div>
{% endblock body %}
{% block tail %}
<script>
$(document).ready(function () {
})
</script>
{% endblock tail %}

@ -1,564 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<script src="{{base_url}}static/jquery/jquery-latest.min.js"></script>
<script src="{{base_url}}static/semantic/semantic.min.js"></script>
<script src="{{base_url}}static/jquery/tablesort.js"></script>
<script src="{{base_url}}static/datatables/jquery.dataTables.min.js"></script>
<script src="{{base_url}}static/datatables/dataTables.semanticui.min.js"></script>
<script src="{{base_url}}static/moment/moment.js"></script>
<link rel="stylesheet" href="{{base_url}}static/semantic/semantic.min.css">
<link rel="stylesheet" type="text/css" href="{{base_url}}static/datatables/datatables.min.css"/>
<link rel="stylesheet" type="text/css" href="{{base_url}}static/datatables/semanticui.min.css"/>
<link rel="apple-touch-icon" sizes="120x120" href="{{base_url}}static/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="{{base_url}}static/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="{{base_url}}static/favicon-16x16.png">
<link rel="manifest" href="{{base_url}}static/manifest.json">
<link rel="mask-icon" href="{{base_url}}static/safari-pinned-tab.svg" color="#5bbad5">
<link rel="shortcut icon" href="{{base_url}}static/favicon.ico">
<meta name="msapplication-config" content="{{base_url}}static/browserconfig.xml">
<meta name="theme-color" content="#ffffff">
<title>System - Bazarr</title>
<style>
body {
background-color: #272727;
}
#fondblanc {
background-color: #ffffff;
border-radius: 0;
box-shadow: 0 0 5px 5px #ffffff;
margin-top: 32px;
margin-bottom: 3em;
padding: 1em;
}
.fast.backward, .backward, .forward, .fast.forward {
cursor: pointer;
}
.fast.backward, .backward, .forward, .fast.forward { pointer-events: auto; }
.fast.backward.disabled, .backward.disabled, .forward.disabled, .fast.forward.disabled { pointer-events: none; }
.dataTables_filter{
display:none;
}
#logs > tbody > tr { cursor: pointer; }
</style>
</head>
<body>
<div id='loader' class="ui page dimmer">
<div id='loader_text' class="ui indeterminate text loader">Loading...</div>
</div>
<div id="fondblanc" class="ui container">
<div class="ui basic icon buttons" style="float: right;">
<div id="shutdown" class="ui icon button" data-tooltip="Shutdown" data-inverted=""><i class="red power off icon"></i></div>
<div id="restart" class="ui icon button" data-tooltip="Restart" data-inverted=""><i class="redo alternate icon"></i></div>
{% if settings.auth.type != "None" %}
<div id="logout" class="ui icon button" data-tooltip="Logout" data-inverted=""><i class="sign-out icon"></i></div>
{% endif %}
</div>
{% set throttled_providers_count = settings.general.throtteled_providers|length %}
<div class="ui top attached tabular menu">
<a class="tabs item active" data-tab="tasks">Tasks</a>
<a class="tabs item" data-tab="logs">Logs</a>
<a class="tabs item" data-tab="providers">Providers
{% if throttled_providers_count %}
<div class="ui tiny yellow label">
{{throttled_providers_count}}
</div>
{% endif %}
</a>
<a class="tabs item" data-tab="status">Status</a>
<a class="tabs item" data-tab="releases">Releases</a>
</div>
<div class="ui bottom attached tab segment active" data-tab="tasks">
<div class="content">
<table class="ui very basic selectable table" id="tasks">
<thead>
<tr>
<th>Name</th>
<th>Execution Frequency</th>
<th>Next Execution</th>
<th class="collapsing"></th>
</tr>
</thead>
<tbody>
{% for task in task_list %}
<tr id="{{task[3]}}">
<td>{{task[0]}}</td>
<td>{{task[1]}}</td>
<td>{{task[2]}}</td>
<td class="collapsing">
<div class="execute ui inverted basic compact icon" data-tooltip="Execute {{task[0]}}" data-inverted="" data-taskid='{{task[3]}}'>
<i class="ui black refresh icon"></i>
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<div class="ui bottom attached tab segment" data-tab="logs">
<div class="ui two column grid container">
<div class="row">
<div class="left floatedcolumn">
<div class="ui basic buttons">
<button id="refresh_log" class="ui button"><i class="refresh icon"></i>Refresh Current Page</button>
<button id="download_log" class="ui button"><i class="download icon"></i>Download Log File</button>
<button id="empty_log" class="ui button"><i class="trash icon"></i>Empty Log</button>
</div>
</div>
<div class="right floated right aligned column">
<div class="ui basic icon buttons">
<button class="ui active button filter_log" id="all_log" data-level="ALL" data-tooltip="All"><i class="circle outline icon"></i></button>
<button class="ui button filter_log" id="info_log" data-level="INFO" data-tooltip="Info"><i class="blue info circle icon"></i></button>
<button class="ui button filter_log" id="warning_log" data-level="WARNING" data-tooltip="Warning"><i class="yellow warning circle icon"></i></button>
<button class="ui button filter_log" id="error_log" data-level="ERROR" data-tooltip="Error"><i class="red bug icon"></i></button>
<button class="ui button filter_log" id="debug_log" data-level="DEBUG" data-tooltip="Debug"><i class="black bug icon"></i></button>
</div>
</div>
</div>
</div>
<div class="content">
<table id="logs" class="display" style="width:100%">
<thead>
<tr>
<th></th>
<th class="collapsing"></th>
<th style="text-align: left;">Message:</th>
<th class="collapsing" style="text-align: left;">Time:</th>
<th></th>
</tr>
</thead>
</table>
</div>
</div>
<div class="ui bottom attached tab segment" data-tab="providers">
<div class="content">
<table class="ui very basic table">
<thead>
<tr>
<th>Name</th>
<th>Status</th>
<th>Next retry</th>
</tr>
</thead>
<tbody>
{% for provider in throttled_providers %}
<tr>
<td>{{provider[0]}}</td>
<td>{{provider[1] if provider[1] is not None else "Good"}}</td>
<td>{{provider[2] if provider[2] != "now" else "-"}}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<div class="ui bottom attached tab segment" data-tab="status">
<div class="ui dividing header">About</div>
<div class="twelve wide column">
<div class="ui grid">
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>Bazarr Version:</label>
</div>
<div class="five wide column">
<div class='field'>
<div class="ui fluid input">
{{bazarr_version}}
</div>
</div>
</div>
</div>
{% if settings.general.getboolean('use_sonarr') %}
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>Sonarr Version:</label>
</div>
<div class="five wide column">
<div class='field'>
<div class="ui fluid input">
{{sonarr_version}}
</div>
</div>
</div>
</div>
{% endif %}
{% if settings.general.getboolean('use_radarr') %}
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>Radarr Version:</label>
</div>
<div class="five wide column">
<div class='field'>
<div class="ui fluid input">
{{radarr_version}}
</div>
</div>
</div>
</div>
{% endif %}
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>Operating System:</label>
</div>
<div class="five wide column">
<div class='field'>
<div class="ui fluid input">
{{operating_system}}
</div>
</div>
</div>
</div>
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>Python Version:</label>
</div>
<div class="five wide column">
<div class='field'>
<div class="ui fluid input">
{{python_version}}
</div>
</div>
</div>
</div>
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>Bazarr Directory:</label>
</div>
<div class="five wide column">
<div class='field'>
<div class="ui fluid input">
{{bazarr_dir}}
</div>
</div>
</div>
</div>
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>Bazarr Config Directory:</label>
</div>
<div class="five wide column">
<div class='field'>
<div class="ui fluid input">
{{config_dir}}
</div>
</div>
</div>
</div>
</div>
</div>
<div class="ui dividing header">More info</div>
<div class="twelve wide column">
<div class="ui grid">
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>Home Page:</label>
</div>
<div class="five wide column">
<div class='field'>
<div class="ui fluid input">
<i class="paper plane icon"></i><a href="https://www.bazarr.media" target="_blank">Bazarr Website</a>
</div>
</div>
</div>
</div>
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>Source:</label>
</div>
<div class="five wide column">
<div class='field'>
<div class="ui fluid input">
<i class="github icon"></i><a href="https://github.com/morpheus65535/bazarr" target="_blank">Bazarr on GitHub</a>
</div>
</div>
</div>
</div>
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>Wiki:</label>
</div>
<div class="five wide column">
<div class='field'>
<div class="ui fluid input">
<i class="wikipedia w icon"></i><a href="https://github.com/morpheus65535/bazarr/wiki" target="_blank">Bazarr Wiki</a>
</div>
</div>
</div>
</div>
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>Discord:</label>
</div>
<div class="five wide column">
<div class='field'>
<div class="ui fluid input">
<i class="discord icon"></i><a href="https://discord.gg/MH2e2eb" target="_blank">Bazarr on Discord</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="ui bottom attached tab segment" data-tab="releases">
{% for release in releases %}
<h2 class="ui header">
{% if release[0][1:] == bazarr_version %}
{{release[0]}} <div class="ui green label">Current Version</div>
{% else %}
{{release[0]}}
{% endif %}
</h2>
<div class="ui list">
{% set release_lines = release[1].split('\r\n') %}
{% for i, release_line in enumerate(release_lines) %}
{% if i == 0 %}
<div class="item">
<div><h4>{{release_line}}</h4></div>
<div class="list">
{% else %}
<div class="item">{{release_line}}</div>
{% endif %}
{% endfor %}
</div>
</div>
</div>
{% endfor %}
</div>
</div>
<div id="modal" class="ui small modal">
<i class="close icon"></i>
<div class="header">
<div>Details</div>
</div>
<div class="content">
Message
<div id='message' class="ui segment">
<p></p>
</div>
Exception
<div id='exception' class="ui segment">
<p></p>
</div>
</div>
<div class="actions">
<button class="ui cancel button" >Close</button>
</div>
</div>
{% include('footer.html') %}
</body>
</html>
<script>
$('.modal')
.modal({
autofocus: false
});
$('.menu .item')
.tab();
$('#refresh_log').on('click', function(){
table.ajax.reload();
});
$('#download_log').on('click', function(){
window.location = '{{base_url}}bazarr.log';
});
$('#empty_log').on('click', function(){
window.location = '{{base_url}}emptylog';
});
$('.execute').on('click', function(){
$(this).addClass('disabled');
$(this).find('i:first').addClass('loading');
$.ajax({
url: '{{base_url}}execute/' + $(this).data("taskid")
})
});
$('a:not(.tabs), button:not(.cancel, #download_log, .filter_log, #refresh_log), #restart').on('click', function(){
$('#loader').addClass('active');
});
$('a[target="_blank"]').on('click', function(){
$('#loader').removeClass('active');
});
$('#shutdown').on('click', function(){
$.ajax({
url: "{{base_url}}shutdown",
async: false
})
.always(function(){
document.open();
document.write('Bazarr has shutdown.');
document.close();
});
});
$('#logout').on('click', function(){
window.location = '{{base_url}}logout';
});
$('#restart').on('click', function(){
$('#loader_text').text("Bazarr is restarting, please wait...");
$.ajax({
url: "{{base_url}}restart",
async: true,
error: (function () {
setTimeout(function () { setInterval(ping, 2000); }, 8000);
})
});
});
{% set ip = settings.general.ip %}
{% set port = args.port if args.port else settings.general.port %}
{% set base_url = settings.general.base_url %}
if ("{{ip}}" === "0.0.0.0") {
public_ip = window.location.hostname;
} else {
public_ip = "{{ip}}";
}
protocol = window.location.protocol;
if (window.location.port === '{{current_port}}') {
public_port = '{{port}}';
} else {
public_port = window.location.port;
}
function ping() {
$.ajax({
url: protocol + '//' + public_ip + ':' + public_port + '{{base_url}}',
success: function(result) {
window.location.href= protocol + '//' + public_ip + ':' + public_port + '{{base_url}}';
}
});
}
var table = $('#logs').DataTable( {
destroy: true,
language: {
loadingRecords: '<br><div class="ui active inverted dimmer" style="width: 95%;"><div class="ui centered inline loader"></div></div><br>',
zeroRecords: 'No entries found in logs matching this log level.'
},
paging: true,
lengthChange: false,
pageLength: {{page_size}},
searching: true,
search: {
regex: true
},
ordering: false,
processing: false,
serverSide: false,
ajax: {
url: '{{base_url}}logs',
dataSrc: 'data'
},
drawCallback: function(settings) {
$('.inline.dropdown').dropdown();
},
columns: [
{
data: 1,
render: function (data, type, row) {
return $.trim(data);
}
},
{ data: 1,
render: function ( data, type, row ) {
var icon;
switch ($.trim(data)) {
case 'INFO':
icon = 'blue info circle icon';
break;
case 'WARNING':
icon = 'yellow warning circle icon';
break;
case 'ERROR':
icon = 'red bug icon';
break;
case 'DEBUG':
icon = 'black bug icon';
}
return '<i class="' + icon + '"></i>';
}
},
{ data: 3,
render: function ( data, type, row ) {
return $.trim(data);
}
},
{ data: 0,
render: function ( data, type, row ) {
return '<div class="description" data-tooltip="' + $.trim(data) + '" data-inverted="" data-position="top left">' + moment($.trim(data), "DD/MM/YYYY hh:mm:ss").fromNow() + '</div>'
}
},
{ data: 4,
render: function ( data, type, row ) {
return $.trim(data);
}
}
],
columnDefs: [
{
"targets": [ 0 ],
"visible": false,
"searchable": true
},
{
"targets": [ 4 ],
"visible": false,
"searchable": false
}
]
} );
$('.filter_log').on( 'click', function () {
$('.filter_log').removeClass('active');
$(this).addClass('active');
if ( $(this).data('level') === 'INFO') {
table.column( 0 ).search( 'INFO|WARNING|ERROR|DEBUG', true, false).draw();
} else if ( $(this).data('level') === 'WARNING') {
table.column( 0 ).search( 'WARNING|ERROR|DEBUG', true, false ).draw();
} else if ( $(this).data('level') === 'ERROR') {
table.column( 0 ).search( 'ERROR|DEBUG', true, false ).draw();
} else if ( $(this).data('level') === 'DEBUG') {
table.column( 0 ).search( 'DEBUG', true, false ).draw();
} else if ( $(this).data('level') === 'ALL') {
table.column(0).search('').draw();
}
} );
$('#logs').on('click', 'tr', function(event) {
var data = table.row( this ).data();
$("#message").html(data[3]);
let exception = data[4];
exception = exception.replace(/'/g,"");
exception = exception.replace(/\\n\s\s\s\s/g, "\\n&emsp;&emsp;");
exception = exception.replace(/\\n\s\s/g, "\\n&emsp;");
exception = exception.replace(/\\n/g, "<br />");
$("#exception").html(exception);
$('#modal').modal('show');
});
</script>
Loading…
Cancel
Save