mirror of
https://github.com/Jerryplusy/rc-plugin.git
synced 2025-10-14 16:19:18 +00:00
🪛 chore: 更新部分逻辑
This commit is contained in:
parent
72ca706f14
commit
7609e303b2
@ -937,7 +937,7 @@ export class tools extends plugin {
|
|||||||
proxyAddr: this.proxyAddr,
|
proxyAddr: this.proxyAddr,
|
||||||
proxyPort: this.proxyPort
|
proxyPort: this.proxyPort
|
||||||
},
|
},
|
||||||
numThread: 1,
|
downloadMethod: this.biliDownloadMethod,
|
||||||
})
|
})
|
||||||
e.reply(segment.image(xImgPath));
|
e.reply(segment.image(xImgPath));
|
||||||
}
|
}
|
||||||
@ -1047,7 +1047,7 @@ export class tools extends plugin {
|
|||||||
img: item.urlDefault,
|
img: item.urlDefault,
|
||||||
dir: downloadPath,
|
dir: downloadPath,
|
||||||
fileName: `${index}.png`,
|
fileName: `${index}.png`,
|
||||||
numThread: 1,
|
downloadMethod: this.biliDownloadMethod,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
// 等待所有图片下载完成
|
// 等待所有图片下载完成
|
||||||
@ -1265,7 +1265,7 @@ export class tools extends plugin {
|
|||||||
headersExt: {
|
headersExt: {
|
||||||
"Referer": "http://blog.sina.com.cn/",
|
"Referer": "http://blog.sina.com.cn/",
|
||||||
},
|
},
|
||||||
numThread: 1,
|
downloadMethod: this.biliDownloadMethod,
|
||||||
}).then(async (filePath) => {
|
}).then(async (filePath) => {
|
||||||
// 格式化为消息对象
|
// 格式化为消息对象
|
||||||
return {
|
return {
|
||||||
|
@ -7,7 +7,7 @@ import fs from "node:fs";
|
|||||||
import os from "os";
|
import os from "os";
|
||||||
import common from "../../../lib/common/common.js";
|
import common from "../../../lib/common/common.js";
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import { COMMON_USER_AGENT, TEN_THOUSAND } from "../constants/constant.js";
|
import { BILI_DOWNLOAD_METHOD, COMMON_USER_AGENT, TEN_THOUSAND } from "../constants/constant.js";
|
||||||
import { mkdirIfNotExists } from "./file.js";
|
import { mkdirIfNotExists } from "./file.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -204,7 +204,7 @@ export async function downloadImg({
|
|||||||
isProxy = false,
|
isProxy = false,
|
||||||
headersExt = {},
|
headersExt = {},
|
||||||
proxyInfo = {},
|
proxyInfo = {},
|
||||||
numThread = 1,
|
downloadMethod = 0,
|
||||||
}) {
|
}) {
|
||||||
const downloadImgParams = {
|
const downloadImgParams = {
|
||||||
img,
|
img,
|
||||||
@ -213,12 +213,11 @@ export async function downloadImg({
|
|||||||
isProxy,
|
isProxy,
|
||||||
headersExt,
|
headersExt,
|
||||||
proxyInfo,
|
proxyInfo,
|
||||||
numThread,
|
|
||||||
}
|
}
|
||||||
logger.info(logger.yellow(`[R插件][图片下载] 当前使用线程数:${ numThread }`));
|
logger.info(logger.yellow(`[R插件][图片下载] 当前使用的方法:${ BILI_DOWNLOAD_METHOD[downloadMethod].label }`));
|
||||||
if (numThread === 1) {
|
if (downloadMethod === 0) {
|
||||||
return normalDownloadImg(downloadImgParams);
|
return normalDownloadImg(downloadImgParams);
|
||||||
} else if (numThread > 1) {
|
} else if (downloadMethod === 1) {
|
||||||
return downloadImgWithAria2(downloadImgParams);
|
return downloadImgWithAria2(downloadImgParams);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user