diff --git a/ignored_tags copy.json.example b/ignored_tags copy.json.example new file mode 100644 index 0000000..16477a0 --- /dev/null +++ b/ignored_tags copy.json.example @@ -0,0 +1,5 @@ +{ +"first":"first", +"second":"second", +"third":"third" +} \ No newline at end of file diff --git a/qbit-maid.py b/qbit-maid.py index 2b47055..dca066f 100644 --- a/qbit-maid.py +++ b/qbit-maid.py @@ -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"], diff --git a/qlist.py b/qlist.py index 93cf50b..3c535fb 100644 --- a/qlist.py +++ b/qlist.py @@ -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 @@ -63,4 +66,8 @@ def isnotprotectedtracker(tracker, trackerlist): def istagblank(tag): if tag == '': return True - \ No newline at end of file + +def isignoredtag(igtags, tortags): + for igt in igtags: + if igt in tortags: + return True \ No newline at end of file diff --git a/test_qbitmaid.py b/test_qbitmaid.py index a2874a6..a87e09b 100644 --- a/test_qbitmaid.py +++ b/test_qbitmaid.py @@ -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