node-red-contrib-hik-media-buffer 1.1.113 → 1.1.114

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.
@@ -68,16 +68,14 @@ module.exports = function(RED) {
68
68
  });
69
69
 
70
70
  const xml = res.data.toString();
71
- // Regex per estrarre ogni blocco VideoInputChannel
72
71
  const channelBlocks = xml.match(/<VideoInputChannel>[\s\S]*?<\/VideoInputChannel>/g) || [];
73
72
 
74
73
  for (let block of channelBlocks) {
75
74
  const idMatch = block.match(/<id>(\d+)<\/id>/i);
76
- const statusMatch = block.match(/<resVerType>([^<]+)<\/resVerType>/i); // online / offline o simile in base al firmware
75
+ const statusMatch = block.match(/<resVerType>([^<]+)<\/resVerType>/i);
77
76
 
78
77
  if (idMatch) {
79
78
  const ch = idMatch[1];
80
- // Se non trova il tag esplicito o dice "online", assumiamo sia attiva
81
79
  const isOnline = statusMatch ? statusMatch[1].toLowerCase() === "online" : true;
82
80
 
83
81
  if (isOnline && statoCamera[ch] === false) {
@@ -92,9 +90,7 @@ module.exports = function(RED) {
92
90
  }
93
91
  }
94
92
  }
95
- } catch (e) {
96
- // Se l'NVR fallisce la chiamata generale, lo gestisce l'alert stream o lasciamo lo stato immutato
97
- }
93
+ } catch (e) {}
98
94
  updateNodeStatus();
99
95
  }
100
96
 
@@ -128,7 +124,7 @@ module.exports = function(RED) {
128
124
  const nomeCamera = await getCameraNameFromNVR(channelID);
129
125
  node.status({fill:"yellow", shape:"dot", text:`Download Cam ${channelID}...`});
130
126
 
131
- // Finestra temporale di 14 ore per la ricerca (adeguata al tuo esempio)
127
+ // Finestra temporale per la ricerca foto JSON
132
128
  const startSearchStr = referenceTime.toISOString().split('T')[0] + "T00:00:00 01:00";
133
129
  const endSearchStr = referenceTime.toISOString().split('T')[0] + "T23:59:59 01:00";
134
130
 
@@ -173,8 +169,9 @@ module.exports = function(RED) {
173
169
  httpsAgent: node.protocol === "https" ? httpsAgent : undefined
174
170
  });
175
171
 
176
- if (resFotoSearch.data?.EventSearchResult?.matchList?.[0]?.pictureUrl) {
177
- const urlFotoGrezzo = resFotoSearch.data.EventSearchResult.matchList[0].pictureUrl;
172
+ // CORRETTO: Adesso cerca dentro Targets e prende il pictureUrl grezzo come su Postman
173
+ if (resFotoSearch.data?.EventSearchResult?.Targets?.[0]?.pictureUrl) {
174
+ const urlFotoGrezzo = resFotoSearch.data.EventSearchResult.Targets[0].pictureUrl;
178
175
 
179
176
  const resDownFoto = await nvrAuth.request({
180
177
  method: 'GET',
@@ -190,7 +187,6 @@ module.exports = function(RED) {
190
187
  }
191
188
 
192
189
  // 2. SCARICAMENTO VIDEO (POST XML a search -> GET XML a download)
193
- // Usiamo una finestra temporale estesa in formato Z come richiesto dall'NVR
194
190
  const startVideoSearch = referenceTime.toISOString().split('T')[0] + "T00:00:00Z";
195
191
  const endVideoSearch = referenceTime.toISOString().split('T')[0] + "T23:59:59Z";
196
192
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-hik-media-buffer",
3
- "version": "1.1.113",
3
+ "version": "1.1.114",
4
4
  "description": "Ottiene buffer video e immagine da camere Hikvision via ISAPI",
5
5
  "keywords": [
6
6
  "node-red",