41
qlist.py
41
qlist.py
@@ -8,40 +8,37 @@ def build_tor_list(self):
|
||||
while self.torrent_list:
|
||||
torrent = self.torrent_list.pop()
|
||||
if self.use_log:
|
||||
self.tl.debug(f'["{torrent["name"][0:20]}..."] {torrent["infohash_v1"]}')
|
||||
self.tl.debug(f'---Analyzing ["{torrent["name"][0:20]}..."] {torrent["infohash_v1"]}---')
|
||||
if is_protected_tracker(torrent['tracker'], self.tracker_whitelist.values()):
|
||||
if is_tag_blank(torrent['tags']):
|
||||
self.qbt_client.torrents_add_tags(self.tracker_protected_tag,torrent['hash'])
|
||||
if self.use_log:
|
||||
self.tl.debug(f'Tagging Protected torrent: ["{torrent["name"][0:20]}..."] {torrent["tracker"]}hash: {torrent["hash"]}')
|
||||
self.tracker_list.append(torrent)
|
||||
if is_not_protected_tracker(torrent['tracker'], self.tracker_whitelist.values()):
|
||||
if is_tag_blank(torrent['tags']):
|
||||
self.qbt_client.torrents_add_tags(self.tracker_non_protected_tag,torrent['hash'])
|
||||
if self.use_log:
|
||||
self.tl.debug(f'Tagging Non-protected torrent: ["{torrent["name"][0:20]}..."] {torrent["tracker"]}hash: {torrent["hash"]}')
|
||||
self.tracker_list.append(torrent)
|
||||
if is_ignored_tag(self.ignored_tags.values(),torrent['tags']):
|
||||
self.ignored_counter += 1
|
||||
self.tl.info(f'Ignored tag: ["{torrent["name"][0:20]}..."] tags: {torrent["tags"]} hash: {torrent["hash"]}')
|
||||
continue
|
||||
# if torrent['added_on'] + self.minimum_age >= self.t.time():
|
||||
if is_preme(torrent['added_on'], self.minimum_age, self.t.time()):
|
||||
self.preme_tor_counter += 1
|
||||
self.tl.debug(f'Premature torrent: ["{torrent["name"][0:20]}..."] hash: {torrent["hash"]}')
|
||||
continue
|
||||
# if torrent['category'] in self.cat_whitelist.values():
|
||||
if is_cat_ignored(torrent['category'], self.cat_whitelist.values()):
|
||||
self.tl.info(f'Ignored torrent:["{torrent["name"][0:20]}..."]')
|
||||
self.tl.info(f'Ignored category: ["{torrent["name"][0:20]}..."] category:[{torrent["category"]}] hash: {torrent["hash"]}')
|
||||
self.ignored_counter += 1
|
||||
continue
|
||||
# if torrent['tracker'] == '':
|
||||
if is_tracker_blank(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"]}')
|
||||
self.ignored_counter += 1
|
||||
continue
|
||||
# if torrent['tracker'].split('/')[2] in self.tracker_whitelist.values():
|
||||
if is_protected_tracker(torrent['tracker'], self.tracker_whitelist.values()):
|
||||
if self.use_log:
|
||||
self.tl.debug(f'Protected torrent: {torrent["tracker"]}hash: {torrent["hash"]}')
|
||||
# if torrent['tags'] == '':
|
||||
if is_tag_blank(torrent['tags']):
|
||||
self.qbt_client.torrents_add_tags(self.tracker_protected_tag,torrent['hash'])
|
||||
self.tracker_list.append(torrent)
|
||||
if is_not_protected_tracker(torrent['tracker'], self.tracker_whitelist.values()):
|
||||
if self.use_log:
|
||||
self.tl.debug(f'Non-protected torrent: {torrent["tracker"]}hash: {torrent["hash"]}')
|
||||
# if torrent['tags'] == '':
|
||||
if is_tag_blank(torrent['tags']):
|
||||
self.qbt_client.torrents_add_tags(self.tracker_non_protected_tag,torrent['hash'])
|
||||
self.tracker_list.append(torrent)
|
||||
|
||||
|
||||
def is_preme(added, minage, time):
|
||||
if added + minage >= time:
|
||||
@@ -56,10 +53,14 @@ def is_tracker_blank(tracker):
|
||||
return True
|
||||
|
||||
def is_protected_tracker(tracker, trackerlist):
|
||||
if tracker == '':
|
||||
return False
|
||||
if tracker.split('/')[2] in trackerlist:
|
||||
return True
|
||||
|
||||
def is_not_protected_tracker(tracker, trackerlist):
|
||||
if tracker == '':
|
||||
return False
|
||||
if tracker.split('/')[2] not in trackerlist:
|
||||
return True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user