mirror of
https://github.com/rembo10/headphones.git
synced 2026-07-21 00:14:02 +01: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
|
return name
|
||||||
|
|
||||||
def split_string(mystring):
|
def split_string(mystring, splitvar=','):
|
||||||
mylist = []
|
mylist = []
|
||||||
for each_word in mystring.split(','):
|
for each_word in mystring.split(splitvar):
|
||||||
mylist.append(each_word.strip())
|
mylist.append(each_word.strip())
|
||||||
return mylist
|
return mylist
|
||||||
|
|
||||||
|
|||||||
@@ -809,6 +809,13 @@ def verifyresult(title, artistterm, term, lossless):
|
|||||||
|
|
||||||
if headphones.REQUIRED_WORDS:
|
if headphones.REQUIRED_WORDS:
|
||||||
for each_word in helpers.split_string(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():
|
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)
|
logger.info("Removed '%s' from results because it doesn't contain required word: '%s'", title, each_word)
|
||||||
return False
|
return False
|
||||||
|
|||||||
Reference in New Issue
Block a user