-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathapp.js
More file actions
33 lines (26 loc) · 903 Bytes
/
app.js
File metadata and controls
33 lines (26 loc) · 903 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
const qbittorrent = require('./services/qbittorrent');
let qb = new qbittorrent('https://bt.xiaolin.in','xxx');
setInterval(() => {
qb.getTorrentList().then((res) => {
//console.log(res.body);
let data = JSON.parse(res.body);
if (!data)
return;
data.forEach((item) => {
console.log('');
console.log(item.hash);
console.log(item.name);
console.log(item.progress);
console.log(item.ratio);
console.log(item.state);
if (item.state !== 'downloading' && item.state !== 'pausedUP' && item.progress === 1 && item.ratio >= 0.35)
{
qb.pauseTorrent(item.hash).then(() => {});
}
});
})
},2000);
qb.addTorrentLink('https://xxx.torrent').then((res) => {
console.log(res.body);
console.log(res.statusCode);
});