diff --git a/bazarr/api.py b/bazarr/api.py index e03e1d2ea..1ce582e61 100644 --- a/bazarr/api.py +++ b/bazarr/api.py @@ -9,9 +9,10 @@ from operator import itemgetter import platform import io from calendar import day_name +import importlib from get_args import args -from config import settings, base_url +from config import settings, base_url, save_settings from init import * import logging @@ -64,6 +65,13 @@ class Languages(Resource): return jsonify(result) +class SaveSettings(Resource): + def post(self): + save_settings(request.form.items()) + + return '', 200 + + class SystemTasks(Resource): def get(self): taskid = request.args.get('taskid') @@ -1128,6 +1136,8 @@ class SearchWantedMovies(Resource): api.add_resource(Badges, '/badges') api.add_resource(Languages, '/languages') +api.add_resource(SaveSettings, '/savesettings') + api.add_resource(SystemTasks, '/systemtasks') api.add_resource(SystemLogs, '/systemlogs') api.add_resource(SystemProviders, '/systemproviders') diff --git a/bazarr/config.py b/bazarr/config.py index 8991569bf..3aef9614b 100644 --- a/bazarr/config.py +++ b/bazarr/config.py @@ -148,6 +148,23 @@ settings.read(os.path.join(args.config_dir, 'config', 'config.ini')) base_url = settings.general.base_url +def save_settings(settings_items): + for key, value in settings_items: + settings_keys = key.split('-') + + if value == 'true': + value = 'True' + elif value == 'false': + value = 'False' + + if settings_keys[0] == 'settings': + settings[settings_keys[1]][settings_keys[2]] = str(value) + + with open(os.path.join(args.config_dir, 'config', 'config.ini'), 'w+') as handle: + settings.write(handle) + + + def url_sonarr(): if settings.sonarr.getboolean('ssl'): protocol_sonarr = "https" diff --git a/views/_main.html b/views/_main.html index 847edb5b3..a28bca58e 100644 --- a/views/_main.html +++ b/views/_main.html @@ -1,9 +1,9 @@ - - {% block title %}Bazarr{% endblock %} + + {% block title %}Bazarr{% endblock %} - {% block head_meta %} + {% block head_meta %} @@ -17,9 +17,9 @@ - {% endblock head_meta %} + {% endblock head_meta %} - {% block head_css %} + {% block head_css %} @@ -39,296 +39,304 @@ href="{{ url_for('static',filename='plugins/datatables.net-bs4/css/dataTables.bootstrap4.min.css') }}"> - {% endblock head_css %} + {% endblock head_css %} - {% block head %} - {% endblock head %} + {% block head %} + + {% endblock head %} + + {% block page_head %} + {% endblock page_head %} - {% block head_tail %} - {% endblock head_tail %} + {% block head_tail %} + {% endblock head_tail %} - - - - - -
- - - -
-{% block page_body %} - - - -
+ + - + -
- -
- - - - - - - + + + +
+
+ {% block breadcrumb %} + + + +
+
+ {% block bcleft %} + {% endblock bcleft %} +
+
+ {% block bcright %} + {% endblock bcright %} +
-
- {% endblock breadcrumb %} - {% block body %} + {% endblock breadcrumb %} + {% block body %} - {% endblock body %} + {% endblock body %} +
+ + + - + - - - - -
-
-

Connection to Backend Lost.

- +
+
+

Connection to Backend Lost.

