added min tor time, large performance improvement

This commit is contained in:
2022-07-23 15:46:48 -05:00
parent b7a7d54272
commit 3aa5931095
6 changed files with 60 additions and 48 deletions

View File

@@ -9,6 +9,9 @@ def buildtorlist(self):
torrent = self.torrentlist.pop()
if self.use_log:
self.tl.debug(f'["{torrent["name"][0:20]}..."] {torrent["infohash_v1"]}')
if torrent['added_on'] + self.minimum_age <= self.t.time():
self.preme_tor_counter += 1
continue
if torrent['category'] in self.cat_whitelist.values():
self.tl.info(f'Ignored torrent:["{torrent["name"][0:20]}..."]')
continue
@@ -27,36 +30,4 @@ def buildtorlist(self):
self.tl.debug(f'Non-protected torrent: {torrent["tracker"]}hash: {torrent["hash"]}')
if torrent['tags'] == '':
self.qbt_client.torrents_add_tags(self.tracker_non_protected_tag,torrent['hash'])
self.tracker_list.append(torrent)
def writetor(self, filepath='./torrentinfo.txt'):
"""Write all torrent data to a file.
Useful for development of new features.
"""
with open(filepath, 'w') as fp:
fp.write(str(self.torrentlist))
def listfirsttor(self, index=0):
"""Only lists the first torrent"""
self.tl.debug('First torrent in the list:')
torrent = self.torrentlist[index]
for k,v in torrent.items():
self.tl.debug(f'{k}: {v}')
self.tl.debug('\n')
def listqbitapiinfo(self):
"""Writes torrent info to log file"""
self.tl.debug(f'qBittorrent: {self.qbt_client.app.version}')
self.tl.debug(f'qBittorrent Web API: {self.qbt_client.app.web_api_version}')
def torrentcount(self):
"""write torrent counts to log file"""
self.tl.debug(f'torrents that are protected {self.tracker_list.count("ipt")}')
self.tl.debug(f'torrents that aren\'t protected {self.tracker_list.count("public")}')
def tordeletetags(self):
tag_list = [self.tracker_protected_tag, self.tracker_non_protected_tag]
self.qbt_client.torrents_delete_tags(tag_list)
def torlisttags(self):
pass
self.tracker_list.append(torrent)