tools_batch_files 1.0.10 → 1.0.12
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/index.js +17 -14
- package/package.json +1 -1
package/index.js
CHANGED
@@ -331,8 +331,7 @@ const watermarkScreenshots = (indexFilePath) => {
|
|
331
331
|
/**
|
332
332
|
* 打包物料
|
333
333
|
*/
|
334
|
-
const archiveZip = (fileName, inputPath) => {
|
335
|
-
const sourceVideoPath = path.join(workDir, "video", fileName);
|
334
|
+
const archiveZip = (fileName, inputPath, originFilePath) => {
|
336
335
|
const zipDir = path.join(inputPath, "zip");
|
337
336
|
const timestamp = new Date().getTime();
|
338
337
|
|
@@ -387,7 +386,7 @@ const archiveZip = (fileName, inputPath) => {
|
|
387
386
|
archive.directory(dirPath, dir);
|
388
387
|
});
|
389
388
|
|
390
|
-
archive.file(
|
389
|
+
archive.file(originFilePath, {
|
391
390
|
name: path.join(SOURCE_VIDEO_DIR, fileName),
|
392
391
|
});
|
393
392
|
// 完成归档
|
@@ -401,9 +400,9 @@ const archiveZip = (fileName, inputPath) => {
|
|
401
400
|
const getMetadata = async (
|
402
401
|
fileName,
|
403
402
|
indexFilePath,
|
403
|
+
originFilePath,
|
404
404
|
{ rowFileName, title, keyword }
|
405
405
|
) => {
|
406
|
-
const inputFilePath = path.join(workDir, "video", fileName);
|
407
406
|
//第一张截图
|
408
407
|
const photoInputPath = path.join(
|
409
408
|
indexFilePath,
|
@@ -411,7 +410,7 @@ const getMetadata = async (
|
|
411
410
|
"screenshots-1.png"
|
412
411
|
);
|
413
412
|
|
414
|
-
const videoMetadataComand = ffmpeg(
|
413
|
+
const videoMetadataComand = ffmpeg(originFilePath);
|
415
414
|
const photoMetadataComand = ffmpeg(photoInputPath);
|
416
415
|
const metaDataParams = {
|
417
416
|
userid: 1003,
|
@@ -516,8 +515,8 @@ const task = async (row, index) => {
|
|
516
515
|
path.join(workDir, ORIGIN_FILE_DIR),
|
517
516
|
fileName
|
518
517
|
);
|
519
|
-
|
520
|
-
|
518
|
+
logger("源视频文件路径");
|
519
|
+
logger(originFilePath);
|
521
520
|
|
522
521
|
//index文件夹 output/0
|
523
522
|
const indexFilePath = path.join(workDir, "output", index + "");
|
@@ -530,12 +529,17 @@ const task = async (row, index) => {
|
|
530
529
|
await get5Screenshots(fileName, indexFilePath, originFilePath);
|
531
530
|
await watermarkVideo(fileName, indexFilePath);
|
532
531
|
await watermarkScreenshots(indexFilePath);
|
533
|
-
await archiveZip(fileName, indexFilePath);
|
534
|
-
const dataParams = await getMetadata(
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
532
|
+
await archiveZip(fileName, indexFilePath, originFilePath);
|
533
|
+
const dataParams = await getMetadata(
|
534
|
+
fileName,
|
535
|
+
indexFilePath,
|
536
|
+
originFilePath,
|
537
|
+
{
|
538
|
+
rowFileName,
|
539
|
+
title,
|
540
|
+
keyword,
|
541
|
+
}
|
542
|
+
);
|
539
543
|
console.log("dataParams参数");
|
540
544
|
console.log(dataParams);
|
541
545
|
|
@@ -544,7 +548,6 @@ const task = async (row, index) => {
|
|
544
548
|
logger(
|
545
549
|
`----------------------------------------第${index}条结束---------------------------------end`
|
546
550
|
);
|
547
|
-
|
548
551
|
} catch (error) {
|
549
552
|
// 可以约定code,来表示不同的错误信息
|
550
553
|
if (error.code === "ENOENT") {
|