This commit is contained in:
jblu 2022-07-22 17:24:27 -05:00
parent 1519d064be
commit 582211adb7
3 changed files with 15 additions and 22 deletions

View File

@ -61,6 +61,7 @@ class Qbt:
listqbitapiinfo(self) listqbitapiinfo(self)
listfirsttor(self) listfirsttor(self)
buildtorlist(self) buildtorlist(self)
#tordeletetags(self)
if self.use_log: if self.use_log:
torrentcount(self) torrentcount(self)
torprocessor(self) torprocessor(self)
@ -68,8 +69,8 @@ class Qbt:
printprocessor(self) printprocessor(self)
if self.use_pushover: if self.use_pushover:
tornotifysummary(self) tornotifysummary(self)
tordelete(self) #tordelete(self)
# Run # Run
if __name__== "__main__": if __name__== "__main__":
Qbt() Qbt()

View File

@ -11,30 +11,18 @@ def buildtorlist(self):
if self.use_log: if self.use_log:
self.tl.debug(f'["{torrent["name"][0:20]}..."] {torrent["infohash_v1"]}') self.tl.debug(f'["{torrent["name"][0:20]}..."] {torrent["infohash_v1"]}')
if torrent['category'] == 'tech': if torrent['category'] == 'tech':
break continue
if torrent['tracker'] == '': if torrent['tracker'] == '':
if self.use_log: if self.use_log:
self.tl.warning(f'Torrent doesn\'t have a tracker ["{torrent["name"][0:20]}..."] [{torrent["tracker"]}]hash: {torrent["hash"]}') self.tl.warning(f'Torrent doesn\'t have a tracker ["{torrent["name"][0:20]}..."] [{torrent["tracker"]}]hash: {torrent["hash"]}')
break continue
if self.tracker_whitelist['iptorrents-empirehost'] in torrent['tracker']: if torrent['tracker'].split('/')[2] in self.tracker_whitelist.values():
if self.use_log: if self.use_log:
self.tl.debug(f'Protected torrent: {torrent["tracker"]}hash: {torrent["hash"]}') self.tl.debug(f'Protected torrent: {torrent["tracker"]}hash: {torrent["hash"]}')
self.protected_count += 1 self.protected_count += 1
self.qbt_client.torrents_add_tags(self.tracker_protected_tag,torrent['hash']) self.qbt_client.torrents_add_tags(self.tracker_protected_tag,torrent['hash'])
self.tracker_protected_list.append(torrent) self.tracker_protected_list.append(torrent)
elif self.tracker_whitelist["iptorrents-stackoverflow"] in torrent['tracker']: elif torrent['tracker'].split('/')[2] not 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-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:
if self.use_log: if self.use_log:
self.tl.debug(f'Non-protected torrent: {torrent["tracker"]}hash: {torrent["hash"]}') self.tl.debug(f'Non-protected torrent: {torrent["tracker"]}hash: {torrent["hash"]}')
self.nonprotected_count += 1 self.nonprotected_count += 1
@ -64,4 +52,8 @@ def listqbitapiinfo(self):
def torrentcount(self): def torrentcount(self):
"""write torrent counts to log file""" """write torrent counts to log file"""
self.tl.debug(f'torrents that are protected {self.protected_count}') 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 'ipt' in canidate['tags']:
if self.use_log: if self.use_log:
self.tl.warning(f'["{canidate["name"][0:20]}..."] was in non-protected list.') self.tl.warning(f'["{canidate["name"][0:20]}..."] was in non-protected list.')
break continue
if canidate['state'] == 'downloading': if canidate['state'] == 'downloading':
if self.use_log: if self.use_log:
self.tl.info(f'["{canidate["name"][0:20]}..."] is still downloading and will be skipped.') self.tl.info(f'["{canidate["name"][0:20]}..."] is still downloading and will be skipped.')
break continue
else: else:
self.torrent_hash_delete_list.append(canidate['infohash_v1']) self.torrent_hash_delete_list.append(canidate['infohash_v1'])
if self.use_log: if self.use_log:
@ -19,7 +19,7 @@ def torprocessor(self):
if canidate['state'] == 'downloading': if canidate['state'] == 'downloading':
if self.use_log: if self.use_log:
self.tl.warning(f'["{canidate["name"][0:20]}..."] is still downloading and will be skipped.') self.tl.warning(f'["{canidate["name"][0:20]}..."] is still downloading and will be skipped.')
break continue
if canidate['ratio'] < float(1.05): if canidate['ratio'] < float(1.05):
if self.use_log: if self.use_log:
self.tl.debug(f'["{canidate["name"][0:20]}..."] is below a 1.05 ratio({canidate["ratio"]})') self.tl.debug(f'["{canidate["name"][0:20]}..."] is below a 1.05 ratio({canidate["ratio"]})')