node-red-contrib-hik-media-buffer 1.1.32 → 1.1.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/hik-media-buffer.js +8 -4
- package/package.json +1 -1
package/hik-media-buffer.js
CHANGED
|
@@ -22,7 +22,7 @@ module.exports = function(RED) {
|
|
|
22
22
|
|
|
23
23
|
let streamRequest = null;
|
|
24
24
|
let isClosing = false;
|
|
25
|
-
let lastTriggerTime =
|
|
25
|
+
let lastTriggerTime = {};
|
|
26
26
|
let nvrOnline = true;
|
|
27
27
|
let statoCamera = {};
|
|
28
28
|
|
|
@@ -111,12 +111,16 @@ module.exports = function(RED) {
|
|
|
111
111
|
// --- DOWNLOAD, SALVATAGGIO, CONVERSIONE E RIMOZIONE DOPO 2 MINUTI ---
|
|
112
112
|
async function downloadMedia(evento, channelID) {
|
|
113
113
|
const camera = node.cameras.find(c => c.channel == channelID);
|
|
114
|
-
const nomeCamera = await getCameraName(camera);
|
|
115
114
|
if (!camera) return;
|
|
116
115
|
|
|
116
|
+
const nomeCamera = await getCameraName(camera);
|
|
117
|
+
|
|
117
118
|
const nowTime = Date.now();
|
|
118
|
-
if
|
|
119
|
-
|
|
119
|
+
if(!lastTriggerTime[camera.ip]){
|
|
120
|
+
lastTriggerTime[camera.ip] = 0;
|
|
121
|
+
}
|
|
122
|
+
if (nowTime - lastTriggerTime[camera.ip] < 5000) return;
|
|
123
|
+
lastTriggerTime[camera.ip] = nowTime;
|
|
120
124
|
|
|
121
125
|
const camAuth = new AxiosDigestAuth({ username: node.user, password: node.camPass });
|
|
122
126
|
const referenceTime = new Date();
|