From 8e91beed83e6b5a4bec680d15b226a77ff3e224e Mon Sep 17 00:00:00 2001 From: Rato Date: Tue, 13 Apr 2021 06:00:49 +0200 Subject: [PATCH] Extend simpleconfigparser to not strip quotes from the string value This is a suggestion fix for #309 --- bazarr/config.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/bazarr/config.py b/bazarr/config.py index 98711824e..216e8fc48 100644 --- a/bazarr/config.py +++ b/bazarr/config.py @@ -8,10 +8,20 @@ from urllib.parse import quote_plus from subliminal.cache import region -from simpleconfigparser import simpleconfigparser +from simpleconfigparser import simpleconfigparser, configparser, NoOptionError from get_args import args + +class SimpleConfigParser(simpleconfigparser): + + def get(self, section, option, raw=False, vars=None): + try: + return configparser.get(self, section, option, raw=raw, vars=vars) + except NoOptionError: + return None + + defaults = { 'general': { 'ip': '0.0.0.0', @@ -172,7 +182,7 @@ defaults = { } } -settings = simpleconfigparser(defaults=defaults, interpolation=None) +settings = SimpleConfigParser(defaults=defaults, interpolation=None) settings.read(os.path.join(args.config_dir, 'config', 'config.ini')) settings.general.base_url = settings.general.base_url if settings.general.base_url else '/'