mirror of
https://github.com/morpheus65535/bazarr.git
synced 2025-01-11 01:07:36 +08:00
WIP
This commit is contained in:
parent
67d5e2a9c2
commit
62093864f2
3 changed files with 22 additions and 7 deletions
|
@ -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
|
||||
|
|
|
@ -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':
|
||||
|
|
|
@ -3,7 +3,11 @@
|
|||
{% block title %}Languages - Bazarr{% endblock %}
|
||||
|
||||
{% block page_head %}
|
||||
|
||||
<style>
|
||||
.warning {
|
||||
color: red;
|
||||
}
|
||||
</style>
|
||||
{% endblock page_head %}
|
||||
|
||||
{% block bcleft %}
|
||||
|
@ -33,11 +37,13 @@
|
|||
<div class="col-sm-3 text-right">
|
||||
<b>Single Language</b>
|
||||
</div>
|
||||
<div class="form-group col-sm-1">
|
||||
<div class="form-group col-sm-8">
|
||||
<label class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input" id="settings-general-single_language" name="settings-general-single_language">
|
||||
<span class="custom-control-label" for="settings-general-single_language"></span>
|
||||
</label>
|
||||
<label>Download a single Subtitles file without adding the language code to the filename.</label>
|
||||
<label class="warning">We don't recommend enabling this option unless absolutely required (ie: media player not supporting language code in subtitles filename). Results may vary.</label>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
|
@ -143,7 +149,6 @@
|
|||
$('input[type=checkbox]').each(function () {
|
||||
formdata.set($(this).prop('id'), $(this).prop('checked'));
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
url: "{{ url_for('api.savesettings') }}",
|
||||
data: formdata,
|
||||
|
@ -179,8 +184,11 @@
|
|||
$.ajax({
|
||||
url: "{{ url_for('api.languages') }}?enabled=true",
|
||||
success: function (data) {
|
||||
console.log(data);
|
||||
$('#enabled_languages').selectpicker('val', data);
|
||||
let optArr = [];
|
||||
$.each(data, function (i, item) {
|
||||
optArr.push(item.code2);
|
||||
});
|
||||
$('#enabled_languages').selectpicker('val', optArr);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue