From 9235870792326c2a7a9d8ccb627742dcc491f5ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis=20V=C3=A9zina?= <5130500+morpheus65535@users.noreply.github.com> Date: Sun, 17 May 2020 09:19:37 -0400 Subject: [PATCH] WIP --- bazarr/main.py | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/bazarr/main.py b/bazarr/main.py index 8c5682cec..4f464abab 100644 --- a/bazarr/main.py +++ b/bazarr/main.py @@ -465,25 +465,21 @@ def test_notification(protocol, provider): class Server: - try: - server - except NameError: - if args.dev: - server = app.run(host=str(settings.general.ip), - port=(int(args.port) if args.port else int(settings.general.port))) - else: - server = create_server(app, - host=str(settings.general.ip), - port=int(args.port) if args.port else int(settings.general.port), - threads=24) - - def __init__(self): - # Mute DeprecationWarning - warnings.simplefilter("ignore", DeprecationWarning) - # Mute Insecure HTTPS requests made to Sonarr and Radarr - warnings.filterwarnings('ignore', message='Unverified HTTPS request') - # Mute Python3 BrokenPipeError - warnings.simplefilter("ignore", BrokenPipeError) + # Mute DeprecationWarning + warnings.simplefilter("ignore", DeprecationWarning) + # Mute Insecure HTTPS requests made to Sonarr and Radarr + warnings.filterwarnings('ignore', message='Unverified HTTPS request') + # Mute Python3 BrokenPipeError + warnings.simplefilter("ignore", BrokenPipeError) + + if args.dev: + server = app.run(host=str(settings.general.ip), + port=(int(args.port) if args.port else int(settings.general.port))) + else: + server = create_server(app, + host=str(settings.general.ip), + port=int(args.port) if args.port else int(settings.general.port), + threads=24) @classmethod def start(cls): @@ -507,7 +503,7 @@ class Server: try: stop_file = io.open(os.path.join(args.config_dir, "bazarr.stop"), "w", encoding='UTF-8') except Exception as e: - logging.error('BAZARR Cannot create bazarr.stop file.') + logging.error('BAZARR Cannot create bazarr.stop file: ' + repr(e)) else: logging.info('Bazarr is being shutdown...') stop_file.write(str('')) @@ -525,7 +521,7 @@ class Server: try: restart_file = io.open(os.path.join(args.config_dir, "bazarr.restart"), "w", encoding='UTF-8') except Exception as e: - logging.error('BAZARR Cannot create bazarr.restart file.') + logging.error('BAZARR Cannot create bazarr.restart file: ' + repr(e)) else: logging.info('Bazarr is being restarted...') restart_file.write(str(''))