updated the buildtorlist function to read all values in tracker-whitelist.json #8

Merged
jonbranan merged 1 commits from unlimited_trackers into main 2022-07-22 22:04:36 -05:00
3 changed files with 15 additions and 22 deletions
Showing only changes of commit 582211adb7 - Show all commits

View File

@ -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()

View File

@ -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}")
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)

View File

@ -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"]})')