node-red-contrib-hik-media-buffer 1.1.74 → 1.1.76
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 -4
- package/package.json +1 -1
package/hik-media-buffer.js
CHANGED
|
@@ -152,15 +152,16 @@ module.exports = function(RED) {
|
|
|
152
152
|
let fileDaCancellare = [];
|
|
153
153
|
|
|
154
154
|
try {
|
|
155
|
+
let searchXml = ``;
|
|
155
156
|
const trackV = (channelID*100+1).toString();
|
|
156
157
|
const trackI = (channelID*100+3).toString();
|
|
157
158
|
const tracks = [{ id: trackV }, { id: trackI }];
|
|
158
159
|
for (let t of tracks) {
|
|
159
|
-
if(t.id
|
|
160
|
-
|
|
160
|
+
if(t.id===trackV){
|
|
161
|
+
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>//recordType.meta.std-cgi.com/${evento}</metadataDescriptor></metadataList></CMSearchDescription>`;
|
|
161
162
|
|
|
162
163
|
} else{
|
|
163
|
-
|
|
164
|
+
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>//recordType.meta.hikvision.com/${evento}</metadataDescriptor></metadataList></CMSearchDescription>`;
|
|
164
165
|
}
|
|
165
166
|
|
|
166
167
|
const resSearch = await camAuth.request({
|
|
@@ -180,7 +181,7 @@ module.exports = function(RED) {
|
|
|
180
181
|
});
|
|
181
182
|
|
|
182
183
|
let buffer = Buffer.from(resDown.data);
|
|
183
|
-
if (t.id ===
|
|
184
|
+
if (t.id === trackI) {
|
|
184
185
|
// SALVA FOTO IN LOCALE
|
|
185
186
|
const fullImgPath = path.join(baseStorage, `img_${timestamp}.jpg`);
|
|
186
187
|
fs.writeFileSync(fullImgPath, buffer);
|