diff --git a/headphones/helpers.py b/headphones/helpers.py index d534f518..bc802068 100644 --- a/headphones/helpers.py +++ b/headphones/helpers.py @@ -543,9 +543,9 @@ def sab_sanitize_foldername(name): return name -def split_string(mystring): +def split_string(mystring, splitvar=','): mylist = [] - for each_word in mystring.split(','): + for each_word in mystring.split(splitvar): mylist.append(each_word.strip()) return mylist diff --git a/headphones/searcher.py b/headphones/searcher.py index f1361e1d..343250d1 100644 --- a/headphones/searcher.py +++ b/headphones/searcher.py @@ -809,6 +809,13 @@ def verifyresult(title, artistterm, term, lossless): if headphones.REQUIRED_WORDS: for each_word in helpers.split_string(headphones.REQUIRED_WORDS): + if ' OR ' in each_word: + or_words = helpers.split_string(each_word, 'OR') + if any(word.lower() in title.lower() for word in or_words): + continue + else: + logger.info("Removed '%s' from results because it doesn't contain any of the required words in: '%s'", title, str(or_words)) + return False if each_word.lower() not in title.lower(): logger.info("Removed '%s' from results because it doesn't contain required word: '%s'", title, each_word) return False