mirror of
https://github.com/moparisthebest/SickRage
synced 2024-12-12 11:02:21 -05:00
Improved name parser scoring
This commit is contained in:
parent
c4a0f314fd
commit
e0e10dd289
@ -107,16 +107,12 @@ class NameParser(object):
|
||||
bestResult = None
|
||||
|
||||
for regexMode in self.regexModes:
|
||||
if doneSearch:
|
||||
break
|
||||
|
||||
self._compile_regexes(regexMode)
|
||||
|
||||
for (cur_regexMode, cur_regex_name, cur_regex) in self.compiled_regexes:
|
||||
time.sleep(0.02)
|
||||
|
||||
if doneSearch:
|
||||
break
|
||||
|
||||
match = cur_regex.match(name)
|
||||
|
||||
if not match:
|
||||
@ -134,6 +130,7 @@ class NameParser(object):
|
||||
if result.series_name:
|
||||
result.series_name = self.clean_series_name(result.series_name)
|
||||
|
||||
if not result.show:
|
||||
if self.showObj and self.showObj.name.lower() == result.series_name.lower():
|
||||
result.show = self.showObj
|
||||
else:
|
||||
@ -219,11 +216,11 @@ class NameParser(object):
|
||||
|
||||
if result.show:
|
||||
if regexMode == self.NORMAL_REGEX and not (result.show.is_anime or result.show.is_sports):
|
||||
doneSearch = True
|
||||
result.score += 1
|
||||
elif regexMode == self.SPORTS_REGEX and result.show.is_sports:
|
||||
doneSearch = True
|
||||
result.score += 1
|
||||
elif regexMode == self.ANIME_REGEX and result.show.is_anime:
|
||||
doneSearch = True
|
||||
result.score += 1
|
||||
|
||||
matches.append(result)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user