From 5bbaae54421e219f79f089c4dde6550c1ba7abcc Mon Sep 17 00:00:00 2001 From: Halali Date: Sun, 17 Feb 2019 10:38:45 +0100 Subject: [PATCH] Add port argument --- bazarr/get_args.py | 2 ++ bazarr/main.py | 8 +++----- views/menu.tpl | 3 ++- views/system.tpl | 3 ++- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/bazarr/get_args.py b/bazarr/get_args.py index 74b68955f..b55a2cf49 100644 --- a/bazarr/get_args.py +++ b/bazarr/get_args.py @@ -13,6 +13,8 @@ def get_args(): config_dir = os.path.realpath(os.path.join(os.path.dirname(__file__), '..', 'data')) parser.add_argument('-c', '--config', default=config_dir, type=str, metavar="DIR", dest="config_dir", help="Directory containing the configuration (default: %s)" % config_dir) + parser.add_argument('-p', '--port', type=int, metavar="PORT", dest="port", + help="Port number (default: 6767)") parser.add_argument('--no-update', default=False, type=bool, const=True, metavar="BOOL", nargs="?", help="Disable update functionality (default: False)") parser.add_argument('--debug', default=False, type=bool, const=True, metavar="BOOL", nargs="?", diff --git a/bazarr/main.py b/bazarr/main.py index 07be4b7ec..a9e88c9ff 100644 --- a/bazarr/main.py +++ b/bazarr/main.py @@ -1887,12 +1887,10 @@ def handle_websocket(): # Mute DeprecationWarning warnings.simplefilter("ignore", DeprecationWarning) - -server = WSGIServer((str(settings.general.ip), int(settings.general.port)), app, handler_class=WebSocketHandler) +server = WSGIServer((str(settings.general.ip), (int(args.port) if args.port else int(settings.general.port))), app, handler_class=WebSocketHandler) try: - logging.info('BAZARR is started and waiting for request on http://' + str(settings.general.ip) + ':' + str( - settings.general.port) + str(base_url)) - # print 'Bazarr is started and waiting for request on http://' + str(ip) + ':' + str(port) + str(base_url) + logging.info('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)) server.serve_forever() except KeyboardInterrupt: shutdown() diff --git a/views/menu.tpl b/views/menu.tpl index 039f75d15..f30e97fe6 100644 --- a/views/menu.tpl +++ b/views/menu.tpl @@ -192,8 +192,9 @@ }); % from config import settings + % from get_args import args % ip = settings.general.ip - % port = settings.general.port + % port = args.port if args.port else settings.general.port % base_url = settings.general.base_url if ("{{ip}}" === "0.0.0.0") { diff --git a/views/system.tpl b/views/system.tpl index 06b344f7a..40c9482d2 100644 --- a/views/system.tpl +++ b/views/system.tpl @@ -385,8 +385,9 @@ }); % from config import settings + % from get_args import args % ip = settings.general.ip - % port = settings.general.port + % port = args.port if args.port else settings.general.port % base_url = settings.general.base_url if ("{{ip}}" === "0.0.0.0") {