From ee20b2d6dec2384a16662ac05a059e67bd9f28af Mon Sep 17 00:00:00 2001 From: Calin Crisan Date: Sat, 10 Dec 2016 21:17:06 +0200 Subject: [PATCH] fixed wrong frames showing progress when applying settings --- motioneye/static/js/main.js | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) 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) { -- 2.39.5