Use sets for ignored words. fixes #1657
This commit is contained in:
@@ -25,12 +25,13 @@ config = [{
|
|||||||
'label': 'Required words',
|
'label': 'Required words',
|
||||||
'default': '',
|
'default': '',
|
||||||
'placeholder': 'Example: DTS, AC3 & English',
|
'placeholder': 'Example: DTS, AC3 & English',
|
||||||
'description': 'Ignore releases that don\'t contain at least one set of words. Sets are separated by "," and each word within a set must be separated with "&"'
|
'description': 'A release should contain at least one set of words. Sets are separated by "," and each word within a set must be separated with "&"'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'ignored_words',
|
'name': 'ignored_words',
|
||||||
'label': 'Ignored words',
|
'label': 'Ignored words',
|
||||||
'default': 'german, dutch, french, truefrench, danish, swedish, spanish, italian, korean, dubbed, swesub, korsub, dksubs',
|
'default': 'german, dutch, french, truefrench, danish, swedish, spanish, italian, korean, dubbed, swesub, korsub, dksubs',
|
||||||
|
'description': 'Ignores releases that match any of these sets. (Works like explained above)'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'preferred_method',
|
'name': 'preferred_method',
|
||||||
|
|||||||
@@ -384,8 +384,9 @@ class Searcher(Plugin):
|
|||||||
movie_words = re.split('\W+', simplifyString(movie_name))
|
movie_words = re.split('\W+', simplifyString(movie_name))
|
||||||
nzb_name = simplifyString(nzb['name'])
|
nzb_name = simplifyString(nzb['name'])
|
||||||
nzb_words = re.split('\W+', nzb_name)
|
nzb_words = re.split('\W+', nzb_name)
|
||||||
required_words = splitString(self.conf('required_words').lower())
|
|
||||||
|
|
||||||
|
# Make sure it has required words
|
||||||
|
required_words = splitString(self.conf('required_words').lower())
|
||||||
req_match = 0
|
req_match = 0
|
||||||
for req_set in required_words:
|
for req_set in required_words:
|
||||||
req = splitString(req_set, '&')
|
req = splitString(req_set, '&')
|
||||||
@@ -395,19 +396,24 @@ class Searcher(Plugin):
|
|||||||
log.info2("Wrong: Required word missing: %s" % nzb['name'])
|
log.info2("Wrong: Required word missing: %s" % nzb['name'])
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
# Ignore releases
|
||||||
ignored_words = splitString(self.conf('ignored_words').lower())
|
ignored_words = splitString(self.conf('ignored_words').lower())
|
||||||
blacklisted = list(set(nzb_words) & set(ignored_words) - set(movie_words))
|
ignored_match = 0
|
||||||
if self.conf('ignored_words') and blacklisted:
|
for ignored_set in ignored_words:
|
||||||
log.info2("Wrong: '%s' blacklisted words: %s" % (nzb['name'], ", ".join(blacklisted)))
|
ignored = splitString(ignored_set, '&')
|
||||||
|
ignored_match += len(list(set(nzb_words) & set(ignored))) == len(ignored)
|
||||||
|
|
||||||
|
if self.conf('ignored_words') and ignored_match:
|
||||||
|
log.info2("Wrong: '%s' contains 'ignored words'" % (nzb['name']))
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
# Ignore porn stuff
|
||||||
pron_tags = ['xxx', 'sex', 'anal', 'tits', 'fuck', 'porn', 'orgy', 'milf', 'boobs', 'erotica', 'erotic']
|
pron_tags = ['xxx', 'sex', 'anal', 'tits', 'fuck', 'porn', 'orgy', 'milf', 'boobs', 'erotica', 'erotic']
|
||||||
pron_words = list(set(nzb_words) & set(pron_tags) - set(movie_words))
|
pron_words = list(set(nzb_words) & set(pron_tags) - set(movie_words))
|
||||||
if pron_words:
|
if pron_words:
|
||||||
log.info('Wrong: %s, probably pr0n', (nzb['name']))
|
log.info('Wrong: %s, probably pr0n', (nzb['name']))
|
||||||
return False
|
return False
|
||||||
|
|
||||||
#qualities = fireEvent('quality.all', single = True)
|
|
||||||
preferred_quality = fireEvent('quality.single', identifier = quality['identifier'], single = True)
|
preferred_quality = fireEvent('quality.single', identifier = quality['identifier'], single = True)
|
||||||
|
|
||||||
# Contains lower quality string
|
# Contains lower quality string
|
||||||
|
|||||||
Reference in New Issue
Block a user