2022-07-14 19:03:06 -05:00
|
|
|
def torprocessor(self):
|
2022-07-20 11:34:13 -05:00
|
|
|
"""Main logic to sort through both self.tracker_nonprotected_list and self.tracker_protected_list
|
|
|
|
If torrent meets criteria for deletion, its infohash_v1 will be appended to self.torrent_hash_delete_list
|
|
|
|
"""
|
2022-07-23 14:59:43 -05:00
|
|
|
for canidate in self.tracker_list:
|
2022-07-14 19:03:06 -05:00
|
|
|
if canidate['state'] == 'downloading':
|
2022-07-20 11:06:11 -05:00
|
|
|
if self.use_log:
|
2022-07-22 14:47:36 -05:00
|
|
|
self.tl.info(f'["{canidate["name"][0:20]}..."] is still downloading and will be skipped.')
|
2022-07-22 17:24:27 -05:00
|
|
|
continue
|
2022-07-23 14:59:43 -05:00
|
|
|
elif canidate['ratio'] < float(1.05) and self.tracker_protected_tag in canidate["tags"]:
|
2022-07-20 11:06:11 -05:00
|
|
|
if self.use_log:
|
2022-07-22 14:47:36 -05:00
|
|
|
self.tl.debug(f'["{canidate["name"][0:20]}..."] is below a 1.05 ratio({canidate["ratio"]})')
|
2022-07-23 15:46:48 -05:00
|
|
|
if canidate['added_on'] + self.age <= self.t.time():
|
2022-07-20 11:06:11 -05:00
|
|
|
if self.use_log:
|
2022-07-23 15:46:48 -05:00
|
|
|
self.tl.debug(f'["{canidate["name"][0:20]}..."] Seconds old: {self.t.time() - self.age - canidate["added_on"]}')
|
2022-07-14 19:03:06 -05:00
|
|
|
self.torrent_hash_delete_list.append(canidate['infohash_v1'])
|
2022-07-20 11:06:11 -05:00
|
|
|
if self.use_log:
|
2022-07-22 14:47:36 -05:00
|
|
|
self.tl.info(f'Submitted ["{canidate["name"][0:20]}..."] for deletion from the protected list.')
|
2022-07-23 14:59:43 -05:00
|
|
|
elif canidate['ratio'] >= float(1.05) and self.tracker_protected_tag in canidate["tags"]:
|
2022-07-20 11:06:11 -05:00
|
|
|
if self.use_log:
|
2022-07-22 14:47:36 -05:00
|
|
|
self.tl.debug(f'["{canidate["name"][0:20]}..."] is above a 1.05 ratio({canidate["ratio"]}).')
|
2022-07-14 19:03:06 -05:00
|
|
|
self.torrent_hash_delete_list.append(canidate['infohash_v1'])
|
2022-07-20 11:06:11 -05:00
|
|
|
if self.use_log:
|
2022-07-22 14:47:36 -05:00
|
|
|
self.tl.info(f'Submitted ["{canidate["name"][0:20]}..."] for deletion from the protected list.')
|
2022-07-23 14:59:43 -05:00
|
|
|
elif self.tracker_non_protected_tag in canidate["tags"]:
|
|
|
|
self.torrent_hash_delete_list.append(canidate['infohash_v1'])
|
|
|
|
if self.use_log:
|
|
|
|
self.tl.info(f'Submitted ["{canidate["name"][0:20]}..."] for deletion.')
|
2022-07-14 19:03:06 -05:00
|
|
|
else:
|
2022-07-23 14:59:43 -05:00
|
|
|
self.tl.info(f'["{canidate["name"][0:20]}..."] is orphaned.')
|
|
|
|
self.up_tor_counter += 1
|
|
|
|
continue
|
2022-07-14 19:03:06 -05:00
|
|
|
|
2022-07-23 15:46:48 -05:00
|
|
|
def tordeletetags(self):
|
|
|
|
tag_list = [self.tracker_protected_tag, self.tracker_non_protected_tag]
|
|
|
|
self.qbt_client.torrents_delete_tags(tag_list)
|
2022-07-14 19:03:06 -05:00
|
|
|
|
|
|
|
def tordelete(self):
|
2022-07-20 11:34:13 -05:00
|
|
|
"""Remove torrents, will also delete files, this keeps the filesystem clean.
|
|
|
|
Only pass self.torrent_hash_delete_list if you would like to keep the files."""
|
2022-07-20 11:06:11 -05:00
|
|
|
if self.use_log:
|
|
|
|
self.tl.debug('Hash list submitted for deletion:')
|
2022-07-20 11:34:13 -05:00
|
|
|
self.tl.debug(self.torrent_hash_delete_list)
|
2022-07-14 19:03:06 -05:00
|
|
|
self.qbt_client.torrents_delete(True, self.torrent_hash_delete_list)
|