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 8f148759b..ce8e0c5f2 100644 --- a/bazarr/main.py +++ b/bazarr/main.py @@ -1874,11 +1874,10 @@ def notifications(): # 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)) + 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 975744da5..e72bf060a 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") {