mirror of
https://github.com/rembo10/headphones.git
synced 2026-03-22 12:49:26 +00:00
Added ability to use OR in required words
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user