From 5c0af16297b723a62cfb7cbe4e4f076a40451505 Mon Sep 17 00:00:00 2001 From: echel0n Date: Mon, 17 Mar 2014 08:57:57 -0700 Subject: [PATCH] Fixed a bug that was majorly slowing down the performance of SB, was causing SB to search for indexer id number from RSS cache results as they came in so basically searching shows that most probally didnt even have indexed. --- sickbeard/helpers.py | 4 ++-- sickbeard/show_name_helpers.py | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/sickbeard/helpers.py b/sickbeard/helpers.py index 83c88602..0cf26f8c 100644 --- a/sickbeard/helpers.py +++ b/sickbeard/helpers.py @@ -264,7 +264,7 @@ def makeDir(path): return True -def searchDBForShow(regShowName, useIndexer=False): +def searchDBForShow(regShowName): showNames = [re.sub('[. -]', ' ', regShowName),regShowName] @@ -274,7 +274,7 @@ def searchDBForShow(regShowName, useIndexer=False): for showName in showNames: - show = get_show_by_name(showName,sickbeard.showList, useIndexer==useIndexer) + show = get_show_by_name(showName, sickbeard.showList) if show: sqlResults = myDB.select("SELECT * FROM tv_shows WHERE show_name LIKE ? OR show_name LIKE ?", [show.name, show.name]) else: diff --git a/sickbeard/show_name_helpers.py b/sickbeard/show_name_helpers.py index b1df71f8..80696236 100644 --- a/sickbeard/show_name_helpers.py +++ b/sickbeard/show_name_helpers.py @@ -194,7 +194,12 @@ def isGoodResult(name, show, log=True): escaped_name = re.sub('\\\\[\\s.-]', '\W+', re.escape(curName)) if show.startyear: escaped_name += "(?:\W+" + str(show.startyear) + ")?" - curRegex = '^' + escaped_name + '\W+(?:(?:S\d[\dE._ -])|(?:\d\d?x)|(?:\d{4}\W\d\d\W\d\d)|(?:(?:part|pt)[\._ -]?(\d|[ivx]))|Season\W+\d+\W+|E\d+\W+)|((.+?)[. _-]+)(\d{1,2}[a-zA-Z]{2})[. _-]+([a-zA-Z]{3,})[. _-]+(\d{4})*(.+?)([. _-])()((([^- ]+))?)?$' + curRegex = '^' + escaped_name + '\W+(?:(?:S\d[\dE._ -])|' \ + '(?:\d\d?x)|' \ + '(?:\d{4}\W\d\d\W\d\d)|' \ + '(?:(?:part|pt)[\._ -]?(\d|[ivx]))|' \ + 'Season\W+\d+\W+|E\d+\W+)|' \ + '((.+?)[. _-]+)(\d{1,2}[a-zA-Z]{2})[. _-]+([a-zA-Z]{3,})[. _-]+(\d{4})*(.+?)([. _-])()((([^- ]+))?)?$' if log: logger.log(u"Checking if show " + name + " matches " + curRegex, logger.DEBUG)