node-red-contrib-hik-media-buffer 1.1.51 → 1.1.52
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 +6 -7
- package/package.json +1 -1
package/hik-media-buffer.js
CHANGED
|
@@ -160,8 +160,8 @@ module.exports = function(RED) {
|
|
|
160
160
|
const trackFoto = (parsedChannel * 100) + 3;
|
|
161
161
|
|
|
162
162
|
const tracks = [
|
|
163
|
-
{ id: trackVideo.toString(), isFoto: false, label: "VIDEO" },
|
|
164
|
-
{ id: trackFoto.toString(), isFoto: true, label: "FOTO" }
|
|
163
|
+
{ id: trackVideo.toString(), isFoto: false, label: "VIDEO", type: "video" },
|
|
164
|
+
{ id: trackFoto.toString(), isFoto: true, label: "FOTO", type: "metadata" }
|
|
165
165
|
];
|
|
166
166
|
let fileDaCancellare = [];
|
|
167
167
|
|
|
@@ -169,8 +169,8 @@ module.exports = function(RED) {
|
|
|
169
169
|
for (let t of tracks) {
|
|
170
170
|
node.warn(`[STEP 4] Elaborazione traccia ${t.label} (ID: ${t.id})`);
|
|
171
171
|
|
|
172
|
-
//
|
|
173
|
-
const searchXml = `<?xml version="1.0" encoding="utf-8"?><CMSearchDescription><searchID>LAST_EVENT</searchID><trackIDList><trackID>${t.id}</trackID></trackIDList><timeSpanList><timeSpan><startTime>${startTime}</startTime><endTime>${endTime}</endTime></timeSpan></timeSpanList><contentTypeList><contentType
|
|
172
|
+
// COPIATO DALL'ISPEZIONA REALE AL 100%: Mantenuto l'ordine esatto dei tag per evitare l'errore "two root tags"
|
|
173
|
+
const searchXml = `<?xml version="1.0" encoding="utf-8"?><CMSearchDescription><searchID>LAST_EVENT</searchID><trackIDList><trackID>${t.id}</trackID></trackIDList><timeSpanList><timeSpan><startTime>${startTime}</startTime><endTime>${endTime}</endTime></timeSpan></timeSpanList><contentTypeList><contentType>${t.type}</contentType></contentTypeList><maxResults>30</maxResults><searchResultPostion>0</searchResultPostion><metadataList><metadataDescriptor>recordType.meta.hikvision.com/${eventoNVR}</metadataDescriptor></metadataList></CMSearchDescription>`;
|
|
174
174
|
|
|
175
175
|
node.warn(`[STEP 4.1] Invio POST /search per traccia ${t.id}. XML inviato:\n${searchXml}`);
|
|
176
176
|
|
|
@@ -182,7 +182,7 @@ module.exports = function(RED) {
|
|
|
182
182
|
headers: { "Content-Type": "application/xml" }
|
|
183
183
|
});
|
|
184
184
|
|
|
185
|
-
node.warn(`[STEP 4.2] Risposta ricevuta da /search per traccia ${t.id}:
|
|
185
|
+
node.warn(`[STEP 4.2] Risposta ricevuta da /search per traccia ${t.id}: Status ${resSearch.status}`);
|
|
186
186
|
|
|
187
187
|
let xml = resSearch.data.replace(/<(\/?)\w+:/g, "<$1");
|
|
188
188
|
const uriMatch = xml.match(/<playbackURI>([^<]+)</);
|
|
@@ -234,7 +234,6 @@ module.exports = function(RED) {
|
|
|
234
234
|
node.warn(`[STEP 4.3] Nessun playbackURI trovato nel documento di risposta XML per traccia ${t.id}. XML di risposta:\n${resSearch.data}`);
|
|
235
235
|
}
|
|
236
236
|
} catch (searchError) {
|
|
237
|
-
// CATTURA DETTAGLIATA DELL'ERRORE 400
|
|
238
237
|
let errorDetails = searchError.message;
|
|
239
238
|
if (searchError.response) {
|
|
240
239
|
errorDetails += ` | Status: ${searchError.response.status} | Dati Risposta: ${JSON.stringify(searchError.response.data)}`;
|
|
@@ -259,7 +258,7 @@ module.exports = function(RED) {
|
|
|
259
258
|
} catch (e) {
|
|
260
259
|
node.error(`[FATAL ERROR] Blocco principale downloadMedia fallito: ${e.message}`);
|
|
261
260
|
}
|
|
262
|
-
|
|
261
|
+
node.status({fill:"green", shape:"ring", text:"In ascolto"});
|
|
263
262
|
}
|
|
264
263
|
|
|
265
264
|
function startAlertStream() {
|