From: Calin Crisan Date: Sat, 23 Aug 2014 17:47:17 +0000 (+0300) Subject: fixed camera/instance association when applying settings X-Git-Url: http://www.vanbest.org/gitweb/?a=commitdiff_plain;h=e7debe6ebe0c9b056337e6cc98571e7acb17288e;p=motioneye-debian fixed camera/instance association when applying settings --- diff --git a/src/handlers.py b/src/handlers.py index 36a5928..f295218 100644 --- a/src/handlers.py +++ b/src/handlers.py @@ -483,6 +483,7 @@ class ConfigHandler(BaseHandler): else: remote_ui_config['id'] = camera_id + if not remote_ui_config['enabled'] and local_config['@enabled']: # if a remote camera is disabled, make sure it's disabled locally as well local_config['@enabled'] = False @@ -492,6 +493,9 @@ class ConfigHandler(BaseHandler): # if a remote camera is locally disabled, make sure the remote config says the same thing remote_ui_config['enabled'] = False + for key, value in local_config.items(): + remote_ui_config[key.replace('@', '')] = value + cameras.append(remote_ui_config) check_finished() diff --git a/static/js/main.js b/static/js/main.js index 9f43849..ab77d63 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -1035,9 +1035,15 @@ function doApply() { return; } - var instance = config.host || ''; - if (config.port) { - instance += ':' + config.port; + var instance; + if (config.proto == 'http' || config.proto == 'v4l2') { + instance = ''; + } + else { /* motioneye */ + instance = config.host || ''; + if (config.port) { + instance += ':' + config.port; + } } affectedInstances[instance] = true; @@ -1367,9 +1373,15 @@ function getCameraIdsByInstance() { var cameraIdsByInstance = {}; $('div.camera-frame').each(function () { - var instance = this.config.host || ''; - if (this.config.port) { - instance += ':' + this.config.port; + var instance; + if (this.config.proto == 'http' || this.config.proto == 'v4l2') { + instance = ''; + } + else { /* motioneye */ + instance = this.config.host || ''; + if (this.config.port) { + instance += ':' + this.config.port; + } } (cameraIdsByInstance[instance] = cameraIdsByInstance[instance] || []).push(this.config.id);