crabatool 1.0.849 → 1.0.850

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "crabatool",
3
- "version": "1.0.849",
3
+ "version": "1.0.850",
4
4
  "description": "crabatool",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -190,7 +190,11 @@ function watchEvOutput(conn) {
190
190
  // 如果文件还没有被监控,开始监控
191
191
  if (!monitoringFiles[filePath]) {
192
192
  log('开始监控文件:', filePath, '当前大小:', stats.size, 'bytes');
193
+ // 先标记为监控中,防止短时间内重复触发
194
+ monitoringFiles[filePath] = true;
193
195
  startMonitoringFile(conn, filePath);
196
+ } else {
197
+ log('文件已在监控中,跳过:', filePath);
194
198
  }
195
199
  } else {
196
200
  log('文件创建时间不符合要求,跳过:', filePath);
@@ -208,7 +212,9 @@ function watchEvOutput(conn) {
208
212
 
209
213
  // 监控文件大小变化,判断录制是否真正结束
210
214
  function startMonitoringFile(conn, filePath) {
211
- if (monitoringFiles[filePath]) {
215
+ // 如果已经是一个有效的interval,说明已经在监控中
216
+ if (monitoringFiles[filePath] && monitoringFiles[filePath] !== true) {
217
+ log('文件已在监控中,跳过:', filePath);
212
218
  return;
213
219
  }
214
220
 
@@ -230,6 +236,11 @@ function startMonitoringFile(conn, filePath) {
230
236
  log('开始监控文件:', path.basename(filePath), '类型:', isVideo ? '视频' : (isAudio ? '音频' : '其他'),
231
237
  '检查间隔:', checkInterval + 'ms', '稳定阈值:', stableThreshold + '次');
232
238
 
239
+ // 清除之前的标记,设置为真正的interval
240
+ if (monitoringFiles[filePath] === true) {
241
+ delete monitoringFiles[filePath];
242
+ }
243
+
233
244
  monitoringFiles[filePath] = setInterval(function() {
234
245
  try {
235
246
  var stats = fs.statSync(filePath);