tools_batch_files 1.0.30 → 1.0.31

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": "tools_batch_files",
3
- "version": "1.0.30",
3
+ "version": "1.0.31",
4
4
  "description": "批处理视频工具",
5
5
  "keywords": [
6
6
  "utils",
@@ -34,8 +34,10 @@
34
34
  "files": [
35
35
  "index.js",
36
36
  "imgs",
37
+ "vocal_print",
37
38
  "点我批量上传视频.bat",
38
39
  "点我批量上传图片.bat",
40
+ "点我批量上传音频.bat",
39
41
  "package.json",
40
42
  "package-lock.json",
41
43
  "utils",
@@ -1,11 +1,12 @@
1
- const generateUniqueHash = require("../utils/index");
2
- const { disposeError, readExcel, logger } = require("../utils/logger");
1
+ #!/usr/bin/env node
2
+ const generateUniqueHash = require("../../utils/index");
3
+ const { disposeError, readExcel, logger } = require("../../utils/logger");
3
4
 
4
5
  const {
5
6
  findFileInDir,
6
7
  logFileSize,
7
8
  ensureDirSync,
8
- } = require("../utils/settleFiles");
9
+ } = require("../../utils/settleFiles");
9
10
  const ffmpeg = require("fluent-ffmpeg");
10
11
  const fs = require("fs");
11
12
  const path = require("path");
@@ -15,7 +16,7 @@ const axios = require("axios");
15
16
  const FormData = require("form-data");
16
17
 
17
18
  //并发数量
18
- const queueCount = 1;
19
+ const queueCount = 10;
19
20
 
20
21
  //起始任务下标
21
22
  let taskIndex = 0;
@@ -39,12 +40,12 @@ const watermarkAudioPath = path.join(__dirname, "..", "vocal_print", "mz.mp3");
39
40
  const longWatermarkAudioPath = path.join(
40
41
  __dirname,
41
42
  "..",
43
+ "..",
42
44
  "vocal_print",
43
45
  "800a.mp3"
44
46
  );
45
47
 
46
48
  const maxRetries = 1; // 最大重试次数
47
- let retryCount = 0; // 当前重试次数
48
49
 
49
50
  /**
50
51
  * 声纹
@@ -259,9 +260,9 @@ const postData = (dataParams, indexFilePath) => {
259
260
 
260
261
  logger("等待接口返回结果……");
261
262
 
262
- // return axios.post("http://127.0.0.1:9999/upload/photo", formData, {
263
263
  // return axios.post("http://192.168.102.61:9999/upload/sound", formData, {
264
- return axios.post("http://192.168.101.149:9999/upload/sound", formData, {
264
+ // return axios.post("http://192.168.101.149:9999/upload/sound", formData, {
265
+ return axios.post("http://127.0.0.1:9999/upload/sound", formData, {
265
266
  headers: {
266
267
  "Content-Type": "multipart/form-data",
267
268
  },
@@ -272,7 +273,9 @@ const postData = (dataParams, indexFilePath) => {
272
273
  /**
273
274
  * 接口重试机制
274
275
  */
275
- async function postDataWithRetry(dataParams, indexFilePath) {
276
+ async function postDataWithRetry(dataParams, indexFilePath, index) {
277
+ let retryCount = 0; // 当前重试次数
278
+
276
279
  while (retryCount < maxRetries) {
277
280
  try {
278
281
  const resData = await postData(dataParams, indexFilePath);
@@ -375,7 +378,7 @@ const task = async (row, index) => {
375
378
  logger(`-------------------${new Date()}------------------`);
376
379
 
377
380
  // 重试机制
378
- await postDataWithRetry(dataParams, indexFilePath);
381
+ await postDataWithRetry(dataParams, indexFilePath, index);
379
382
 
380
383
  logger(
381
384
  `----------------------------------------第${index}条结束---------------------------------end`
Binary file
Binary file
Binary file