diff --git a/sickbeard/search.py b/sickbeard/search.py index 5b1ea86f..f02198be 100644 --- a/sickbeard/search.py +++ b/sickbeard/search.py @@ -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 """ if filter_words: - for test_word in filter_words.split(','): - test_word = test_word.strip() - - if test_word: - if re.search('(^|[\W_]|[\s_])' + test_word + '($|[\W_]|[\s_])', name, re.I): - logger.log(u"" + name + " contains word: " + test_word, logger.DEBUG) - return True + filters = [re.compile('(^|[\W_])%s($|[\W_])' % filter.strip(), re.I) for filter in filter_words.split(',')] + for regfilter in filters: + if regfilter.search(name): + logger.log(u"" + name + " contains pattern: " + regfilter.pattern, logger.DEBUG) + return True return False diff --git a/sickbeard/show_name_helpers.py b/sickbeard/show_name_helpers.py index 2e3e8722..37c39ea3 100644 --- a/sickbeard/show_name_helpers.py +++ b/sickbeard/show_name_helpers.py @@ -69,10 +69,10 @@ def filterBadReleases(name): # if any of the bad strings are in the name then say no if sickbeard.IGNORE_WORDS: 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: 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 True