Ignored tags #18

Merged
jonbranan merged 2 commits from ignored_tags into main 2022-09-03 14:18:34 -05:00
4 changed files with 22 additions and 2 deletions
Showing only changes of commit 0977b12fe1 - Show all commits

View File

@ -0,0 +1,5 @@
{
"first":"first",
"second":"second",
"third":"third"
}

View File

@ -20,6 +20,8 @@ class Qbt:
self.config = load(c)
w = open('./category-whitelist.json')
self.cat_whitelist = load(w)
tg = open('./ignored_tags.json')
self.ignored_tags = load(tg)
# Create the api object
self.qbt_client = qbittorrentapi.Client(
host=self.config["host"],

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 isignoredtag(self.ignored_tags.values(),torrent['tags']):
self.ignored_counter += 1
continue
# if torrent['added_on'] + self.minimum_age >= self.t.time():
if ispreme(torrent['added_on'], self.minimum_age, self.t.time()):
self.preme_tor_counter += 1
@ -64,3 +67,7 @@ def istagblank(tag):
if tag == '':
return True
def isignoredtag(igtags, tortags):
for igt in igtags:
if igt in tortags:
return True

View File

@ -1,5 +1,5 @@
import unittest
from qlist import ispreme,iscatignored,istrackerblank,isprotectedtracker,isnotprotectedtracker,istagblank
from qlist import ispreme,iscatignored,istrackerblank,isprotectedtracker,isnotprotectedtracker,istagblank,isignoredtag
from qprocess import isdownloading,isprotectedunderratio,isoldtor,isprotectedoverratio,isnonprotectedtor
class TestQbitmaid(unittest.TestCase):
@ -87,6 +87,12 @@ class TestQbitmaid(unittest.TestCase):
def test_isnonprotectedtor(self):
pass
def test_isignoredtag_sanity(self):
self.assertTrue(isignoredtag(['a','b','c'], 'first,second,third,a'))
def test_isignoredtag_sanity(self):
self.assertTrue(isignoredtag(['a','b','c'], 'first,second,third,a'))
# def test__sanity(self):
# pass