node-red-contrib-hik-media-buffer 1.1.49 → 1.1.50

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.
@@ -78,7 +78,6 @@ module.exports = function(RED) {
78
78
  while ((matchBlocco = bloccoRegex.exec(xmlData)) !== null) {
79
79
  const bloccoContenuto = matchBlocco[1];
80
80
 
81
- // FISSO: Corretto il nome della variabile bloccoContenuto (prima c'era un typo che rompeva il nodo)
82
81
  const idMatch = bloccoContenuto.match(/<id>(\d+)<\/id>/i);
83
82
  const statusMatch = bloccoContenuto.match(/<status>([^<]+)</i);
84
83
 
@@ -119,7 +118,7 @@ module.exports = function(RED) {
119
118
 
120
119
  const heartbeatInterval = setInterval(checkCameras, 30000);
121
120
 
122
- // --- DOWNLOAD MULTIMEDIALE BASATO SULL'ISPEZIONA REALE DELL'NVR ---
121
+ // --- DOWNLOAD MULTIMEDIALE CON DIFFERENZIAZIONE XML VIDEO/FOTO ---
123
122
  async function downloadMedia(evento, channelID) {
124
123
  const nowTime = Date.now();
125
124
  if (!lastTriggerTime[channelID]) lastTriggerTime[channelID] = 0;
@@ -173,8 +172,15 @@ module.exports = function(RED) {
173
172
 
174
173
  try {
175
174
  for (let t of tracks) {
176
- // FISSO: Logica XML clonata al 100% dal tuo ispeziona NVR reale
177
- 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>metadata</contentType></contentTypeList><maxResults>30</maxResults><metadataList><metadataDescriptor>recordType.meta.hikvision.com/${eventoNVR}</metadataDescriptor></metadataList></CMSearchDescription>`;
175
+ let searchXml = "";
176
+
177
+ if (t.isFoto) {
178
+ // XML CLONATO DALL'ISPEZIONA IMMAGINI: Per cercare le foto (metadata)
179
+ 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>metadata</contentType></contentTypeList><maxResults>30</maxResults><metadataList><metadataDescriptor>recordType.meta.hikvision.com/${eventoNVR}</metadataDescriptor></metadataList></CMSearchDescription>`;
180
+ } else {
181
+ // XML ADATTATO PER I VIDEO: Cambiato il contentType in video per non mandare l'NVR in errore 400
182
+ 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>video</contentType></contentTypeList><maxResults>30</maxResults><metadataList><metadataDescriptor>recordType.meta.hikvision.com/${eventoNVR}</metadataDescriptor></metadataList></CMSearchDescription>`;
183
+ }
178
184
 
179
185
  const resSearch = await camAuth.request({
180
186
  method: 'POST', url: `${baseUrl}/search`, data: searchXml, headers: { "Content-Type": "application/xml" }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-hik-media-buffer",
3
- "version": "1.1.49",
3
+ "version": "1.1.50",
4
4
  "description": "Ottiene buffer video e immagine da camere Hikvision via ISAPI",
5
5
  "keywords": [
6
6
  "node-red",