-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqb.py
31 lines (28 loc) · 921 Bytes
/
qb.py
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
import qbittorrentapi
conn_info = dict(
host="https://qbittorrent.com",
port=8080,
username="admin",
password="adminadmin"
)
# 获取所有的种子
qb = qbittorrentapi.Client(**conn_info)
torrents = qb.torrents.info()
# 尝试判断辅种
file_sizes = {}
for torrent in torrents:
file_size = torrent.size
if file_size in file_sizes:
file_sizes[file_size].append(torrent)
else:
file_sizes[file_size] = [torrent]
for torrent in torrents:
for tracker in torrent.trackers:
if "sharkpt" in tracker.url or "leaguehd" in tracker.url:
x = file_sizes.get(torrent.size)
if len(x) > 1:
print("不完全删除\t" + torrent.name)
qb.torrents.delete(torrent_hashes=torrent.hash, delete_files=False)
else:
# 没有辅种的,手动处理
print("完全删除\t" + torrent.name)