From 29bb9dd882e4f67c6efc9e5abf490b913fcb9572 Mon Sep 17 00:00:00 2001 From: Jafner Date: Fri, 27 Jan 2023 22:53:52 -0800 Subject: [PATCH] Add python script to find and delete unregistered torrents in Qbittorrent --- server/scripts/remove_trumped_torrents.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 server/scripts/remove_trumped_torrents.py diff --git a/server/scripts/remove_trumped_torrents.py b/server/scripts/remove_trumped_torrents.py new file mode 100755 index 0000000..177607e --- /dev/null +++ b/server/scripts/remove_trumped_torrents.py @@ -0,0 +1,14 @@ +host = input("Enter host (e.g. 'localhost:8080'): ") +username = input("Enter username: ") +password = input("Enter password: ") + +from qbittorrentapi import Client +client = Client(host=host, username=username, password=password) + +torrent_list = client.torrents.info() + +for torrent in torrent_list: + for status in torrent.trackers: + if 'Unregistered torrent' in status.msg: + print(torrent.name,' ',status.msg) + torrent.delete(hash=(torrent.hash),delete_files=True)