+ +
-
-{% endblock page_body %} + {% endblock page_body %} -{% block tail_js %} + {% block tail_js %} - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - -{% endblock tail_js %} -{% block tail %} -{% endblock tail %} - + $(window).on('beforeunload', function() { + events.close(); + }); + + {% endblock tail_js %} + {% block tail %} + {% endblock tail %} + \ No newline at end of file diff --git a/views/episodes.html b/views/episodes.html index f7e7fb25a..3693d6300 100644 --- a/views/episodes.html +++ b/views/episodes.html @@ -2,7 +2,7 @@ {% block title %}Series - Bazarr{% endblock %} -{% block head %} +{% block page_head %} -{% endblock head %} +{% endblock page_head %} {% block bcleft %}
diff --git a/views/movie.html b/views/movie.html index 20487903b..4568fd44c 100644 --- a/views/movie.html +++ b/views/movie.html @@ -2,7 +2,7 @@ {% block title %}Movie - Bazarr{% endblock %} -{% block head %} +{% block page_head %} -{% endblock head %} +{% endblock page_head %} {% block bcleft %}
diff --git a/views/settingsgeneral.html b/views/settingsgeneral.html index 28294336b..30c5d9ccd 100644 --- a/views/settingsgeneral.html +++ b/views/settingsgeneral.html @@ -2,10 +2,23 @@ {% block title %}General - Bazarr{% endblock %} +{% block page_head %} + +{% endblock page_head %} + {% block bcleft %}
@@ -17,235 +30,320 @@ {% block body %}
-

Host

-
-
-
- Listening IP Address -
-
- -
-
-
-
-
- Listening Port -
-
- -
-
-
-
-
- Base URL -
-
- -
-
-
- -

Security

-
-
-
- Authentication -
-
- -
-
-
+
+

Host

+
- Username + Bind Address
- + +
+

- Password + Port Number
- +
+

-
-
-
- API Key -
-
- +
+
+ URL Base +
+
+ +
+ +
-
-
- -

Proxy

-
-
-
- Type +
+ +

Security

+
+
+
+ Authentication +
+
+ +
+ +
-
- +
+
+
+ Username +
+
+ +
+
+
+
+
+ Password +
+
+ +
+
+
-
-
- Hostname + API Key
-
- +
+ +
+ +

+ +

Proxy

+
- Port + Type
-
- +
+
+
-
+
+
+
+ Hostname +
+
+ +
+
+
+
+
+ Port +
+
+ +
+
+
+
+
+ Username +
+
+ +
+
+
+
+
+ Password +
+
+ +
+
+
+
+
+ Ignored Addresses +
+
+ +
+
+
+
+ +

UI

+
- Username + Page Size
-
- +
+

+ +

Logging

+
- Password + Debug
-
- +
+

+ +

Analytics

+
- Ignored Addresses + Enabled
-
- +
+

-
-

UI

-
-
-
- Page Size -
-
- -
-
-
- -

Logging

-
-
-
- Debug -
-
- -
-
-
- -

Analytics

-
-
-
- Enabled -
-
- -
-
-
- -

Updates

-
-
-
- Branch -
-
- -
-
-
-
- Automatic -
-
- -
-
-
-
- Restart After Update -
-
- +
+

Updates

+
+
+
+ Branch +
+
+ +
+
+
+
+ Automatic +
+
+ +
+
+
+
+ Restart After Update +
+
+ +
+
-
+
{% endblock body %} {% block tail %} {% endblock tail %} diff --git a/views/systemlogs.html b/views/systemlogs.html index 7b59ceeec..7433b6e35 100644 --- a/views/systemlogs.html +++ b/views/systemlogs.html @@ -2,7 +2,7 @@ {% block title %}Logs - Bazarr{% endblock %} -{% block head %} +{% block page_head %} -{% endblock head %} +{% endblock page_head %} {% block bcleft %}
diff --git a/views/systemproviders.html b/views/systemproviders.html index 3043b7e5e..7ba0c0fae 100644 --- a/views/systemproviders.html +++ b/views/systemproviders.html @@ -2,10 +2,6 @@ {% block title %}Logs - Bazarr{% endblock %} -{% block head %} - -{% endblock head %} - {% block bcleft %} {% endblock bcleft %} diff --git a/views/wizard.html b/views/wizard.html index 1818383c2..bd95cc09d 100644 --- a/views/wizard.html +++ b/views/wizard.html @@ -19,6 +19,7 @@ Settings - Bazarr + {{ super() }}