Added ability to use OR in required words

This commit is contained in:
rembo10
2014-04-05 16:10:46 -07:00
parent 0f619a2d43
commit da05a44187
2 changed files with 9 additions and 2 deletions

View File

@@ -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

View File

@@ -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