Permalink
Browse files

allow requiredWord pattern matching (less strict)

  • Loading branch information...
1 parent 62a0507 commit 7e52c8b9956a37aa624be3451b03ac58cce90ae2 @ka2er committed Jan 25, 2012
Showing with 13 additions and 5 deletions.
  1. +13 −5 app/lib/provider/yarr/base.py
@@ -113,11 +113,19 @@ def get_words(text):
nzbWords = get_words(item.name)
requiredWords = get_words(self.config.get('global', 'requiredWords'))
- missing = set(requiredWords) - set(nzbWords)
- if missing:
- log.info("NZB '%s' misses the following required words: %s" %
- (item.name, ", ".join(missing)))
- return False
+
+ for requiredWord in requiredWords:
+ # search pattern into word
+ pattern = re.compile(requiredWord, re.IGNORECASE)
+ for nzbWord in nzbWords:
+ notFound = ((nzbWord != requiredWord ) and (pattern.search(nzbWord) == None))
+
+ if notFound == False:
+ break;
+
+ if notFound:
+ print("NZB '%s' misses the following required expression : %s" % (item.name, requiredWord))
+ return False
ignoredWords = get_words(self.config.get('global', 'ignoreWords'))
blacklisted = set(ignoredWords).intersection(set(nzbWords))

0 comments on commit 7e52c8b

Please sign in to comment.