node-red-contrib-hik-media-buffer 1.1.13 → 1.1.14
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 +5 -16
- package/package.json +1 -1
package/hik-media-buffer.js
CHANGED
|
@@ -48,17 +48,17 @@ module.exports = function(RED) {
|
|
|
48
48
|
});
|
|
49
49
|
|
|
50
50
|
try {
|
|
51
|
-
// Interroghiamo
|
|
51
|
+
// Interroghiamo l'overlay del nome del canale specifico
|
|
52
52
|
const res = await camAuth.request({
|
|
53
53
|
method: 'GET',
|
|
54
|
-
url: `${node.protocol}://${cam.ip}:${node.port}/ISAPI/System/Video/inputs/channels/${cam.channel}`,
|
|
54
|
+
url: `${node.protocol}://${cam.ip}:${node.port}/ISAPI/System/Video/inputs/channels/${cam.channel}/overlays/channelNameOverlay`,
|
|
55
55
|
timeout: 5000,
|
|
56
56
|
httpsAgent: node.protocol === "https" ? httpsAgent : undefined
|
|
57
57
|
});
|
|
58
58
|
|
|
59
59
|
const data = res.data.toString();
|
|
60
60
|
|
|
61
|
-
//
|
|
61
|
+
// Il manuale specifica che il nome è nel tag <name>
|
|
62
62
|
const match = data.match(/<name>([^<]+)<\/name>/i);
|
|
63
63
|
|
|
64
64
|
if (match && match[1]) {
|
|
@@ -68,19 +68,8 @@ module.exports = function(RED) {
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
} catch (e) {
|
|
71
|
-
//
|
|
72
|
-
|
|
73
|
-
const resAlt = await camAuth.request({
|
|
74
|
-
method: 'GET',
|
|
75
|
-
url: `${node.protocol}://${cam.ip}:${node.port}/ISAPI/ContentMgmt/InputProxy/channels/${cam.channel}`,
|
|
76
|
-
timeout: 3000
|
|
77
|
-
});
|
|
78
|
-
const dataAlt = resAlt.data.toString();
|
|
79
|
-
const matchAlt = dataAlt.match(/<name>([^<]+)<\/name>/i);
|
|
80
|
-
return matchAlt ? matchAlt[1].trim() : `Cam_${cam.channel}`;
|
|
81
|
-
} catch (err) {
|
|
82
|
-
return `Camera_${cam.ip}`;
|
|
83
|
-
}
|
|
71
|
+
// Fallback: se non risponde, usiamo l'IP
|
|
72
|
+
return `Camera_${cam.ip}`;
|
|
84
73
|
}
|
|
85
74
|
}
|
|
86
75
|
|