diff --git a/bazarr/api.py b/bazarr/api.py index a07ea1fd2..eed100d5d 100644 --- a/bazarr/api.py +++ b/bazarr/api.py @@ -127,7 +127,8 @@ class Search(Resource): class SaveSettings(Resource): @authenticate def post(self): - save_settings(request.form.items()) + + save_settings(zip(request.form.keys(), request.form.listvalues())) scheduler.update_configurable_tasks() return '', 200 diff --git a/bazarr/config.py b/bazarr/config.py index 68e60c259..8854185dd 100644 --- a/bazarr/config.py +++ b/bazarr/config.py @@ -151,11 +151,17 @@ base_url = settings.general.base_url def save_settings(settings_items): + from database import database for key, value in settings_items: if key == 'enabled_languages': - print(key) + database.execute("UPDATE table_settings_languages SET enabled=0") + for item in value: + database.execute("UPDATE table_settings_languages SET enabled=1 WHERE code2=?", (item,)) continue + if isinstance(value, list) and len(value) == 1: + value = value[0] + settings_keys = key.split('-') if value == 'true': diff --git a/views/settingslanguages.html b/views/settingslanguages.html index 290671480..1be303144 100644 --- a/views/settingslanguages.html +++ b/views/settingslanguages.html @@ -3,7 +3,11 @@ {% block title %}Languages - Bazarr{% endblock %} {% block page_head %} - + {% endblock page_head %} {% block bcleft %} @@ -33,11 +37,13 @@