From f948814696e50bb7c8c172d168fcb599864e4b63 Mon Sep 17 00:00:00 2001
From: morpheus65535 <5130500+morpheus65535@users.noreply.github.com>
Date: Thu, 28 Jun 2018 05:47:17 -0400
Subject: [PATCH] Fix a bug in with single language mode enabled #78
---
bazarr.py | 4 ++++
views/settings.tpl | 16 ++++++++++++++--
2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/bazarr.py b/bazarr.py
index fe0771171..f85796d71 100644
--- a/bazarr.py
+++ b/bazarr.py
@@ -753,6 +753,8 @@ def save_settings():
c.execute("UPDATE table_settings_general SET serie_default_enabled = ?", (settings_serie_default_enabled,))
settings_serie_default_languages = str(request.forms.getall('settings_serie_default_languages'))
+ if settings_serie_default_languages == "['None']":
+ settings_serie_default_languages = 'None'
c.execute("UPDATE table_settings_general SET serie_default_languages = ?", (settings_serie_default_languages,))
settings_serie_default_hi = request.forms.get('settings_serie_default_hi')
@@ -770,6 +772,8 @@ def save_settings():
c.execute("UPDATE table_settings_general SET movie_default_enabled = ?", (settings_movie_default_enabled,))
settings_movie_default_languages = str(request.forms.getall('settings_movie_default_languages'))
+ if settings_movie_default_languages == "['None']":
+ settings_movie_default_languages = 'None'
c.execute("UPDATE table_settings_general SET movie_default_languages = ?", (settings_movie_default_languages,))
settings_movie_default_hi = request.forms.get('settings_movie_default_hi')
diff --git a/views/settings.tpl b/views/settings.tpl
index 6459b0180..9547b36a7 100644
--- a/views/settings.tpl
+++ b/views/settings.tpl
@@ -930,7 +930,7 @@
%if settings_general[9] == 'False':
%else:
-
+
%end
@@ -987,7 +987,7 @@
%if settings_general[9] == 'False':
%else:
-
+
%end
@@ -1223,6 +1223,18 @@
$("#settings_movie_default_hi_div").checkbox('uncheck');
}
+ if ($("#settings_single_language").checkbox('is checked')) {
+ $("#settings_serie_default_languages").parent().removeClass('multiple');
+ $("#settings_serie_default_languages").removeAttr('multiple');
+ $("#settings_movie_default_languages").parent().removeClass('multiple');
+ $("#settings_movie_default_languages").removeAttr('multiple');
+ } else {
+ $("#settings_serie_default_languages").parent().addClass('multiple');
+ $("#settings_serie_default_languages").attr('multiple');
+ $("#settings_movie_default_languages").parent().addClass('multiple');
+ $("#settings_movie_default_languages").attr('multiple');
+ }
+
$("#settings_single_language").change(function(i, obj) {
if ($("#settings_single_language").checkbox('is checked')) {
$("#settings_serie_default_languages").dropdown('clear');