diff --git a/app/common/Client.js b/app/common/Client.js index 031896c9..f16604e4 100644 --- a/app/common/Client.js +++ b/app/common/Client.js @@ -322,11 +322,11 @@ class Client { } }; - async addTorrent (torrentUrl, hash, isSkipChecking = false, uploadLimit = 0, downloadLimit = 0, savePath, category, autoTMM, paused) { + async addTorrent (link,torrentUrl, hash, isSkipChecking = false, uploadLimit = 0, downloadLimit = 0, savePath, category, autoTMM, paused) { if (!this.status) { throw new Error('客户端' + this.alias + '当前状态为不可用'); } - const { statusCode } = await this.client.addTorrent(this.clientUrl, this.cookie, torrentUrl, isSkipChecking, uploadLimit, downloadLimit, savePath, category, autoTMM, this.firstLastPiecePrio, paused); + const { statusCode } = await this.client.addTorrent(link,this.clientUrl, this.cookie, torrentUrl, isSkipChecking, uploadLimit, downloadLimit, savePath, category, autoTMM, this.firstLastPiecePrio, paused); if (statusCode !== 200) { this.login(); throw new Error('状态码: ' + statusCode); @@ -370,6 +370,7 @@ class Client { async deleteTorrent (torrent, rule) { let isDeleteFiles = true; + let isSendNTF = true; try { for (const _torrent of this.maindata.torrents) { if (_torrent.name === torrent.name && _torrent.size === torrent.size && _torrent.hash !== torrent.hash && _torrent.savePath === torrent.savePath) { @@ -388,8 +389,13 @@ class Client { } else { await this.client.deleteTorrent(this.clientUrl, this.cookie, torrent.hash, isDeleteFiles); } - logger.info('下载器', this.alias, '删除种子成功:', torrent.name, rule.alias); - await this.ntf.deleteTorrent(this._client, torrent, rule, isDeleteFiles); + logger.info('下载器', this.alias, '删除种子成功:', torrent.name, rule.alias); + if (rule.doNotSendNotify){ + isSendNTF = false; + } + if (isSendNTF){ + await this.ntf.deleteTorrent(this._client, torrent, rule, isDeleteFiles); + } } catch (error) { logger.error('下载器', this.alias, '删除种子失败:', torrent.name, '\n', error); await this.ntf.deleteTorrentError(this._client, torrent, rule); diff --git a/app/common/Rss.js b/app/common/Rss.js index 26e83d3c..34691a70 100644 --- a/app/common/Rss.js +++ b/app/common/Rss.js @@ -212,7 +212,7 @@ class Rss { if (_torrent.name === bencodeInfo.name && _torrent.hash !== bencodeInfo.hash) { try { this.addCount += 1; - await client.addTorrent(torrent.url, torrent.hash, true, this.uploadLimit, this.downloadLimit, _torrent.savePath, this.category); + await client.addTorrent(torrent.link,torrent.url, torrent.hash, true, this.uploadLimit, this.downloadLimit, _torrent.savePath, this.category); await util.runRecord('INSERT INTO torrents (hash, name, size, rss_id, category, link, record_time, add_time, record_type, record_note) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', [torrent.hash, torrent.name, torrent.size, this.id, this.category, torrent.link, moment().unix(), moment().unix(), 1, '辅种']); await this.ntf.addTorrent(this._rss, client, torrent); @@ -347,7 +347,7 @@ class Rss { const { filepath, hash } = await this._downloadTorrent(torrent.url, torrent.hash); await client.addTorrentByTorrentFile(filepath, hash, false, this.uploadLimit, this.downloadLimit, savePath, category, this.autoTMM, this.paused); } else { - await client.addTorrent(torrent.url, torrent.hash, false, this.uploadLimit, this.downloadLimit, savePath, category, this.autoTMM, this.paused); + await client.addTorrent(torrent.link,torrent.url, torrent.hash, false, this.uploadLimit, this.downloadLimit, savePath, category, this.autoTMM, this.paused); } try { await this.ntf.addTorrent(this._rss, client, torrent); diff --git a/app/libs/client/de.js b/app/libs/client/de.js index e351fe9a..6def84d7 100644 --- a/app/libs/client/de.js +++ b/app/libs/client/de.js @@ -18,7 +18,7 @@ exports.login = async function (username, clientUrl, password) { return res.headers['set-cookie'][0].substring(0, res.headers['set-cookie'][0].indexOf(';')); }; -exports.addTorrent = async function (clientUrl, cookie, torrentUrl, isSkipChecking, uploadLimit, downloadLimit, savePath, label) { +exports.addTorrent = async function (link,clientUrl, cookie, torrentUrl, isSkipChecking, uploadLimit, downloadLimit, savePath, label) { let message = { method: 'POST', url: clientUrl + '/json', diff --git a/app/libs/client/qb.js b/app/libs/client/qb.js index b1df5432..3d1696dd 100644 --- a/app/libs/client/qb.js +++ b/app/libs/client/qb.js @@ -24,7 +24,7 @@ exports.login = async function (username, clientUrl, password) { } }; -exports.addTorrent = async function (clientUrl, cookie, torrentUrl, isSkipChecking, uploadLimit, downloadLimit, savePath, category, autoTMM, firstLastPiecePrio, paused) { +exports.addTorrent = async function (link,clientUrl, cookie, torrentUrl, isSkipChecking, uploadLimit, downloadLimit, savePath, category, autoTMM, firstLastPiecePrio, paused) { const message = { url: clientUrl + '/api/v2/torrents/add', method: 'POST', @@ -49,6 +49,9 @@ exports.addTorrent = async function (clientUrl, cookie, torrentUrl, isSkipChecki if (autoTMM) { message.formData.autoTMM = '' + autoTMM; } + if (paused) { + message.formData.tags = link; + } const res = await util.requestPromise(message); logger.debug(clientUrl, '添加种子', torrentUrl, '\n返回信息', { body: res.body, statusCode: res.statusCode }); return res; diff --git a/app/libs/client/tr.js b/app/libs/client/tr.js index 776bf458..30c503a1 100644 --- a/app/libs/client/tr.js +++ b/app/libs/client/tr.js @@ -22,7 +22,7 @@ exports.login = async function (username, clientUrl, password) { }; }; -exports.addTorrentByTorrentFile = async function (clientUrl, cookie, filepath, isSkipChecking, uploadLimit, downloadLimit, savePath, category, autoTMM) { +exports.addTorrentByTorrentFile = async function (link,clientUrl, cookie, filepath, isSkipChecking, uploadLimit, downloadLimit, savePath, category, autoTMM) { const message = { method: 'POST', url: clientUrl + '/transmission/rpc',