From 582211adb7e5e3764557a09f4081ed01d3aed34c Mon Sep 17 00:00:00 2001 From: jblu Date: Fri, 22 Jul 2022 17:24:27 -0500 Subject: [PATCH] a --- qbit-maid.py | 5 +++-- qlist.py | 26 +++++++++----------------- qprocess.py | 6 +++--- 3 files changed, 15 insertions(+), 22 deletions(-) diff --git a/qbit-maid.py b/qbit-maid.py index 8f6e9de..84cdefb 100644 --- a/qbit-maid.py +++ b/qbit-maid.py @@ -61,6 +61,7 @@ class Qbt: listqbitapiinfo(self) listfirsttor(self) buildtorlist(self) + #tordeletetags(self) if self.use_log: torrentcount(self) torprocessor(self) @@ -68,8 +69,8 @@ class Qbt: printprocessor(self) if self.use_pushover: tornotifysummary(self) - tordelete(self) - + #tordelete(self) + # Run if __name__== "__main__": Qbt() \ No newline at end of file diff --git a/qlist.py b/qlist.py index 80c36f7..3bd0f98 100644 --- a/qlist.py +++ b/qlist.py @@ -11,30 +11,18 @@ def buildtorlist(self): if self.use_log: self.tl.debug(f'["{torrent["name"][0:20]}..."] {torrent["infohash_v1"]}') if torrent['category'] == 'tech': - break + continue if torrent['tracker'] == '': if self.use_log: self.tl.warning(f'Torrent doesn\'t have a tracker ["{torrent["name"][0:20]}..."] [{torrent["tracker"]}]hash: {torrent["hash"]}') - break - if self.tracker_whitelist['iptorrents-empirehost'] in torrent['tracker']: + continue + if torrent['tracker'].split('/')[2] in self.tracker_whitelist.values(): if self.use_log: self.tl.debug(f'Protected torrent: {torrent["tracker"]}hash: {torrent["hash"]}') self.protected_count += 1 self.qbt_client.torrents_add_tags(self.tracker_protected_tag,torrent['hash']) self.tracker_protected_list.append(torrent) - elif self.tracker_whitelist["iptorrents-stackoverflow"] in torrent['tracker']: - if self.use_log: - self.tl.debug(f'Protected torrent: {torrent["tracker"]}hash: {torrent["hash"]}') - self.protected_count += 1 - self.qbt_client.torrents_add_tags(self.tracker_protected_tag,torrent['hash']) - self.tracker_protected_list.append(torrent) - elif self.tracker_whitelist["iptorrents-bgp"] in torrent['tracker']: - if self.use_log: - self.tl.debug(f'Protected torrent: {torrent["tracker"]}hash: {torrent["hash"]}') - self.protected_count += 1 - self.qbt_client.torrents_add_tags(self.tracker_protected_tag,torrent['hash']) - self.tracker_protected_list.append(torrent) - else: + elif torrent['tracker'].split('/')[2] not in self.tracker_whitelist.values(): if self.use_log: self.tl.debug(f'Non-protected torrent: {torrent["tracker"]}hash: {torrent["hash"]}') self.nonprotected_count += 1 @@ -64,4 +52,8 @@ def listqbitapiinfo(self): def torrentcount(self): """write torrent counts to log file""" self.tl.debug(f'torrents that are protected {self.protected_count}') - self.tl.debug(f"torrents that aren't protected {self.nonprotected_count}") \ No newline at end of file + self.tl.debug(f"torrents that aren't protected {self.nonprotected_count}") + +def tordeletetags(self): + tag_list = ['ipt','public','iptorrents'] + self.qbt_client.torrents_delete_tags(tag_list) \ No newline at end of file diff --git a/qprocess.py b/qprocess.py index 76944fa..1f629f2 100644 --- a/qprocess.py +++ b/qprocess.py @@ -6,11 +6,11 @@ def torprocessor(self): if 'ipt' in canidate['tags']: if self.use_log: self.tl.warning(f'["{canidate["name"][0:20]}..."] was in non-protected list.') - break + continue if canidate['state'] == 'downloading': if self.use_log: self.tl.info(f'["{canidate["name"][0:20]}..."] is still downloading and will be skipped.') - break + continue else: self.torrent_hash_delete_list.append(canidate['infohash_v1']) if self.use_log: @@ -19,7 +19,7 @@ def torprocessor(self): if canidate['state'] == 'downloading': if self.use_log: self.tl.warning(f'["{canidate["name"][0:20]}..."] is still downloading and will be skipped.') - break + continue if canidate['ratio'] < float(1.05): if self.use_log: self.tl.debug(f'["{canidate["name"][0:20]}..."] is below a 1.05 ratio({canidate["ratio"]})') -- 2.45.2