mirror of https://github.com/morpheus65535/bazarr
WIP
This commit is contained in:
parent
aa1b9dfcf4
commit
a198250cca
112
bazarr/main.py
112
bazarr/main.py
|
@ -16,8 +16,8 @@ import ast
|
||||||
import hashlib
|
import hashlib
|
||||||
import warnings
|
import warnings
|
||||||
import queueconfig
|
import queueconfig
|
||||||
import platform
|
|
||||||
import apprise
|
import apprise
|
||||||
|
import requests
|
||||||
|
|
||||||
|
|
||||||
from get_args import args
|
from get_args import args
|
||||||
|
@ -38,13 +38,12 @@ from get_languages import load_language_in_db, language_from_alpha3, language_fr
|
||||||
from flask import make_response, request, redirect, abort, render_template, Response, session, flash, url_for, \
|
from flask import make_response, request, redirect, abort, render_template, Response, session, flash, url_for, \
|
||||||
send_file, stream_with_context
|
send_file, stream_with_context
|
||||||
|
|
||||||
from get_providers import get_providers, get_providers_auth, list_throttled_providers
|
|
||||||
from get_series import *
|
from get_series import *
|
||||||
from get_episodes import *
|
from get_episodes import *
|
||||||
from get_movies import *
|
from get_movies import *
|
||||||
|
|
||||||
from utils import history_log, history_log_movie, get_sonarr_version, get_radarr_version
|
|
||||||
from scheduler import Scheduler
|
from scheduler import Scheduler
|
||||||
|
from check_update import check_and_apply_update
|
||||||
from subliminal_patch.extensions import provider_registry as provider_manager
|
from subliminal_patch.extensions import provider_registry as provider_manager
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
|
|
||||||
|
@ -173,6 +172,7 @@ def logout():
|
||||||
def shutdown():
|
def shutdown():
|
||||||
doShutdown()
|
doShutdown()
|
||||||
|
|
||||||
|
|
||||||
def doShutdown():
|
def doShutdown():
|
||||||
try:
|
try:
|
||||||
server.stop()
|
server.stop()
|
||||||
|
@ -598,16 +598,19 @@ def settingssonarr():
|
||||||
return render_template('settingssonarr.html')
|
return render_template('settingssonarr.html')
|
||||||
|
|
||||||
|
|
||||||
|
@app.route('/settingsradarr/')
|
||||||
|
@login_required
|
||||||
|
def settingsradarr():
|
||||||
|
return render_template('settingsradarr.html')
|
||||||
|
|
||||||
|
|
||||||
@app.route('/check_update')
|
@app.route('/check_update')
|
||||||
@login_required
|
@login_required
|
||||||
def check_update():
|
def check_update():
|
||||||
|
|
||||||
ref = request.environ['HTTP_REFERER']
|
|
||||||
|
|
||||||
if not args.no_update:
|
if not args.no_update:
|
||||||
check_and_apply_update()
|
check_and_apply_update()
|
||||||
|
|
||||||
redirect(ref)
|
return '', 200
|
||||||
|
|
||||||
|
|
||||||
@app.route('/systemtasks')
|
@app.route('/systemtasks')
|
||||||
|
@ -640,21 +643,6 @@ def systemreleases():
|
||||||
return render_template('systemreleases.html')
|
return render_template('systemreleases.html')
|
||||||
|
|
||||||
|
|
||||||
@app.route('/logs')
|
|
||||||
@login_required
|
|
||||||
def get_logs():
|
|
||||||
|
|
||||||
logs = []
|
|
||||||
with io.open(os.path.join(args.config_dir, 'log', 'bazarr.log'), encoding='UTF-8') as file:
|
|
||||||
for line in file.readlines():
|
|
||||||
lin = []
|
|
||||||
lin = line.split('|')
|
|
||||||
logs.append(lin)
|
|
||||||
logs.reverse()
|
|
||||||
|
|
||||||
return dict(data=logs)
|
|
||||||
|
|
||||||
|
|
||||||
def configured():
|
def configured():
|
||||||
database.execute("UPDATE system SET configured = 1")
|
database.execute("UPDATE system SET configured = 1")
|
||||||
|
|
||||||
|
@ -719,6 +707,7 @@ def api_movies_history():
|
||||||
return dict(subtitles=history_subs)
|
return dict(subtitles=history_subs)
|
||||||
|
|
||||||
|
|
||||||
|
@app.route('/test_url', methods=['GET'])
|
||||||
@app.route('/test_url/<protocol>/<path:url>', methods=['GET'])
|
@app.route('/test_url/<protocol>/<path:url>', methods=['GET'])
|
||||||
@login_required
|
@login_required
|
||||||
def test_url(protocol, url):
|
def test_url(protocol, url):
|
||||||
|
@ -742,87 +731,10 @@ def test_notification(protocol, provider):
|
||||||
|
|
||||||
apobj.notify(
|
apobj.notify(
|
||||||
title='Bazarr test notification',
|
title='Bazarr test notification',
|
||||||
body=('Test notification')
|
body='Test notification'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@app.route('/notifications')
|
|
||||||
@login_required
|
|
||||||
def notifications():
|
|
||||||
if queueconfig.notifications:
|
|
||||||
test = queueconfig.notifications
|
|
||||||
return queueconfig.notifications.read() or ''
|
|
||||||
else:
|
|
||||||
return abort(400)
|
|
||||||
|
|
||||||
|
|
||||||
@app.route('/running_tasks')
|
|
||||||
@login_required
|
|
||||||
def running_tasks_list():
|
|
||||||
|
|
||||||
return dict(tasks=scheduler.get_running_tasks())
|
|
||||||
|
|
||||||
|
|
||||||
@app.route('/episode_history/<int:no>')
|
|
||||||
@login_required
|
|
||||||
def episode_history(no):
|
|
||||||
|
|
||||||
episode_history = database.execute("SELECT action, timestamp, language, provider, score FROM table_history "
|
|
||||||
"WHERE sonarrEpisodeId=? ORDER BY timestamp DESC", (no,))
|
|
||||||
for item in episode_history:
|
|
||||||
item['timestamp'] = "<div data-tooltip='" + \
|
|
||||||
time.strftime('%d/%m/%Y %H:%M:%S', time.localtime(item['timestamp'])) + "'>" + \
|
|
||||||
pretty.date(datetime.fromtimestamp(item['timestamp'])) + "</div>"
|
|
||||||
if item['language']:
|
|
||||||
item['language'] = language_from_alpha2(item['language'])
|
|
||||||
else:
|
|
||||||
item['language'] = "<i>undefined</i>"
|
|
||||||
if item['score']:
|
|
||||||
item['score'] = str(round((int(item['score']) * 100 / 360), 2)) + "%"
|
|
||||||
|
|
||||||
return dict(data=episode_history)
|
|
||||||
|
|
||||||
|
|
||||||
@app.route('/movie_history/<int:no>')
|
|
||||||
@login_required
|
|
||||||
def movie_history(no):
|
|
||||||
|
|
||||||
movie_history = database.execute("SELECT action, timestamp, language, provider, score FROM table_history_movie "
|
|
||||||
"WHERE radarrId=? ORDER BY timestamp DESC", (no,))
|
|
||||||
for item in movie_history:
|
|
||||||
if item['action'] == 0:
|
|
||||||
item['action'] = "<div class ='ui inverted basic compact icon' data-tooltip='Subtitle file has been " \
|
|
||||||
"erased.' data-inverted='' data-position='top left'><i class='ui trash icon'></i></div>"
|
|
||||||
elif item['action'] == 1:
|
|
||||||
item['action'] = "<div class ='ui inverted basic compact icon' data-tooltip='Subtitle file has been " \
|
|
||||||
"downloaded.' data-inverted='' data-position='top left'><i class='ui download " \
|
|
||||||
"icon'></i></div>"
|
|
||||||
elif item['action'] == 2:
|
|
||||||
item['action'] = "<div class ='ui inverted basic compact icon' data-tooltip='Subtitle file has been " \
|
|
||||||
"manually downloaded.' data-inverted='' data-position='top left'><i class='ui user " \
|
|
||||||
"icon'></i></div>"
|
|
||||||
elif item['action'] == 3:
|
|
||||||
item['action'] = "<div class ='ui inverted basic compact icon' data-tooltip='Subtitle file has been " \
|
|
||||||
"upgraded.' data-inverted='' data-position='top left'><i class='ui recycle " \
|
|
||||||
"icon'></i></div>"
|
|
||||||
elif item['action'] == 4:
|
|
||||||
item['action'] = "<div class ='ui inverted basic compact icon' data-tooltip='Subtitle file has been " \
|
|
||||||
"manually uploaded.' data-inverted='' data-position='top left'><i class='ui cloud " \
|
|
||||||
"upload icon'></i></div>"
|
|
||||||
|
|
||||||
item['timestamp'] = "<div data-tooltip='" + \
|
|
||||||
time.strftime('%d/%m/%Y %H:%M:%S', time.localtime(item['timestamp'])) + "'>" + \
|
|
||||||
pretty.date(datetime.fromtimestamp(item['timestamp'])) + "</div>"
|
|
||||||
if item['language']:
|
|
||||||
item['language'] = language_from_alpha2(item['language'])
|
|
||||||
else:
|
|
||||||
item['language'] = "<i>undefined</i>"
|
|
||||||
if item['score']:
|
|
||||||
item['score'] = str(round((int(item['score']) * 100 / 120), 2)) + '%'
|
|
||||||
|
|
||||||
return dict(data=movie_history)
|
|
||||||
|
|
||||||
|
|
||||||
# Mute DeprecationWarning
|
# Mute DeprecationWarning
|
||||||
warnings.simplefilter("ignore", DeprecationWarning)
|
warnings.simplefilter("ignore", DeprecationWarning)
|
||||||
# Mute Insecure HTTPS requests made to Sonarr and Radarr
|
# Mute Insecure HTTPS requests made to Sonarr and Radarr
|
||||||
|
|
|
@ -187,7 +187,7 @@
|
||||||
<ul aria-expanded="false" class="collapse">
|
<ul aria-expanded="false" class="collapse">
|
||||||
<li><a href="{{ url_for('settingsgeneral') }}"> General</a></li>
|
<li><a href="{{ url_for('settingsgeneral') }}"> General</a></li>
|
||||||
<li><a href="{{ url_for('settingssonarr') }}"> Sonarr</a></li>
|
<li><a href="{{ url_for('settingssonarr') }}"> Sonarr</a></li>
|
||||||
<li><a href="/"> Radarr</a></li>
|
<li><a href="{{ url_for('settingsradarr') }}"> Radarr</a></li>
|
||||||
<li><a href="/"> Subtitles</a></li>
|
<li><a href="/"> Subtitles</a></li>
|
||||||
<li><a href="/"> Notifications</a></li>
|
<li><a href="/"> Notifications</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -1,248 +1,380 @@
|
||||||
<div class="ui dividing header">Connection settings</div>
|
{% extends '_main.html' %}
|
||||||
<div class="twelve wide column">
|
|
||||||
<div class="ui grid">
|
{% block title %}Radarr - Bazarr{% endblock %}
|
||||||
<div class="middle aligned row">
|
|
||||||
<div class="right aligned four wide column">
|
{% block page_head %}
|
||||||
<label>Settings Validation:</label>
|
|
||||||
|
{% endblock page_head %}
|
||||||
|
|
||||||
|
{% block bcleft %}
|
||||||
|
<div class="">
|
||||||
|
<button class="btn btn-outline" id="save_button">
|
||||||
|
<div>
|
||||||
|
<span class="fa-stack">
|
||||||
|
<i class="fas fa-save fa-stack-2x align-top text-themecolor text-center font-20" aria-hidden="true"></i>
|
||||||
|
<i id="save_button_checkmark" class="fas fa-check fa-stack-2x" style="color:green;"></i>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="two wide column">
|
<div class="align-bottom text-themecolor small text-center">Save</div>
|
||||||
<button id="radarr_validate" class="test ui blue button" type="button">
|
|
||||||
Test
|
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="seven wide column">
|
{% endblock bcleft %}
|
||||||
<div id="radarr_validated" class="ui read-only checkbox">
|
|
||||||
<input id="radarr_validated_checkbox" type="checkbox">
|
{% block bcright %}
|
||||||
<label id="radarr_validation_result">Not Tested Recently</label>
|
|
||||||
|
{% endblock bcright %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
<div class="container-fluid" style="padding-top: 3em;">
|
||||||
|
<form class="form" name="settings_form" id="settings_form">
|
||||||
|
<h4>Use Radarr</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-general-use_radarr" name="settings-general-use_radarr">
|
||||||
|
<span class="custom-control-label" for="settings-general-use_radarr"></span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<div id="radarr_div">
|
||||||
|
<h4>Host</h4>
|
||||||
|
<hr/>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-2 text-right">
|
||||||
|
<b>Hostname or IP Address</b>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-4">
|
||||||
|
<input type="text" class="form-control" id="settings-radarr-ip" name="settings-radarr-ip" value="{{settings.radarr.ip}}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-2 text-right">
|
||||||
|
<b>Port Number</b>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-4">
|
||||||
|
<input type="text" class="form-control" id="settings-radarr-port" name="settings-radarr-port" value="{{settings.radarr.port}}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-2 text-right">
|
||||||
|
<b>URL Base</b>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-4">
|
||||||
|
<input type="text" class="form-control" id="settings-radarr-base_url" name="settings-radarr-base_url" value="{{settings.radarr.base_url}}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-2 text-right">
|
||||||
|
<b>SSL 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-radarr-ssl" name="settings-radarr-ssl">
|
||||||
|
<span class="custom-control-label" for="settings-radarr-ssl"></span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</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-radarr-apikey" name="settings-radarr-apikey" value="{{settings.radarr.apikey}}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-2 text-right">
|
||||||
|
<button type="button" class="btn btn-secondary" id="test_radarr_connection">Test</button>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-4">
|
||||||
|
<span id="test_radarr_span"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<h4>Options</h4>
|
||||||
|
<hr/>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-2 text-right">
|
||||||
|
<b>Minimum Score</b>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-1">
|
||||||
|
<input type="number" min="0" max="100" step="1" onkeydown="return false" class="form-control" id="settings-general-minimum_score" name="settings-general-minimum_score" value="{{settings.general.minimum_score}}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-2 text-right">
|
||||||
|
<b>Download Only Monitored</b>
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-sm-1">
|
||||||
|
<label class="custom-control custom-checkbox">
|
||||||
|
<input type="checkbox" class="custom-control-input" id="settings-radarr-only_monitored" name="settings-radarr-only_monitored">
|
||||||
|
<span class="custom-control-label" for="settings-radarr-only_monitored"></span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<h4>Path Mappings</h4>
|
||||||
|
<hr/>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<table class="table table-striped" id="path_mapping_movie" style="width:100%;">
|
||||||
|
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="addModal" class="modal" tabindex="-1" role="dialog">
|
||||||
|
<div class="modal-dialog modal-lg" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title">Add Path Mapping</h5><br>
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<form class="form" name="add_form" id="add_form">
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-3 text-right">
|
||||||
|
Path for Radarr
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input type="text" class="form-control" id="add_path_radarr" name="add_path_radarr" value="">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-3 text-right">
|
||||||
|
Path for Bazarr
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input type="text" class="form-control" id="add_path_bazarr" name="add_path_bazarr" value="">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="submit" id="add_save_button" class="btn btn-info">Save</button>
|
||||||
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="middle aligned row">
|
<div id="editModal" class="modal" tabindex="-1" role="dialog">
|
||||||
<div class="right aligned four wide column">
|
<div class="modal-dialog modal-lg" role="document">
|
||||||
<label>Hostname or IP Address</label>
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title">Edit Path Mapping</h5><br>
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="five wide column">
|
<form class="form" name="edit_form" id="edit_form">
|
||||||
<div class='field'>
|
<div class="modal-body">
|
||||||
<div class="ui fluid input">
|
<div class="container-fluid">
|
||||||
<input id="settings_radarr_ip" name="settings_radarr_ip" type="text" class="radarr_config"
|
<div class="row">
|
||||||
value="{{ settings.radarr.ip }}">
|
<div class="col-sm-3 text-right">
|
||||||
|
Path for Radarr
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input type="text" class="form-control" id="edit_path_radarr" name="edit_path_radarr" value="">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-3 text-right">
|
||||||
|
Path for Bazarr
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input type="text" class="form-control" id="edit_path_bazarr" name="edit_path_bazarr" value="">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="collapsed center aligned column">
|
</div>
|
||||||
<div class="ui basic icon" data-tooltip="Hostname or IP4 address of Radarr" data-inverted="">
|
<div class="modal-footer">
|
||||||
<i class="help circle large icon"></i>
|
<button type="submit" id="edit_save_button" class="btn btn-info">Save</button>
|
||||||
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="middle aligned row">
|
<div id="deleteModal" class="modal" tabindex="-1" role="dialog">
|
||||||
<div class="right aligned four wide column">
|
<div class="modal-dialog modal-lg" role="document">
|
||||||
<label>Listening Port</label>
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title">Delete Path Mapping</h5><br>
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="five wide column">
|
<div class="modal-body">
|
||||||
<div class='field'>
|
Are you sure you want to delete this path mapping?
|
||||||
<div class="ui fluid input">
|
</div>
|
||||||
<input id="settings_radarr_port" name="settings_radarr_port" type="text" class="radarr_config"
|
<div class="modal-footer">
|
||||||
value="{{ settings.radarr.port }}">
|
<button type="submit" id="delete_yes_button" class="btn btn-info">Yes</button>
|
||||||
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="collapsed center aligned column">
|
|
||||||
<div class="ui basic icon" data-tooltip="TCP Port of Radarr" data-inverted="">
|
|
||||||
<i class="help circle large icon"></i>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
{% endblock body %}
|
||||||
|
|
||||||
<div class="middle aligned row">
|
{% block tail %}
|
||||||
<div class="right aligned four wide column">
|
<script>
|
||||||
<label>Base URL</label>
|
$(document).ready(function () {
|
||||||
</div>
|
// Hide checkmark over save button
|
||||||
<div class="five wide column">
|
$('#save_button_checkmark').hide();
|
||||||
<div class="ui fluid input">
|
|
||||||
<input id="settings_radarr_baseurl" name="settings_radarr_baseurl" type="text" class="radarr_config"
|
|
||||||
value="{{ settings.radarr.base_url }}">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="collapsed center aligned column">
|
|
||||||
<div class="ui basic icon" data-tooltip="Base URL for Radarr (default: '/')" data-inverted="">
|
|
||||||
<i class="help circle large icon"></i>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="middle aligned row">
|
// Hide *_div on Select input changed to None
|
||||||
<div class="right aligned four wide column">
|
$('#settings-general-use_radarr').on('change', function() {
|
||||||
<label>SSL Enabled</label>
|
if ($(this).prop('checked')) {
|
||||||
</div>
|
$('#radarr_div').show();
|
||||||
<div class="one wide column">
|
|
||||||
<div id="radarr_ssl_div" class="ui toggle checkbox" data-ssl={{ settings.radarr.getboolean('ssl') }}>
|
|
||||||
<input id="settings_radarr_ssl" name="settings_radarr_ssl" type="checkbox">
|
|
||||||
<label></label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="middle aligned row">
|
|
||||||
<div class="right aligned four wide column">
|
|
||||||
<label>API Key</label>
|
|
||||||
</div>
|
|
||||||
<div class="five wide column">
|
|
||||||
<div class='field'>
|
|
||||||
<div class="ui fluid input">
|
|
||||||
<input id="settings_radarr_apikey" name="settings_radarr_apikey" type="text"
|
|
||||||
class="radarr_config" value="{{ settings.radarr.apikey }}">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="collapsed center aligned column">
|
|
||||||
<div class="ui basic icon" data-tooltip="API Key for Radarr (32 alphanumeric characters)"
|
|
||||||
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>Download Only Monitored</label>
|
|
||||||
</div>
|
|
||||||
<div class="one wide column">
|
|
||||||
<div id="settings_only_monitored_radarr" class="ui toggle checkbox"
|
|
||||||
data-monitored={{ settings.radarr.getboolean('only_monitored') }}>
|
|
||||||
<input name="settings_radarr_only_monitored" type="checkbox">
|
|
||||||
<label></label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="collapsed column">
|
|
||||||
<div class="collapsed center aligned column">
|
|
||||||
<div class="ui basic icon"
|
|
||||||
data-tooltip="Automatic download of Subtitles will only happen for monitored Movies in Radarr."
|
|
||||||
data-inverted="">
|
|
||||||
<i class="help circle large icon"></i>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="ui dividing header">Synchronization</div>
|
|
||||||
<div class="twelve wide column">
|
|
||||||
<div class="ui grid">
|
|
||||||
<div class="middle aligned row">
|
|
||||||
<div class="right aligned four wide column">
|
|
||||||
<label>Full Filesystem Scan</label>
|
|
||||||
</div>
|
|
||||||
<div class="three wide column">
|
|
||||||
<div class='field'>
|
|
||||||
<select name="settings_radarr_sync" id="settings_radarr_sync" class="ui fluid selection dropdown">
|
|
||||||
<option value="Manually">Manually</option>
|
|
||||||
<option value="Daily">Daily</option>
|
|
||||||
<option value="Weekly">Weekly</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="settings_radarr_sync_day_div" class="three wide column">
|
|
||||||
<div class='field'>
|
|
||||||
<select name="settings_radarr_sync_day" id="settings_radarr_sync_day"
|
|
||||||
class="ui fluid selection dropdown">
|
|
||||||
% import calendar
|
|
||||||
% for idx, i in enumerate(calendar.day_name):
|
|
||||||
<option value="{{ idx }}">{{ i }}</option>
|
|
||||||
%end
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="settings_radarr_sync_hour_div" class="two wide column">
|
|
||||||
<div class='field'>
|
|
||||||
<select name="settings_radarr_sync_hour" id="settings_radarr_sync_hour"
|
|
||||||
class="ui fluid selection dropdown">
|
|
||||||
% for i in range(24):
|
|
||||||
<option value="{{ i }}">{{ i }}:00</option>
|
|
||||||
%end
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% macro settings_radarr() %}
|
|
||||||
<script>
|
|
||||||
if ($('#radarr_ssl_div').data("ssl") === "True") {
|
|
||||||
$("#radarr_ssl_div").checkbox('check');
|
|
||||||
} else {
|
} else {
|
||||||
$("#radarr_ssl_div").checkbox('uncheck');
|
$('#radarr_div').hide();
|
||||||
}
|
|
||||||
|
|
||||||
if ($('#settings_only_monitored_radarr').data("monitored") === "True") {
|
|
||||||
$("#settings_only_monitored_radarr").checkbox('check');
|
|
||||||
} else {
|
|
||||||
$("#settings_only_monitored_radarr").checkbox('uncheck');
|
|
||||||
}
|
|
||||||
|
|
||||||
$('#settings_radarr_sync').dropdown('setting', 'onChange', function () {
|
|
||||||
if ($('#settings_radarr_sync').val() === "Manually") {
|
|
||||||
$('#settings_radarr_sync_day_div').hide();
|
|
||||||
$('#settings_radarr_sync_hour_div').hide();
|
|
||||||
} else if ($('#settings_radarr_sync').val() === "Daily") {
|
|
||||||
$('#settings_radarr_sync_day_div').hide();
|
|
||||||
$('#settings_radarr_sync_hour_div').show();
|
|
||||||
} else if ($('#settings_radarr_sync').val() === "Weekly") {
|
|
||||||
$('#settings_radarr_sync_day_div').show();
|
|
||||||
$('#settings_radarr_sync_hour_div').show();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#settings_radarr_sync').dropdown('clear');
|
// Set Checkbox input values
|
||||||
$('#settings_radarr_sync').dropdown('set selected', '{{settings.radarr.full_update|safe}}');
|
$('#settings-general-use_radarr').prop('checked', {{'true' if settings.general.getboolean('use_radarr')}});
|
||||||
$('#settings_radarr_sync').dropdown('refresh');
|
$('#settings-radarr-ssl').prop('checked', {{'true' if settings.radarr.getboolean('ssl')}});
|
||||||
$('#settings_radarr_sync_day').dropdown('clear');
|
$('#settings-radarr-only_monitored').prop('checked', {{'true' if settings.radarr.getboolean('only_monitored')}});
|
||||||
$('#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|safe}}');
|
|
||||||
$('#settings_radarr_sync_hour').dropdown('refresh');
|
|
||||||
|
|
||||||
$('#radarr_validate').on('click', function () {
|
$('#save_button').on('click', function() {
|
||||||
if ($('#radarr_ssl_div').checkbox('is checked')) {
|
var formdata = new FormData(document.getElementById("settings_form"));
|
||||||
protocol = 'https';
|
|
||||||
} else {
|
// Make sure all checkbox input are sent with true/false value
|
||||||
protocol = 'http';
|
$('input[type=checkbox]').each(function () {
|
||||||
|
formdata.set($(this).prop('id'), $(this).prop('checked'));
|
||||||
|
});
|
||||||
|
|
||||||
|
formdata.append('settings-general-path_mappings_movie', JSON.stringify(table.rows().data().toArray()));
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: "{{ url_for('api.savesettings') }}",
|
||||||
|
data: formdata,
|
||||||
|
processData: false,
|
||||||
|
contentType: false,
|
||||||
|
type: 'POST',
|
||||||
|
complete: function () {
|
||||||
|
$('#save_button_checkmark').show();
|
||||||
|
setTimeout(
|
||||||
|
function()
|
||||||
|
{
|
||||||
|
$('#save_button_checkmark').hide();
|
||||||
|
}, 2000);
|
||||||
}
|
}
|
||||||
const radarr_url = $('#settings_radarr_ip').val() + ":" + $('#settings_radarr_port').val() + $('#settings_radarr_baseurl').val().replace(/\/$/, "") + "/api/system/status?apikey=" + $('#settings_radarr_apikey').val();
|
});
|
||||||
|
});
|
||||||
|
|
||||||
$.getJSON("{{base_url}}test_url/" + protocol + "/" + encodeURIComponent(radarr_url), function (data) {
|
var path_mapping_movie = jQuery.makeArray({{ settings.general.path_mappings_movie|safe }})
|
||||||
|
path_mapping_movie = $.grep(path_mapping_movie, function(v) {
|
||||||
|
return v[0] !== "" || v[1] !== "";
|
||||||
|
});
|
||||||
|
|
||||||
|
var table = $('#path_mapping_movie').DataTable({
|
||||||
|
data: path_mapping_movie,
|
||||||
|
columns: [{
|
||||||
|
title: "Path for Radarr",
|
||||||
|
type: "text"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: "Path for Bazarr",
|
||||||
|
type: "text"
|
||||||
|
}],
|
||||||
|
dom: 'Bfrtip',
|
||||||
|
select: {
|
||||||
|
style: 'single'
|
||||||
|
},
|
||||||
|
language: {
|
||||||
|
zeroRecords: 'No Path Mappings'
|
||||||
|
},
|
||||||
|
searching: false,
|
||||||
|
ordering: false,
|
||||||
|
lengthChange: true,
|
||||||
|
responsive: true,
|
||||||
|
paging: false,
|
||||||
|
info: false,
|
||||||
|
buttons: [{
|
||||||
|
text: 'Add',
|
||||||
|
action: function () {
|
||||||
|
$('#addModal').modal('show');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
extend: 'selected',
|
||||||
|
text: 'Edit',
|
||||||
|
action: function () {
|
||||||
|
$('#edit_path_radarr').val(table.row( { selected: true } ).data()[0]);
|
||||||
|
$('#edit_path_bazarr').val(table.row( { selected: true } ).data()[1]);
|
||||||
|
$('#editModal').modal('show');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
extend: 'selected',
|
||||||
|
text: 'Delete',
|
||||||
|
action: function () {
|
||||||
|
$('#deleteModal').modal('show');
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#add_save_button').on('click', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
table.row.add([ $('#add_path_radarr').val(), $('#add_path_bazarr').val()]).draw();
|
||||||
|
$('#add_path_radarr').val('');
|
||||||
|
$('#add_path_bazarr').val('');
|
||||||
|
$('#addModal').modal('hide');
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#edit_save_button').on('click', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
table.row( { selected: true } ).data([ $('#edit_path_radarr').val(), $('#edit_path_bazarr').val()]);
|
||||||
|
$('#editModal').modal('hide');
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#delete_yes_button').on('click', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
table.row( { selected: true } ).remove().draw();
|
||||||
|
$('#deleteModal').modal('hide');
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#test_radarr_connection').on('click', function() {
|
||||||
|
if ($('#settings-radarr-ssl').is(':checked')) {
|
||||||
|
var protocol = 'https';
|
||||||
|
} else {
|
||||||
|
var protocol = 'http';
|
||||||
|
}
|
||||||
|
var radarr_url = $('#settings-radarr-ip').val() + ":" + $('#settings-radarr-port').val() + $('#settings-radarr-base_url').val().replace(/\/$/, "") + "/api/system/status?apikey=" + $('#settings-radarr-apikey').val();
|
||||||
|
|
||||||
|
$.getJSON("{{ url_for('test_url') }}/" + protocol + "/" + encodeURIComponent(radarr_url), function (data) {
|
||||||
if (data.status) {
|
if (data.status) {
|
||||||
$('#radarr_validated').checkbox('check');
|
$('#test_radarr_span').text('Test Successful: Radarr v' + data.version).css('color', 'green');
|
||||||
$('#radarr_validation_result').text('Test successful: Radarr v' + data.version).css('color', 'green');
|
|
||||||
$('.form').form('validate form');
|
|
||||||
$('#loader').removeClass('active');
|
|
||||||
} else {
|
} else {
|
||||||
$('#radarr_validated').checkbox('uncheck');
|
$('#test_radarr_span').text('Test Failed').css('color', 'red');
|
||||||
$('#radarr_validation_result').text('Test failed').css('color', 'red');
|
|
||||||
$('.form').form('validate form');
|
|
||||||
$('#loader').removeClass('active');
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.radarr_config').on('keyup', function () {
|
|
||||||
$('#radarr_validated').checkbox('uncheck');
|
|
||||||
$('#radarr_validation_result').text('You Must Test Your Radarr Connection Settings Before Saving.').css('color', 'red');
|
|
||||||
$('.form').form('validate form');
|
|
||||||
$('#loader').removeClass('active');
|
|
||||||
});
|
});
|
||||||
|
</script>
|
||||||
$('#settings_radarr_ssl').on('change', function () {
|
{% endblock tail %}
|
||||||
$('#radarr_validated').checkbox('uncheck');
|
|
||||||
$('#radarr_validation_result').text('You Must Test Your Radarr Connection Settings Before Saving.').css('color', 'red');
|
|
||||||
$('.form').form('validate form');
|
|
||||||
$('#loader').removeClass('active');
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#radarr_validated").checkbox('check');
|
|
||||||
</script>
|
|
||||||
{% endmacro %}
|
|
||||||
|
|
|
@ -92,6 +92,15 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-2 text-right">
|
||||||
|
<button type="button" class="btn btn-secondary" id="test_sonarr_connection">Test</button>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-4">
|
||||||
|
<span id="test_sonarr_span"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
|
||||||
<h4>Options</h4>
|
<h4>Options</h4>
|
||||||
<hr/>
|
<hr/>
|
||||||
|
@ -116,17 +125,119 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
<h4>PAth Mapping</h4>
|
<h4>Path Mappings</h4>
|
||||||
<hr/>
|
<hr/>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<table class="dataTable table table-striped" id="path_mapping">
|
<div class="col-sm-8">
|
||||||
|
<table class="table table-striped" id="path_mapping" style="width:100%;">
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<br>
|
<br>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="addModal" class="modal" tabindex="-1" role="dialog">
|
||||||
|
<div class="modal-dialog modal-lg" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title">Add Path Mapping</h5><br>
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<form class="form" name="add_form" id="add_form">
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-3 text-right">
|
||||||
|
Path for Sonarr
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input type="text" class="form-control" id="add_path_sonarr" name="add_path_sonarr" value="">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-3 text-right">
|
||||||
|
Path for Bazarr
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input type="text" class="form-control" id="add_path_bazarr" name="add_path_bazarr" value="">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="submit" id="add_save_button" class="btn btn-info">Save</button>
|
||||||
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="editModal" class="modal" tabindex="-1" role="dialog">
|
||||||
|
<div class="modal-dialog modal-lg" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title">Edit Path Mapping</h5><br>
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<form class="form" name="edit_form" id="edit_form">
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-3 text-right">
|
||||||
|
Path for Sonarr
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input type="text" class="form-control" id="edit_path_sonarr" name="edit_path_sonarr" value="">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-3 text-right">
|
||||||
|
Path for Bazarr
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input type="text" class="form-control" id="edit_path_bazarr" name="edit_path_bazarr" value="">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="submit" id="edit_save_button" class="btn btn-info">Save</button>
|
||||||
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="deleteModal" class="modal" tabindex="-1" role="dialog">
|
||||||
|
<div class="modal-dialog modal-lg" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title">Delete Path Mapping</h5><br>
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
Are you sure you want to delete this path mapping?
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="submit" id="delete_yes_button" class="btn btn-info">Yes</button>
|
||||||
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{% endblock body %}
|
{% endblock body %}
|
||||||
|
|
||||||
{% block tail %}
|
{% block tail %}
|
||||||
|
@ -157,6 +268,8 @@
|
||||||
formdata.set($(this).prop('id'), $(this).prop('checked'));
|
formdata.set($(this).prop('id'), $(this).prop('checked'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
formdata.append('settings-general-path_mappings', JSON.stringify(table.rows().data().toArray()));
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "{{ url_for('api.savesettings') }}",
|
url: "{{ url_for('api.savesettings') }}",
|
||||||
data: formdata,
|
data: formdata,
|
||||||
|
@ -174,34 +287,94 @@
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
table = $('#path_mapping').DataTable({
|
var path_mapping = jQuery.makeArray({{ settings.general.path_mappings|safe }})
|
||||||
data: [["/tvsonarr", "/tvbazarr"]],
|
path_mapping = $.grep(path_mapping, function(v) {
|
||||||
|
return v[0] !== "" || v[1] !== "";
|
||||||
|
});
|
||||||
|
|
||||||
|
var table = $('#path_mapping').DataTable({
|
||||||
|
data: path_mapping,
|
||||||
columns: [{
|
columns: [{
|
||||||
title: "Path for Sonarr",
|
title: "Path for Sonarr",
|
||||||
type: "text"
|
type: "text"
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
title: "Path for Bazarr",
|
title: "Path for Bazarr",
|
||||||
type: "text"
|
type: "text"
|
||||||
}],
|
}],
|
||||||
dom: 'Bfrtip', // Needs button container
|
dom: 'Bfrtip',
|
||||||
select: 'single',
|
select: {
|
||||||
|
style: 'single'
|
||||||
|
},
|
||||||
|
language: {
|
||||||
|
zeroRecords: 'No Path Mappings'
|
||||||
|
},
|
||||||
|
searching: false,
|
||||||
|
ordering: false,
|
||||||
|
lengthChange: true,
|
||||||
responsive: true,
|
responsive: true,
|
||||||
altEditor: true, // Enable altEditor
|
paging: false,
|
||||||
|
info: false,
|
||||||
buttons: [{
|
buttons: [{
|
||||||
text: 'Add',
|
text: 'Add',
|
||||||
name: 'add' // do not change name
|
action: function () {
|
||||||
|
$('#addModal').modal('show');
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
extend: 'selected', // Bind to Selected row
|
extend: 'selected',
|
||||||
text: 'Edit',
|
text: 'Edit',
|
||||||
name: 'edit' // do not change name
|
action: function () {
|
||||||
|
$('#edit_path_sonarr').val(table.row( { selected: true } ).data()[0]);
|
||||||
|
$('#edit_path_bazarr').val(table.row( { selected: true } ).data()[1]);
|
||||||
|
$('#editModal').modal('show');
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
extend: 'selected', // Bind to Selected row
|
extend: 'selected',
|
||||||
text: 'Delete',
|
text: 'Delete',
|
||||||
name: 'delete' // do not change name
|
action: function () {
|
||||||
|
$('#deleteModal').modal('show');
|
||||||
|
}
|
||||||
}]
|
}]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#add_save_button').on('click', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
table.row.add([ $('#add_path_sonarr').val(), $('#add_path_bazarr').val()]).draw();
|
||||||
|
$('#add_path_sonarr').val('');
|
||||||
|
$('#add_path_bazarr').val('');
|
||||||
|
$('#addModal').modal('hide');
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#edit_save_button').on('click', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
table.row( { selected: true } ).data([ $('#edit_path_sonarr').val(), $('#edit_path_bazarr').val()]);
|
||||||
|
$('#editModal').modal('hide');
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#delete_yes_button').on('click', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
table.row( { selected: true } ).remove().draw();
|
||||||
|
$('#deleteModal').modal('hide');
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#test_sonarr_connection').on('click', function() {
|
||||||
|
if ($('#settings-sonarr-ssl').is(':checked')) {
|
||||||
|
var protocol = 'https';
|
||||||
|
} else {
|
||||||
|
var protocol = 'http';
|
||||||
|
}
|
||||||
|
var sonarr_url = $('#settings-sonarr-ip').val() + ":" + $('#settings-sonarr-port').val() + $('#settings-sonarr-base_url').val().replace(/\/$/, "") + "/api/system/status?apikey=" + $('#settings-sonarr-apikey').val();
|
||||||
|
|
||||||
|
$.getJSON("{{ url_for('test_url') }}/" + protocol + "/" + encodeURIComponent(sonarr_url), function (data) {
|
||||||
|
if (data.status) {
|
||||||
|
$('#test_sonarr_span').text('Test Successful: Sonarr v' + data.version).css('color', 'green');
|
||||||
|
} else {
|
||||||
|
$('#test_sonarr_span').text('Test Failed').css('color', 'red');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
{% endblock tail %}
|
{% endblock tail %}
|
||||||
|
|
Loading…
Reference in New Issue