#15 added tag whitelisting
This commit is contained in:
parent
0135f7c13b
commit
0977b12fe1
5
ignored_tags copy.json.example
Normal file
5
ignored_tags copy.json.example
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"first":"first",
|
||||
"second":"second",
|
||||
"third":"third"
|
||||
}
|
@ -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"],
|
||||
|
9
qlist.py
9
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
|
||||
|
||||
|
||||
def isignoredtag(igtags, tortags):
|
||||
for igt in igtags:
|
||||
if igt in tortags:
|
||||
return True
|
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user