From f452106bfc2cab9a575cb2dd8f6ea9720c69eec5 Mon Sep 17 00:00:00 2001 From: clinton-hall Date: Tue, 4 Dec 2012 02:15:48 -0800 Subject: [PATCH] Added comparison of sets of required words Can now match sets of words containing words separated by & with each set separated by , This only requires any set of word(s) to be matched, but within each set ALL words must match. --- couchpotato/core/plugins/searcher/main.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/couchpotato/core/plugins/searcher/main.py b/couchpotato/core/plugins/searcher/main.py index 20aa3ae9..b001cf98 100644 --- a/couchpotato/core/plugins/searcher/main.py +++ b/couchpotato/core/plugins/searcher/main.py @@ -307,7 +307,13 @@ class Searcher(Plugin): nzb_words = re.split('\W+', nzb_name) required_words = [x.strip().lower() for x in self.conf('required_words').lower().split(',')] - if self.conf('required_words') and not list(set(nzb_words) & set(required_words)): + req_match = 0 + for index in range(len(required_words)): + req = [x.strip().lower() for x in required_words[index].lower().split('&')] + if len(list(set(nzb_words) & set(req))) == len(req): + req_match = req_match + 1 + + if self.conf('required_words') and req_match == 0: log.info2("Wrong: Required word missing: %s" % nzb['name']) return False