From: Calin Crisan <ccrisan@gmail.com>
Date: Sat, 10 Dec 2016 19:17:06 +0000 (+0200)
Subject: fixed wrong frames showing progress when applying settings
X-Git-Url: http://www.vanbest.org/gitweb/?a=commitdiff_plain;h=ee20b2d6dec2384a16662ac05a059e67bd9f28af;p=motioneye-debian

fixed wrong frames showing progress when applying settings
---

diff --git a/motioneye/static/js/main.js b/motioneye/static/js/main.js
index 016b2f1..a627a60 100644
--- a/motioneye/static/js/main.js
+++ b/motioneye/static/js/main.js
@@ -2455,31 +2455,28 @@ function doApply() {
     }
     
     function actualApply() {
+        var cameraIdsByInstance = getCameraIdsByInstance();
+
         /* gather the affected motion instances */
         var affectedInstances = {};
+        
         Object.keys(pushConfigs).forEach(function (key) {
-            var config = pushConfigs[key];
-            if (key === 'main') {
+            if (key == 'main') {
                 return;
             }
             
-            var instance;
-            if (config.proto == 'netcam' || config.proto == 'v4l2') {
-                instance = '';
-            }
-            else if (config.proto == 'motioneye') { /* motioneye */
-                instance = config.host || '';
-                if (config.port) {
-                    instance += ':' + config.port;
+            /* key is a camera id */
+            Object.keys(cameraIdsByInstance).forEach(function (instance) {
+                var cameraIds = cameraIdsByInstance[instance];
+                if (cameraIds.indexOf(parseInt(key)) >= 0) {
+                    affectedInstances[instance] = true;
                 }
-            }
-            
-            affectedInstances[instance] = true;
+            });
         });
+
         affectedInstances = Object.keys(affectedInstances);
         
         /* compute the affected camera ids */ 
-        var cameraIdsByInstance = getCameraIdsByInstance();
         var affectedCameraIds = [];
         
         affectedInstances.forEach(function (instance) {