From e0e10dd289516bf00811d7893fec222e392c3127 Mon Sep 17 00:00:00 2001 From: echel0n Date: Fri, 18 Jul 2014 17:44:06 -0700 Subject: [PATCH] Improved name parser scoring --- sickbeard/name_parser/parser.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/sickbeard/name_parser/parser.py b/sickbeard/name_parser/parser.py index 38b41f11..f8e416db 100644 --- a/sickbeard/name_parser/parser.py +++ b/sickbeard/name_parser/parser.py @@ -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)