tools_batch_files 1.0.39 → 1.0.40
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 +1 -1
- package/src/videoFn/videoBatch.js +33 -19
- package/utils/logger.js +40 -3
package/package.json
CHANGED
@@ -337,7 +337,16 @@ const archiveZip = (fileName, inputPath, originFilePath) => {
|
|
337
337
|
const getMetadata = async (
|
338
338
|
indexFilePath,
|
339
339
|
originFilePath,
|
340
|
-
{
|
340
|
+
{
|
341
|
+
title,
|
342
|
+
keyword,
|
343
|
+
anotherId,
|
344
|
+
category_id,
|
345
|
+
demand_kind,
|
346
|
+
tag_id,
|
347
|
+
userid,
|
348
|
+
username,
|
349
|
+
}
|
341
350
|
) => {
|
342
351
|
//第一张截图
|
343
352
|
const photoInputPath = path.join(
|
@@ -349,8 +358,8 @@ const getMetadata = async (
|
|
349
358
|
const videoMetadataComand = ffmpeg(originFilePath);
|
350
359
|
const photoMetadataComand = ffmpeg(photoInputPath);
|
351
360
|
const metaDataParams = {
|
352
|
-
userid
|
353
|
-
username
|
361
|
+
userid,
|
362
|
+
username,
|
354
363
|
pixel_width: "",
|
355
364
|
pixel_height: "",
|
356
365
|
size: "",
|
@@ -360,11 +369,11 @@ const getMetadata = async (
|
|
360
369
|
keyword,
|
361
370
|
pr: 0,
|
362
371
|
format: "mp4",
|
363
|
-
category_id
|
364
|
-
demand_kind
|
365
|
-
source_from
|
372
|
+
category_id,
|
373
|
+
demand_kind,
|
374
|
+
source_from,
|
366
375
|
plate_id: 5,
|
367
|
-
tag_id
|
376
|
+
tag_id,
|
368
377
|
is_government: 0,
|
369
378
|
preview_width: "",
|
370
379
|
preview_height: "",
|
@@ -479,15 +488,20 @@ async function postDataWithRetry(
|
|
479
488
|
* 任务
|
480
489
|
*/
|
481
490
|
const task = async (row, index, hash, type) => {
|
491
|
+
logger("88888888888888888888888888row8888888888888888888888");
|
492
|
+
const copyRow = { ...row };
|
493
|
+
logger(copyRow);
|
494
|
+
|
482
495
|
//index文件夹 output/0
|
483
496
|
const indexFilePath = path.join(workDir, "output", index + "");
|
484
|
-
let fileName = row.fileName;
|
485
497
|
const rowFileName = row.fileName;
|
486
|
-
|
487
|
-
|
488
|
-
const
|
489
|
-
const
|
490
|
-
const
|
498
|
+
|
499
|
+
let fileName = row.fileName;
|
500
|
+
// const title = row.title;
|
501
|
+
// const keyword = row.keyword;
|
502
|
+
// const category_id = row.category_id;
|
503
|
+
// const demand_kind = row.demand_kind;
|
504
|
+
// const tag_id = row.tag_id;
|
491
505
|
|
492
506
|
/**
|
493
507
|
* 唯一标识符id,仅错误excel中有 anotherI d 列
|
@@ -536,12 +550,8 @@ const task = async (row, index, hash, type) => {
|
|
536
550
|
await archiveZip(fileName, indexFilePath, originFilePath);
|
537
551
|
|
538
552
|
const dataParams = await getMetadata(indexFilePath, originFilePath, {
|
539
|
-
title,
|
540
|
-
keyword,
|
541
553
|
anotherId,
|
542
|
-
|
543
|
-
demand_kind,
|
544
|
-
tag_id,
|
554
|
+
...copyRow,
|
545
555
|
});
|
546
556
|
|
547
557
|
// 重试机制
|
@@ -565,7 +575,11 @@ const task = async (row, index, hash, type) => {
|
|
565
575
|
logger("视频任务失败(最外层catch):" + error);
|
566
576
|
}
|
567
577
|
removeDirectory(indexFilePath);
|
568
|
-
disposeError(hash, {
|
578
|
+
disposeError(hash, {
|
579
|
+
fileName,
|
580
|
+
anotherId,
|
581
|
+
...copyRow,
|
582
|
+
});
|
569
583
|
}
|
570
584
|
};
|
571
585
|
|
package/utils/logger.js
CHANGED
@@ -29,9 +29,35 @@ const successLogger = (hash, index, fileName, type = "") => {
|
|
29
29
|
};
|
30
30
|
|
31
31
|
//错误日志- xlsx
|
32
|
-
const disposeError = (
|
32
|
+
const disposeError = (
|
33
|
+
hash,
|
34
|
+
{
|
35
|
+
fileName,
|
36
|
+
keyword,
|
37
|
+
title,
|
38
|
+
anotherId,
|
39
|
+
category_id,
|
40
|
+
demand_kind,
|
41
|
+
tag_id,
|
42
|
+
userid,
|
43
|
+
username,
|
44
|
+
}
|
45
|
+
) => {
|
33
46
|
// 构建 Excel 数据
|
34
|
-
const data = [
|
47
|
+
const data = [
|
48
|
+
[
|
49
|
+
fileName,
|
50
|
+
keyword,
|
51
|
+
title,
|
52
|
+
anotherId,
|
53
|
+
category_id,
|
54
|
+
demand_kind,
|
55
|
+
tag_id,
|
56
|
+
userid,
|
57
|
+
username,
|
58
|
+
source_from
|
59
|
+
],
|
60
|
+
]; // 不包含表头
|
35
61
|
|
36
62
|
// 读取已存在的 Excel 文件
|
37
63
|
let existingData = [];
|
@@ -45,7 +71,18 @@ const disposeError = (hash, { fileName, keyword, title, anotherId }) => {
|
|
45
71
|
} catch (error) {
|
46
72
|
logger("No existing file found, creating new one.");
|
47
73
|
// 如果文件不存在,添加表头
|
48
|
-
existingData.push([
|
74
|
+
existingData.push([
|
75
|
+
"fileName",
|
76
|
+
"keyword",
|
77
|
+
"title",
|
78
|
+
"anotherId",
|
79
|
+
"category_id",
|
80
|
+
"demand_kind",
|
81
|
+
"tag_id",
|
82
|
+
"userid",
|
83
|
+
"username",
|
84
|
+
"source_from"
|
85
|
+
]);
|
49
86
|
}
|
50
87
|
|
51
88
|
// 合并已有数据和新数据
|