node-red-contrib-hik-media-buffer 1.1.36 → 1.1.37
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 +3 -17
- package/package.json +1 -1
package/hik-media-buffer.js
CHANGED
|
@@ -27,8 +27,7 @@ module.exports = function(RED) {
|
|
|
27
27
|
let statoCamera = {};
|
|
28
28
|
|
|
29
29
|
const httpsAgent = new https.Agent({ rejectUnauthorized: false });
|
|
30
|
-
const
|
|
31
|
-
const EventListCAM = ["fielddetection", "linedetection"];
|
|
30
|
+
const EventList = ["FieldDetection", "LineDetection"];
|
|
32
31
|
|
|
33
32
|
// CARTELLA TEMPORANEA
|
|
34
33
|
const baseStorage = path.join(os.tmpdir(), "hik_temp_media");
|
|
@@ -246,22 +245,9 @@ module.exports = function(RED) {
|
|
|
246
245
|
if (data.includes("active")) {
|
|
247
246
|
const chMatch = data.match(/<channelid>(\d+)<\/channelid>/i);
|
|
248
247
|
if (chMatch) {
|
|
249
|
-
let channelID = chMatch[1];
|
|
250
|
-
let currentEventList = EventListNVR;
|
|
251
|
-
|
|
252
|
-
// --- IL TUO CONTROLLO LOGICO ---
|
|
253
|
-
// Se l'host di ascolto coincide con l'IP della telecamera termica (canale 2)
|
|
254
|
-
// e la telecamera restituisce erroneamente canale 1, forziamo il canale a 2
|
|
255
|
-
const camTermica = node.cameras.find(c => c.channel == "2");
|
|
256
|
-
if (camTermica && node.host === camTermica.ip) {
|
|
257
|
-
currentEventList = EventListCAM;
|
|
258
|
-
if (channelID === "1") {
|
|
259
|
-
channelID = "2";
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
248
|
let ev = "Unknown";
|
|
263
|
-
for (let e of
|
|
264
|
-
downloadMedia(ev,
|
|
249
|
+
for (let e of EventList) { if (data.includes(e.toLowerCase())) { ev = e; break; } }
|
|
250
|
+
downloadMedia(ev, chMatch[1]);
|
|
265
251
|
}
|
|
266
252
|
}
|
|
267
253
|
});
|