|
|
@ -464,38 +464,39 @@ def test_notification(protocol, provider):
|
|
|
|
return '', 200
|
|
|
|
return '', 200
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Server():
|
|
|
|
class Server:
|
|
|
|
def __init__(self):
|
|
|
|
# Mute DeprecationWarning
|
|
|
|
# Mute DeprecationWarning
|
|
|
|
warnings.simplefilter("ignore", DeprecationWarning)
|
|
|
|
warnings.simplefilter("ignore", DeprecationWarning)
|
|
|
|
# Mute Insecure HTTPS requests made to Sonarr and Radarr
|
|
|
|
# Mute Insecure HTTPS requests made to Sonarr and Radarr
|
|
|
|
warnings.filterwarnings('ignore', message='Unverified HTTPS request')
|
|
|
|
warnings.filterwarnings('ignore', message='Unverified HTTPS request')
|
|
|
|
# Mute Python3 BrokenPipeError
|
|
|
|
# Mute Python3 BrokenPipeError
|
|
|
|
warnings.simplefilter("ignore", BrokenPipeError)
|
|
|
|
warnings.simplefilter("ignore", BrokenPipeError)
|
|
|
|
|
|
|
|
|
|
|
|
if args.dev:
|
|
|
|
if args.dev:
|
|
|
|
server = app.run(
|
|
|
|
self.server = app.run(
|
|
|
|
host=str(settings.general.ip),
|
|
|
|
host=str(settings.general.ip),
|
|
|
|
port=(int(args.port) if args.port else int(settings.general.port)))
|
|
|
|
port=(int(args.port) if args.port else int(settings.general.port)))
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
server = create_server(app,
|
|
|
|
self.server = create_server(app,
|
|
|
|
host=str(settings.general.ip),
|
|
|
|
host=str(settings.general.ip),
|
|
|
|
port=int(args.port) if args.port else int(settings.general.port),
|
|
|
|
port=int(args.port) if args.port else int(settings.general.port),
|
|
|
|
threads=24)
|
|
|
|
threads=24)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def start(self):
|
|
|
|
@classmethod
|
|
|
|
|
|
|
|
def start(cls):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
logging.info(
|
|
|
|
logging.info(
|
|
|
|
'BAZARR is started and waiting for request on http://' + str(settings.general.ip) + ':' + (str(
|
|
|
|
'BAZARR is started and waiting for request on http://' + str(settings.general.ip) + ':' + (str(
|
|
|
|
args.port) if args.port else str(settings.general.port)) + str(base_url))
|
|
|
|
args.port) if args.port else str(settings.general.port)) + str(base_url))
|
|
|
|
if not args.dev:
|
|
|
|
if not args.dev:
|
|
|
|
self.server.run()
|
|
|
|
cls.server.run()
|
|
|
|
except KeyboardInterrupt:
|
|
|
|
except KeyboardInterrupt:
|
|
|
|
self.shutdown()
|
|
|
|
cls.shutdown()
|
|
|
|
|
|
|
|
|
|
|
|
def shutdown(self):
|
|
|
|
@classmethod
|
|
|
|
|
|
|
|
def shutdown(cls):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
self.server.close()
|
|
|
|
cls.server.close()
|
|
|
|
except:
|
|
|
|
except:
|
|
|
|
logging.error('BAZARR Cannot stop Waitress.')
|
|
|
|
logging.error('BAZARR Cannot stop Waitress.')
|
|
|
|
else:
|
|
|
|
else:
|
|
|
@ -510,9 +511,10 @@ class Server():
|
|
|
|
stop_file.close()
|
|
|
|
stop_file.close()
|
|
|
|
os._exit(0)
|
|
|
|
os._exit(0)
|
|
|
|
|
|
|
|
|
|
|
|
def restart(self):
|
|
|
|
@classmethod
|
|
|
|
|
|
|
|
def restart(cls):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
self.server.close()
|
|
|
|
cls.server.close()
|
|
|
|
except:
|
|
|
|
except:
|
|
|
|
logging.error('BAZARR Cannot stop Waitress.')
|
|
|
|
logging.error('BAZARR Cannot stop Waitress.')
|
|
|
|
else:
|
|
|
|
else:
|
|
|
@ -528,8 +530,5 @@ class Server():
|
|
|
|
os._exit(0)
|
|
|
|
os._exit(0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
webserver = Server()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
if __name__ == "__main__":
|
|
|
|
webserver.start()
|
|
|
|
Server.start()
|
|
|
|