现在开v刷观众
一台vps1000一天也就1t多,大部分时候速度都只有10mb/s左右
不知道是哪里设置有问题
RSS规则
(torrent) => { // 配置部分:这些部分可以自定义 const config = { downloaderId: '4a63411d', // 下载器ID,指定适用的下载器ID enableLogging: false, // 是否启用日志记录 enableSeedingVolumeLimit: true, // 是否启用保种体积限制 seedingVolumeLimit: 300 * 1024 * 1024 * 1024, // 保种体积限制(单位:字节),例如14GB enableTaskCountLimit: false, // 是否启用下载器任务数量限制 taskCountLimit: 200, // 下载器任务数量限制,设置最大任务数 enableSizeLimit: true, // 是否启用种子大小限制 sizeLimitRange: [0.1 * 1024 * 1024 * 1024, 400 * 1024 * 1024 * 1024], // 种子大小范围(单位:字节) enableFileNameMatchLimit: false, // 是否启用文件名匹配限制 fileNameRegex: /sample|test/i // 文件名正则匹配,支持正则表达式 }; // 获取本地时间字符串 function getLocalTimeString() { return new Date().toLocaleString('zh-CN', { hour12: false }); } // 辅助函数:向 /vertex/log22/log.txt 中追加日志信息 function logFailure(message) { if (!config.enableLogging) return; // 如果未启用日志记录,直接返回 const logFilePath = '/vertex/log22/log.txt'; const logDir = path.dirname(logFilePath); if (!fs.existsSync(logDir)) { fs.mkdirSync(logDir, { recursive: true }); } const now = getLocalTimeString(); fs.appendFileSync(logFilePath, `[${now}] ${message}\n`); } // 获取下载器ID和下载器对象 const downloaderId = config.downloaderId; // 当前下载器ID const client = global.runningClient[downloaderId]; if (!client) { logFailure(`未找到下载器 ${downloaderId}`); return false; } // 2. 保种体积限制:先检查 /vertex/${downloaderId}/size.txt 中存储的时间和累计体积 if (config.enableSeedingVolumeLimit) { const sizeFilePath = `/vertex/${downloaderId}/size.txt`; const sizeDir = path.dirname(sizeFilePath); if (!fs.existsSync(sizeDir)) { fs.mkdirSync(sizeDir, { recursive: true }); } let currentCumulative = 0; // 当前累计体积(字节) let fileTimestamp = 0; // 文件中记录的时间(秒) const now = Math.floor(Date.now() / 1000); // 当前时间,单位:秒 // 尝试读取文件,如果存在则解析内容(格式:timestamp,cumulativeSize) if (fs.existsSync(sizeFilePath)) { try { const data = fs.readFileSync(sizeFilePath, 'utf8').trim(); if (data) { const parts = data.split(','); if (parts.length === 2) { fileTimestamp = Number(parts[0]); currentCumulative = Number(parts[1]); } } } catch (err) { logFailure(`读取 size.txt 失败: ${err}`); } } else { // 如果文件不存在,则计算累计体积并创建文件 client.maindata.torrents.forEach(t => { currentCumulative += Number(t.size || 0); }); fileTimestamp = now; try { fs.writeFileSync(sizeFilePath, `${fileTimestamp},${currentCumulative}`); } catch (err) { logFailure(`写入 size.txt 失败: ${err}`); } } // 如果下载器中没有任务,则重置累计体积为 0 if (!client.maindata.torrents || client.maindata.torrents.length === 0) { currentCumulative = 0; fileTimestamp = now; try { fs.writeFileSync(sizeFilePath, `${fileTimestamp},${currentCumulative}`); } catch (err) { logFailure(`重置 size.txt 失败: ${err}`); } } // 如果文件中的时间超过2分钟,则重新计算累计体积 else if (now - fileTimestamp > 120) { currentCumulative = 0; client.maindata.torrents.forEach(t => { currentCumulative += Number(t.size || 0); }); fileTimestamp = now; try { fs.writeFileSync(sizeFilePath, `${fileTimestamp},${currentCumulative}`); } catch (err) { logFailure(`更新 size.txt 失败: ${err}`); } } // 确保 torrent.size 为数值 const torrentSize = Number(torrent.size); // 将累计体积加上当前种子的大小,与保种体积限制比较 if ((currentCumulative + torrentSize) >= config.seedingVolumeLimit) { logFailure(`保种体积限制不通过:累计体积 ${currentCumulative} + 当前种子 ${torrentSize} 超过限制 ${config.seedingVolumeLimit}`); return false; } } // 3. 下载器任务数量限制:检查下载器当前任务数量 if (config.enableTaskCountLimit) { if (client.maindata.torrents.length >= config.taskCountLimit) { logFailure(`任务数量限制不通过:当前任务数量 ${client.maindata.torrents.length} 超过限制 ${config.taskCountLimit}`); return false; } } // 4. 种子大小限制:检查种子的大小是否在规定范围内 if (config.enableSizeLimit) { const size = Number(torrent.size); if (size < config.sizeLimitRange[0] || size > config.sizeLimitRange[1]) { logFailure(`种子大小限制不通过:种子大小 ${size} 不在范围 ${config.sizeLimitRange[0]} - ${config.sizeLimitRange[1]}`); return false; } } // 5. 文件名匹配限制:检查文件名是否符合正则匹配 if (config.enableFileNameMatchLimit) { const fileName = torrent.name; if (!fileName.match(config.fileNameRegex)) { logFailure(`文件名匹配限制不通过:种子名称 "${fileName}" 未匹配正则 ${config.fileNameRegex}`); return false; } } // 如果所有条件都满足,则表示添加该种子。 // 在返回 true 前,如果启用了保种体积限制,则更新 /vertex/${downloaderId}/size.txt if (config.enableSeedingVolumeLimit) { const sizeFilePath = `/vertex/${downloaderId}/size.txt`; let cumulative = 0; let fileTimestamp = 0; if (fs.existsSync(sizeFilePath)) { try { const data = fs.readFileSync(sizeFilePath, 'utf8').trim(); if (data) { const parts = data.split(','); if (parts.length === 2) { fileTimestamp = Number(parts[0]); cumulative = Number(parts[1]); } } } catch (err) { logFailure(`读取 size.txt 更新部分失败: ${err}`); } } cumulative += Number(torrent.size); try { fs.writeFileSync(sizeFilePath, `${fileTimestamp},${cumulative}`); } catch (err) { logFailure(`更新 size.txt 失败: ${err}`); } } return true;};删种规则
没有其他规则了
评论 (0)