Fix for reguired and prefered ignore words.

This commit is contained in:
echel0n 2014-04-25 23:33:02 -07:00
parent 3d43c6b5bf
commit 07cee09c83
2 changed files with 7 additions and 9 deletions

View file

@ -242,13 +242,11 @@ def filter_release_name(name, filter_words):
Returns: False if the release name is OK, True if it contains one of the filter_words Returns: False if the release name is OK, True if it contains one of the filter_words
""" """
if filter_words: if filter_words:
for test_word in filter_words.split(','): filters = [re.compile('(^|[\W_])%s($|[\W_])' % filter.strip(), re.I) for filter in filter_words.split(',')]
test_word = test_word.strip() for regfilter in filters:
if regfilter.search(name):
if test_word: logger.log(u"" + name + " contains pattern: " + regfilter.pattern, logger.DEBUG)
if re.search('(^|[\W_]|[\s_])' + test_word + '($|[\W_]|[\s_])', name, re.I): return True
logger.log(u"" + name + " contains word: " + test_word, logger.DEBUG)
return True
return False return False

View file

@ -69,10 +69,10 @@ def filterBadReleases(name):
# if any of the bad strings are in the name then say no # if any of the bad strings are in the name then say no
if sickbeard.IGNORE_WORDS: if sickbeard.IGNORE_WORDS:
resultFilters + sickbeard.IGNORE_WORDS.split(',') resultFilters + sickbeard.IGNORE_WORDS.split(',')
filters = [re.compile('(^|[\W_]|[\s_])%s($|[\W_]|[\s_])' % filter.strip(), re.I) for filter in resultFilters] filters = [re.compile('(^|[\W_])%s($|[\W_])' % filter.strip(), re.I) for filter in resultFilters]
for regfilter in filters: for regfilter in filters:
if regfilter.search(name): if regfilter.search(name):
logger.log(u"Invalid scene release: " + name + " contains " + regfilter.pattern + ", ignoring it", logger.DEBUG) logger.log(u"Invalid scene release: " + name + " contains pattern: " + regfilter.pattern + ", ignoring it", logger.DEBUG)
return False return False
return True return True