node-red-contrib-hik-media-buffer 1.1.61 → 1.1.63

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.
@@ -32,10 +32,10 @@ module.exports = function(RED) {
32
32
 
33
33
  node.status({fill:"grey", shape:"ring", text:"Inizializzazione..."});
34
34
 
35
- // FORMATTAZIONE DATA CORRETTA PER HARD DISK NVR (Rimosso lo zulu 'Z' che mandava in 400 il database)
36
35
  function toHikDate(d) {
37
36
  const pad = (num) => String(num).padStart(2, '0');
38
- return `${d.getFullYear()}-${pad(d.getMonth()+1)}-${pad(d.getDate())}T${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`;
37
+ // Genera esattamente: YYYY-MM-DDTHH:mm:ssZ
38
+ return `${d.getUTCFullYear()}-${pad(d.getUTCMonth()+1)}-${pad(d.getUTCDate())}T${pad(d.getUTCHours())}:${pad(d.getUTCMinutes())}:${pad(d.getUTCSeconds())}Z`;
39
39
  }
40
40
 
41
41
  async function getCameraName(channelID) {
@@ -174,17 +174,15 @@ module.exports = function(RED) {
174
174
 
175
175
  try {
176
176
  for (let t of tracks) {
177
- node.warn(`[warn] [hik-media-buffer:test] [STEP 4] Elaborazione traccia ${t.label} (ID: ${t.id})`);
177
+ node.warn(`[warn] [hik-media-buffer:test] [STEP 4] Elaborazione traccia ${t.label} (ID: ${t.id})`);
178
178
 
179
- // SVEGLIA: Trasformiamo l'evento in tutto minuscolo (linedetection / fielddetection) come vuole l'NVR!
180
- const eventoMinuscolo = eventoNVR.toLowerCase();
181
- const descriptorTarget = `recordType.meta.hikvision.com/${eventoMinuscolo}`;
179
+ const contentTypeValue = t.isFoto ? "metadata" : "video";
180
+ const descriptorTarget = t.isFoto ? `recordType.meta.hikvision.com/${eventoNVR.toLowerCase()}` : `recordType.meta.hikvision.com/timing`;
182
181
 
183
- // Il TUO XML originale, pulito, senza tag inventati
184
- 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><maxResults>100</maxResults><metadataList><metadataDescriptor>${descriptorTarget}</metadataDescriptor></metadataList></CMSearchDescription>`;
182
+ // Struttura rigida sequenziale approvata dall'NVR (con l'errore di battitura nativo searchResultPostion)
183
+ 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>${contentTypeValue}</contentType></contentTypeList><maxResults>30</maxResults><searchResultPostion>0</searchResultPostion><metadataList><metadataDescriptor>${descriptorTarget}</metadataDescriptor></metadataList></CMSearchDescription>`;
185
184
 
186
185
  node.warn(`[warn] [hik-media-buffer:test] [STEP 4.1] Invio POST /search per traccia ${t.id}. XML inviato:\n${searchXml}`);
187
-
188
186
  try {
189
187
  const resSearch = await camAuth.request({
190
188
  method: 'POST',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-hik-media-buffer",
3
- "version": "1.1.61",
3
+ "version": "1.1.63",
4
4
  "description": "Ottiene buffer video e immagine da camere Hikvision via ISAPI",
5
5
  "keywords": [
6
6
  "node-red",