node-red-contrib-hik-media-buffer 1.1.94 → 1.1.96
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 +9 -6
- package/package.json +1 -1
package/hik-media-buffer.js
CHANGED
|
@@ -136,20 +136,23 @@ module.exports = function(RED) {
|
|
|
136
136
|
let fileDaCancellare = [];
|
|
137
137
|
|
|
138
138
|
try {
|
|
139
|
-
//
|
|
139
|
+
// Generiamo il SearchID dinamico per evitare il crash di prima
|
|
140
|
+
const dynamicSearchId = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
|
|
141
|
+
var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
|
|
142
|
+
return v.toString(16).toUpperCase();
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
// Usiamo l'ID della traccia video reale (es. 201 per il canale 2)
|
|
140
146
|
const searchPayload = {
|
|
141
147
|
"EventSearchDescription": {
|
|
142
|
-
"searchID":
|
|
148
|
+
"searchID": dynamicSearchId,
|
|
143
149
|
"searchResultPosition": 0,
|
|
144
150
|
"maxResults": 10,
|
|
145
151
|
"timeSpanList": [{ "startTime": startTime, "endTime": endTime }],
|
|
146
152
|
"type": "all",
|
|
147
|
-
"channels": [ parseInt(channelID) ]
|
|
148
|
-
"eventType": "behavior",
|
|
149
|
-
"behavior": { "behaviorEventType": evento.toLowerCase() }
|
|
153
|
+
"channels": [ parseInt(channelID * 100 + 1) ]
|
|
150
154
|
}
|
|
151
155
|
};
|
|
152
|
-
|
|
153
156
|
const tempJsonPath = path.join(baseStorage, `search_${channelID}_${timestamp}.json`);
|
|
154
157
|
fs.writeFileSync(tempJsonPath, JSON.stringify(searchPayload), 'utf8');
|
|
155
158
|
|