added dragnet test case and fixed dragnet
This commit is contained in:
11
qprocess.py
11
qprocess.py
@@ -1,6 +1,3 @@
|
||||
from cgitb import enable
|
||||
|
||||
|
||||
def tor_processor(self):
|
||||
"""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
|
||||
@@ -36,7 +33,7 @@ def tor_processor(self):
|
||||
self.tl.info(f'Submitted ["{canidate["name"][0:20]}..."] for deletion.')
|
||||
else:
|
||||
if self.enable_dragnet:
|
||||
dragnet(self,canidate['state'],canidate['ratio'],canidate["tags"],canidate['added_on'],self.age,self.t.time(),canidate['infohash_v1'],canidate["name"][0:20])
|
||||
dragnet(self.cv,self.dragnet_outfile,canidate['state'],canidate['ratio'],canidate["tags"],canidate['added_on'],self.age,self.t.time(),canidate['infohash_v1'],canidate["name"][0:20])
|
||||
self.tl.info(f'["{canidate["name"][0:20]}..."] is orphaned.')
|
||||
self.up_tor_counter += 1
|
||||
continue
|
||||
@@ -73,11 +70,11 @@ def is_not_protected_tor(setnonprotectedtag, tortags):
|
||||
if setnonprotectedtag in tortags:
|
||||
return True
|
||||
|
||||
def dragnet(self,state,ratio,tags,added,age,time,thash,tname):
|
||||
def dragnet(csv_obj,outfile,state,ratio,tags,added,age,time,thash,tname):
|
||||
header = ['state','ratio','tags','added','age','time','thash','tname']
|
||||
row = [state,ratio,tags,added,age,time,thash,tname]
|
||||
with open(self.dragnet_outfile, 'w', encoding='UTF8', newline='') as f:
|
||||
writer = self.cv.writer(f)
|
||||
with open(outfile, 'a+', encoding='UTF8', newline='') as f:
|
||||
writer = csv_obj.writer(f)
|
||||
if f.tell() == 0:
|
||||
writer.writerow(header)
|
||||
writer.writerow(row)
|
||||
Reference in New Issue
Block a user