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,
|
||||
proxyPort: this.proxyPort
|
||||
},
|
||||
numThread: 1,
|
||||
downloadMethod: this.biliDownloadMethod,
|
||||
})
|
||||
e.reply(segment.image(xImgPath));
|
||||
}
|
||||
@ -1047,7 +1047,7 @@ export class tools extends plugin {
|
||||
img: item.urlDefault,
|
||||
dir: downloadPath,
|
||||
fileName: `${index}.png`,
|
||||
numThread: 1,
|
||||
downloadMethod: this.biliDownloadMethod,
|
||||
}));
|
||||
}
|
||||
// 等待所有图片下载完成
|
||||
@ -1265,7 +1265,7 @@ export class tools extends plugin {
|
||||
headersExt: {
|
||||
"Referer": "http://blog.sina.com.cn/",
|
||||
},
|
||||
numThread: 1,
|
||||
downloadMethod: this.biliDownloadMethod,
|
||||
}).then(async (filePath) => {
|
||||
// 格式化为消息对象
|
||||
return {
|
||||
|
@ -7,7 +7,7 @@ import fs from "node:fs";
|
||||
import os from "os";
|
||||
import common from "../../../lib/common/common.js";
|
||||
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";
|
||||
|
||||
/**
|
||||
@ -204,7 +204,7 @@ export async function downloadImg({
|
||||
isProxy = false,
|
||||
headersExt = {},
|
||||
proxyInfo = {},
|
||||
numThread = 1,
|
||||
downloadMethod = 0,
|
||||
}) {
|
||||
const downloadImgParams = {
|
||||
img,
|
||||
@ -213,12 +213,11 @@ export async function downloadImg({
|
||||
isProxy,
|
||||
headersExt,
|
||||
proxyInfo,
|
||||
numThread,
|
||||
}
|
||||
logger.info(logger.yellow(`[R插件][图片下载] 当前使用线程数:${ numThread }`));
|
||||
if (numThread === 1) {
|
||||
logger.info(logger.yellow(`[R插件][图片下载] 当前使用的方法:${ BILI_DOWNLOAD_METHOD[downloadMethod].label }`));
|
||||
if (downloadMethod === 0) {
|
||||
return normalDownloadImg(downloadImgParams);
|
||||
} else if (numThread > 1) {
|
||||
} else if (downloadMethod === 1) {
|
||||
return downloadImgWithAria2(downloadImgParams);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user