1
0
Fork 0
mirror of https://github.com/morpheus65535/bazarr synced 2024-12-25 01:02:19 +00:00

Remove requirement to restart Bazarr when changing General setting

This commit is contained in:
morpheus65535 2017-12-19 23:27:53 -05:00
parent e7b261b36a
commit 0f3a483e1b
2 changed files with 33 additions and 20 deletions

View file

@ -288,6 +288,7 @@ def save_settings():
else: else:
settings_general_automatic = 'True' settings_general_automatic = 'True'
c.execute("UPDATE table_settings_general SET ip = ?, port = ?, base_url = ?, path_mapping = ?, log_level = ?, branch=?, auto_update=?", (settings_general_ip, settings_general_port, settings_general_baseurl, str(settings_general_pathmapping), settings_general_loglevel, settings_general_branch, settings_general_automatic)) c.execute("UPDATE table_settings_general SET ip = ?, port = ?, base_url = ?, path_mapping = ?, log_level = ?, branch=?, auto_update=?", (settings_general_ip, settings_general_port, settings_general_baseurl, str(settings_general_pathmapping), settings_general_loglevel, settings_general_branch, settings_general_automatic))
get_general_settings()
settings_sonarr_ip = request.forms.get('settings_sonarr_ip') settings_sonarr_ip = request.forms.get('settings_sonarr_ip')
settings_sonarr_port = request.forms.get('settings_sonarr_port') settings_sonarr_port = request.forms.get('settings_sonarr_port')

View file

@ -2,6 +2,7 @@ import sqlite3
import os import os
import ast import ast
def get_general_settings():
# Open database connection # Open database connection
db = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'), timeout=30) db = sqlite3.connect(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'), timeout=30)
c = db.cursor() c = db.cursor()
@ -26,6 +27,8 @@ log_level = general_settings[4]
branch = general_settings[5] branch = general_settings[5]
automatic = general_settings[6] automatic = general_settings[6]
return [ip, port, base_url, path_mappings, log_level, branch, automatic]
def path_replace(path): def path_replace(path):
for path_mapping in path_mappings: for path_mapping in path_mappings:
if path_mapping[0] in path: if path_mapping[0] in path:
@ -47,3 +50,12 @@ def path_replace_reverse(path):
path = path.replace('\\', '/') path = path.replace('\\', '/')
break break
return path return path
result = get_general_settings()
ip = result[0]
port = result[1]
base_url = result[2]
path_mappings = result[3]
log_level = result[4]
branch = result[5]
automatic = result[6]