mirror of
https://github.com/SickGear/SickGear.git
synced 2025-01-07 10:33:38 +00:00
Added new InvalidShowException to NameParser, Removed isGoodResult search check and now attached parsed result show objects and compare them against the show object we use to search with instead.
This commit is contained in:
parent
a3a3777d33
commit
7a95b0bb14
16 changed files with 70 additions and 56 deletions
|
@ -24,7 +24,7 @@ import os.path
|
||||||
from sickbeard import db, common, helpers, logger
|
from sickbeard import db, common, helpers, logger
|
||||||
|
|
||||||
from sickbeard import encodingKludge as ek
|
from sickbeard import encodingKludge as ek
|
||||||
from sickbeard.name_parser.parser import NameParser, InvalidNameException
|
from sickbeard.name_parser.parser import NameParser, InvalidNameException, InvalidShowException
|
||||||
|
|
||||||
MIN_DB_VERSION = 9 # oldest db version we support migrating from
|
MIN_DB_VERSION = 9 # oldest db version we support migrating from
|
||||||
MAX_DB_VERSION = 38
|
MAX_DB_VERSION = 38
|
||||||
|
@ -270,7 +270,7 @@ class AddSizeAndSceneNameFields(InitialSchema):
|
||||||
try:
|
try:
|
||||||
np = NameParser(False)
|
np = NameParser(False)
|
||||||
parse_result = np.parse(cur_name)
|
parse_result = np.parse(cur_name)
|
||||||
except InvalidNameException:
|
except (InvalidNameException, InvalidShowException):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if parse_result.series_name and parse_result.season_number != None and parse_result.episode_numbers and parse_result.release_group:
|
if parse_result.series_name and parse_result.season_number != None and parse_result.episode_numbers and parse_result.release_group:
|
||||||
|
@ -295,7 +295,7 @@ class AddSizeAndSceneNameFields(InitialSchema):
|
||||||
try:
|
try:
|
||||||
np = NameParser(False)
|
np = NameParser(False)
|
||||||
parse_result = np.parse(ep_file_name)
|
parse_result = np.parse(ep_file_name)
|
||||||
except InvalidNameException:
|
except (InvalidNameException, InvalidShowException):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if not parse_result.release_group:
|
if not parse_result.release_group:
|
||||||
|
|
|
@ -26,7 +26,7 @@ from sickbeard import search_queue
|
||||||
from sickbeard import failed_history
|
from sickbeard import failed_history
|
||||||
from sickbeard import scene_exceptions
|
from sickbeard import scene_exceptions
|
||||||
|
|
||||||
from sickbeard.name_parser.parser import NameParser, InvalidNameException
|
from sickbeard.name_parser.parser import NameParser, InvalidNameException, InvalidShowException
|
||||||
|
|
||||||
|
|
||||||
class FailedProcessor(object):
|
class FailedProcessor(object):
|
||||||
|
@ -62,6 +62,9 @@ class FailedProcessor(object):
|
||||||
except InvalidNameException:
|
except InvalidNameException:
|
||||||
self._log(u"Error: release name is invalid: " + releaseName, logger.WARNING)
|
self._log(u"Error: release name is invalid: " + releaseName, logger.WARNING)
|
||||||
raise exceptions.FailedProcessingFailed()
|
raise exceptions.FailedProcessingFailed()
|
||||||
|
except InvalidShowException:
|
||||||
|
self._log(u"Error: unable to parse release name " + releaseName + " into a valid show", logger.WARNING)
|
||||||
|
raise exceptions.FailedProcessingFailed
|
||||||
|
|
||||||
logger.log(u"name_parser info: ", logger.DEBUG)
|
logger.log(u"name_parser info: ", logger.DEBUG)
|
||||||
logger.log(u" - " + str(parsed.series_name), logger.DEBUG)
|
logger.log(u" - " + str(parsed.series_name), logger.DEBUG)
|
||||||
|
|
|
@ -28,20 +28,19 @@ from dateutil import parser
|
||||||
|
|
||||||
nameparser_lock = threading.Lock()
|
nameparser_lock = threading.Lock()
|
||||||
|
|
||||||
|
|
||||||
class NameParser(object):
|
class NameParser(object):
|
||||||
ALL_REGEX = 0
|
ALL_REGEX = 0
|
||||||
NORMAL_REGEX = 1
|
NORMAL_REGEX = 1
|
||||||
SPORTS_REGEX = 2
|
SPORTS_REGEX = 2
|
||||||
ANIME_REGEX = 3
|
ANIME_REGEX = 3
|
||||||
|
|
||||||
def __init__(self, file_name=True, showObj=None, epObj=None, useIndexers=False, convert=False,
|
def __init__(self, file_name=True, showObj=None, useIndexers=False, convert=False,
|
||||||
naming_pattern=False):
|
naming_pattern=False):
|
||||||
|
|
||||||
self.file_name = file_name
|
self.file_name = file_name
|
||||||
self.showList = sickbeard.showList or []
|
|
||||||
self.useIndexers = useIndexers
|
|
||||||
self.showObj = showObj
|
self.showObj = showObj
|
||||||
self.epObj = epObj
|
self.useIndexers = useIndexers
|
||||||
self.convert = convert
|
self.convert = convert
|
||||||
self.naming_pattern = naming_pattern
|
self.naming_pattern = naming_pattern
|
||||||
|
|
||||||
|
@ -121,7 +120,8 @@ class NameParser(object):
|
||||||
if not name:
|
if not name:
|
||||||
return
|
return
|
||||||
|
|
||||||
if not self.showObj and not self.naming_pattern:
|
self.showObj = None
|
||||||
|
if not self.naming_pattern:
|
||||||
# Regex pattern to return the Show / Series Name regardless of the file pattern tossed at it, matched 53 show name examples from regexes.py
|
# Regex pattern to return the Show / Series Name regardless of the file pattern tossed at it, matched 53 show name examples from regexes.py
|
||||||
show_pattern = '''(?:(?:\[.*?\])|(?:\d{3}[\.-]))*[ _\.]?(?P<series_name>.*?(?:[ ._-]((?!\d{4}\W\d\d\W\d\d\W)\d{4}))?)(?:(?:(?:[ ._-]+\d+)|(?:[ ._-]+s\d{2}))|(?:\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,3}.+\d{1,}[a-zA-Z]{2}\W+[a-zA-Z]{3,}\W+\d{4}.+))))'''
|
show_pattern = '''(?:(?:\[.*?\])|(?:\d{3}[\.-]))*[ _\.]?(?P<series_name>.*?(?:[ ._-]((?!\d{4}\W\d\d\W\d\d\W)\d{4}))?)(?:(?:(?:[ ._-]+\d+)|(?:[ ._-]+s\d{2}))|(?:\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,3}.+\d{1,}[a-zA-Z]{2}\W+[a-zA-Z]{3,}\W+\d{4}.+))))'''
|
||||||
show_pattern_alt = '''^(?P<series_name>.*?(?:[ ._-]((?!\d{4}\W\d\d\W\d\d\W)\d{4}))?)(?:(?:(?:[ ._-]+\d+)|(?:[ ._-]+s\d{2}))|(?:\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,3}.+\d{1,}[a-zA-Z]{2}\W+[a-zA-Z]{3,}\W+\d{4}.+))))'''
|
show_pattern_alt = '''^(?P<series_name>.*?(?:[ ._-]((?!\d{4}\W\d\d\W\d\d\W)\d{4}))?)(?:(?:(?:[ ._-]+\d+)|(?:[ ._-]+s\d{2}))|(?:\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,3}.+\d{1,}[a-zA-Z]{2}\W+[a-zA-Z]{3,}\W+\d{4}.+))))'''
|
||||||
|
@ -131,7 +131,7 @@ class NameParser(object):
|
||||||
self.showObj = self._matchShowName(name, show_pattern_alt)
|
self.showObj = self._matchShowName(name, show_pattern_alt)
|
||||||
|
|
||||||
if not self.showObj:
|
if not self.showObj:
|
||||||
return
|
raise InvalidShowException("Unable to parse " + name.encode(sickbeard.SYS_ENCODING, 'xmlcharrefreplace'))
|
||||||
|
|
||||||
regexMode = self.ALL_REGEX
|
regexMode = self.ALL_REGEX
|
||||||
if self.showObj and self.showObj.is_anime:
|
if self.showObj and self.showObj.is_anime:
|
||||||
|
@ -523,7 +523,8 @@ class ParseResult(object):
|
||||||
if self.show.is_anime and len(self.ab_episode_numbers):
|
if self.show.is_anime and len(self.ab_episode_numbers):
|
||||||
scene_season = scene_exceptions.get_scene_exception_by_name(self.series_name)[1]
|
scene_season = scene_exceptions.get_scene_exception_by_name(self.series_name)[1]
|
||||||
for epAbsNo in self.ab_episode_numbers:
|
for epAbsNo in self.ab_episode_numbers:
|
||||||
ab = scene_numbering.get_indexer_absolute_numbering(self.show.indexerid, self.show.indexer, epAbsNo, True, scene_season)
|
ab = scene_numbering.get_indexer_absolute_numbering(self.show.indexerid, self.show.indexer, epAbsNo,
|
||||||
|
True, scene_season)
|
||||||
if ab:
|
if ab:
|
||||||
try:
|
try:
|
||||||
(s, e) = helpers.get_all_episodes_from_absolute_number(self.show, None, [ab])
|
(s, e) = helpers.get_all_episodes_from_absolute_number(self.show, None, [ab])
|
||||||
|
@ -620,7 +621,13 @@ class NameParserCache(object):
|
||||||
logger.log("Using cached parse result for: " + name, logger.DEBUG)
|
logger.log("Using cached parse result for: " + name, logger.DEBUG)
|
||||||
return self._previous_parsed[name]
|
return self._previous_parsed[name]
|
||||||
|
|
||||||
|
|
||||||
name_parser_cache = NameParserCache()
|
name_parser_cache = NameParserCache()
|
||||||
|
|
||||||
|
|
||||||
class InvalidNameException(Exception):
|
class InvalidNameException(Exception):
|
||||||
|
"The given name is not valid"
|
||||||
|
|
||||||
|
|
||||||
|
class InvalidShowException(Exception):
|
||||||
"The given name is not valid"
|
"The given name is not valid"
|
|
@ -23,7 +23,7 @@ import xml.etree.cElementTree as etree
|
||||||
import xml.etree
|
import xml.etree
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from name_parser.parser import NameParser, InvalidNameException
|
from name_parser.parser import NameParser, InvalidNameException, InvalidShowException
|
||||||
|
|
||||||
from sickbeard import logger, classes, helpers
|
from sickbeard import logger, classes, helpers
|
||||||
from sickbeard.common import Quality
|
from sickbeard.common import Quality
|
||||||
|
@ -118,6 +118,9 @@ def splitResult(result):
|
||||||
except InvalidNameException:
|
except InvalidNameException:
|
||||||
logger.log(u"Unable to parse the filename " + result.name + " into a valid episode", logger.WARNING)
|
logger.log(u"Unable to parse the filename " + result.name + " into a valid episode", logger.WARNING)
|
||||||
return False
|
return False
|
||||||
|
except InvalidShowException:
|
||||||
|
logger.log(u"Unable to parse the filename " + result.name + " into a valid show", logger.WARNING)
|
||||||
|
return False
|
||||||
|
|
||||||
# bust it up
|
# bust it up
|
||||||
season = parse_result.season_number if parse_result.season_number != None else 1
|
season = parse_result.season_number if parse_result.season_number != None else 1
|
||||||
|
@ -137,6 +140,9 @@ def splitResult(result):
|
||||||
except InvalidNameException:
|
except InvalidNameException:
|
||||||
logger.log(u"Unable to parse the filename " + newNZB + " into a valid episode", logger.WARNING)
|
logger.log(u"Unable to parse the filename " + newNZB + " into a valid episode", logger.WARNING)
|
||||||
return False
|
return False
|
||||||
|
except InvalidShowException:
|
||||||
|
logger.log(u"Unable to parse the filename " + newNZB + " into a valid show", logger.WARNING)
|
||||||
|
return False
|
||||||
|
|
||||||
# make sure the result is sane
|
# make sure the result is sane
|
||||||
if (parse_result.season_number != None and parse_result.season_number != season) or (
|
if (parse_result.season_number != None and parse_result.season_number != season) or (
|
||||||
|
|
|
@ -40,7 +40,7 @@ from sickbeard import name_cache
|
||||||
from sickbeard import encodingKludge as ek
|
from sickbeard import encodingKludge as ek
|
||||||
from sickbeard.exceptions import ex
|
from sickbeard.exceptions import ex
|
||||||
|
|
||||||
from sickbeard.name_parser.parser import NameParser, InvalidNameException
|
from sickbeard.name_parser.parser import NameParser, InvalidNameException, InvalidShowException
|
||||||
|
|
||||||
from lib import adba
|
from lib import adba
|
||||||
|
|
||||||
|
@ -480,11 +480,11 @@ class PostProcessor(object):
|
||||||
return to_return
|
return to_return
|
||||||
|
|
||||||
# parse the name to break it into show name, season, and episode
|
# parse the name to break it into show name, season, and episode
|
||||||
np = NameParser(file, useIndexers=True, convert=True)
|
try:
|
||||||
parse_result = np.parse(name)
|
np = NameParser(file, useIndexers=True, convert=True)
|
||||||
|
parse_result = np.parse(name)
|
||||||
# couldn't find this in our show list
|
except InvalidShowException:
|
||||||
if not parse_result.show:
|
logger.log(u"Unable to parse the filename " + name + " into a valid show", logger.WARNING)
|
||||||
return to_return
|
return to_return
|
||||||
|
|
||||||
if parse_result.air_by_date:
|
if parse_result.air_by_date:
|
||||||
|
|
|
@ -28,7 +28,7 @@ from sickbeard import db, helpers, exceptions
|
||||||
from sickbeard import encodingKludge as ek
|
from sickbeard import encodingKludge as ek
|
||||||
from sickbeard.exceptions import ex
|
from sickbeard.exceptions import ex
|
||||||
from sickbeard import logger
|
from sickbeard import logger
|
||||||
from sickbeard.name_parser.parser import NameParser, InvalidNameException
|
from sickbeard.name_parser.parser import NameParser, InvalidNameException, InvalidShowException
|
||||||
from sickbeard import common
|
from sickbeard import common
|
||||||
|
|
||||||
from sickbeard import failedProcessor
|
from sickbeard import failedProcessor
|
||||||
|
@ -269,14 +269,14 @@ def validateDir(path, dirName, nzbNameOriginal, failed):
|
||||||
try:
|
try:
|
||||||
NameParser().parse(video, cache_result=False)
|
NameParser().parse(video, cache_result=False)
|
||||||
return True
|
return True
|
||||||
except InvalidNameException:
|
except (InvalidNameException, InvalidShowException):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
for dir in allDirs:
|
for dir in allDirs:
|
||||||
try:
|
try:
|
||||||
NameParser().parse(dir, cache_result=False)
|
NameParser().parse(dir, cache_result=False)
|
||||||
return True
|
return True
|
||||||
except InvalidNameException:
|
except (InvalidNameException, InvalidShowException):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if sickbeard.UNPACK:
|
if sickbeard.UNPACK:
|
||||||
|
@ -287,7 +287,7 @@ def validateDir(path, dirName, nzbNameOriginal, failed):
|
||||||
try:
|
try:
|
||||||
NameParser().parse(packed, cache_result=False)
|
NameParser().parse(packed, cache_result=False)
|
||||||
return True
|
return True
|
||||||
except InvalidNameException:
|
except (InvalidNameException, InvalidShowException):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
|
@ -33,7 +33,7 @@ from sickbeard import history
|
||||||
|
|
||||||
from sickbeard.common import DOWNLOADED, SNATCHED, SNATCHED_PROPER, Quality
|
from sickbeard.common import DOWNLOADED, SNATCHED, SNATCHED_PROPER, Quality
|
||||||
|
|
||||||
from name_parser.parser import NameParser, InvalidNameException
|
from name_parser.parser import NameParser, InvalidNameException, InvalidShowException
|
||||||
|
|
||||||
|
|
||||||
class ProperFinder():
|
class ProperFinder():
|
||||||
|
@ -110,11 +110,11 @@ class ProperFinder():
|
||||||
except InvalidNameException:
|
except InvalidNameException:
|
||||||
logger.log(u"Unable to parse the filename " + curProper.name + " into a valid episode", logger.DEBUG)
|
logger.log(u"Unable to parse the filename " + curProper.name + " into a valid episode", logger.DEBUG)
|
||||||
continue
|
continue
|
||||||
|
except InvalidShowException:
|
||||||
if not parse_result.series_name:
|
logger.log(u"Unable to parse the filename " + curProper.name + " into a valid show", logger.WARNING)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if not parse_result.show:
|
if not parse_result.series_name:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if not parse_result.episode_numbers:
|
if not parse_result.episode_numbers:
|
||||||
|
|
|
@ -36,7 +36,7 @@ from sickbeard import tvcache
|
||||||
from sickbeard import encodingKludge as ek
|
from sickbeard import encodingKludge as ek
|
||||||
from sickbeard.exceptions import ex
|
from sickbeard.exceptions import ex
|
||||||
from lib.hachoir_parser import createParser
|
from lib.hachoir_parser import createParser
|
||||||
from sickbeard.name_parser.parser import NameParser, InvalidNameException
|
from sickbeard.name_parser.parser import NameParser, InvalidNameException, InvalidShowException
|
||||||
from sickbeard.common import Quality
|
from sickbeard.common import Quality
|
||||||
|
|
||||||
|
|
||||||
|
@ -278,12 +278,16 @@ class GenericProvider:
|
||||||
|
|
||||||
# parse the file name
|
# parse the file name
|
||||||
try:
|
try:
|
||||||
myParser = NameParser(False, showObj=show, epObj=ep_obj, convert=True)
|
myParser = NameParser(False, convert=True)
|
||||||
parse_result = myParser.parse(title)
|
parse_result = myParser.parse(title)
|
||||||
except InvalidNameException:
|
except InvalidNameException:
|
||||||
logger.log(u"Unable to parse the filename " + title + " into a valid episode", logger.WARNING)
|
logger.log(u"Unable to parse the filename " + title + " into a valid episode", logger.WARNING)
|
||||||
continue
|
continue
|
||||||
|
except InvalidShowException:
|
||||||
|
logger.log(u"Unable to parse the filename " + title + " into a valid show", logger.WARNING)
|
||||||
|
continue
|
||||||
|
|
||||||
|
showObj = parse_result.show
|
||||||
quality = parse_result.quality
|
quality = parse_result.quality
|
||||||
release_group = parse_result.release_group
|
release_group = parse_result.release_group
|
||||||
|
|
||||||
|
@ -360,11 +364,11 @@ class GenericProvider:
|
||||||
epObj.append(show.getEpisode(actual_season, curEp))
|
epObj.append(show.getEpisode(actual_season, curEp))
|
||||||
|
|
||||||
result = self.getResult(epObj)
|
result = self.getResult(epObj)
|
||||||
|
result.show = showObj
|
||||||
result.url = url
|
result.url = url
|
||||||
result.name = title
|
result.name = title
|
||||||
result.quality = quality
|
result.quality = quality
|
||||||
result.release_group = release_group
|
result.release_group = release_group
|
||||||
result.provider = self
|
|
||||||
result.content = None
|
result.content = None
|
||||||
|
|
||||||
if len(epObj) == 1:
|
if len(epObj) == 1:
|
||||||
|
|
|
@ -31,7 +31,7 @@ import urlparse
|
||||||
import sickbeard
|
import sickbeard
|
||||||
import generic
|
import generic
|
||||||
from sickbeard.common import Quality, cpu_presets
|
from sickbeard.common import Quality, cpu_presets
|
||||||
from sickbeard.name_parser.parser import NameParser, InvalidNameException
|
from sickbeard.name_parser.parser import NameParser, InvalidNameException, InvalidShowException
|
||||||
from sickbeard import logger
|
from sickbeard import logger
|
||||||
from sickbeard import tvcache
|
from sickbeard import tvcache
|
||||||
from sickbeard import helpers
|
from sickbeard import helpers
|
||||||
|
@ -156,7 +156,7 @@ class KATProvider(generic.TorrentProvider):
|
||||||
try:
|
try:
|
||||||
myParser = NameParser()
|
myParser = NameParser()
|
||||||
parse_result = myParser.parse(fileName)
|
parse_result = myParser.parse(fileName)
|
||||||
except InvalidNameException:
|
except (InvalidNameException, InvalidShowException):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
logger.log(u"Season quality for " + title + " is " + Quality.qualityStrings[quality], logger.DEBUG)
|
logger.log(u"Season quality for " + title + " is " + Quality.qualityStrings[quality], logger.DEBUG)
|
||||||
|
|
|
@ -29,8 +29,7 @@ import datetime
|
||||||
import sickbeard
|
import sickbeard
|
||||||
import generic
|
import generic
|
||||||
|
|
||||||
from sickbeard.common import Quality, cpu_presets
|
from sickbeard.common import Quality
|
||||||
from sickbeard.name_parser.parser import NameParser, InvalidNameException
|
|
||||||
from sickbeard import logger
|
from sickbeard import logger
|
||||||
from sickbeard import tvcache
|
from sickbeard import tvcache
|
||||||
from sickbeard import helpers
|
from sickbeard import helpers
|
||||||
|
|
|
@ -28,7 +28,7 @@ import datetime
|
||||||
import sickbeard
|
import sickbeard
|
||||||
import generic
|
import generic
|
||||||
from sickbeard.common import Quality, cpu_presets
|
from sickbeard.common import Quality, cpu_presets
|
||||||
from sickbeard.name_parser.parser import NameParser, InvalidNameException
|
from sickbeard.name_parser.parser import NameParser, InvalidNameException, InvalidShowException
|
||||||
from sickbeard import db
|
from sickbeard import db
|
||||||
from sickbeard import classes
|
from sickbeard import classes
|
||||||
from sickbeard import logger
|
from sickbeard import logger
|
||||||
|
@ -153,7 +153,7 @@ class ThePirateBayProvider(generic.TorrentProvider):
|
||||||
try:
|
try:
|
||||||
myParser = NameParser()
|
myParser = NameParser()
|
||||||
parse_result = myParser.parse(fileName)
|
parse_result = myParser.parse(fileName)
|
||||||
except InvalidNameException:
|
except (InvalidNameException, InvalidShowException):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
logger.log(u"Season quality for " + title + " is " + Quality.qualityStrings[quality], logger.DEBUG)
|
logger.log(u"Season quality for " + title + " is " + Quality.qualityStrings[quality], logger.DEBUG)
|
||||||
|
|
|
@ -328,9 +328,7 @@ def filterSearchResults(show, season, results):
|
||||||
for curEp in results:
|
for curEp in results:
|
||||||
# skip non-tv crap
|
# skip non-tv crap
|
||||||
results[curEp] = filter(
|
results[curEp] = filter(
|
||||||
lambda x: show_name_helpers.filterBadReleases(x.name) and show_name_helpers.isGoodResult(x.name, show,
|
lambda x: show_name_helpers.filterBadReleases(x.name) and x.show == show,results[curEp])
|
||||||
season=season),
|
|
||||||
results[curEp])
|
|
||||||
|
|
||||||
if curEp in foundResults:
|
if curEp in foundResults:
|
||||||
foundResults[curEp] += results[curEp]
|
foundResults[curEp] += results[curEp]
|
||||||
|
@ -455,10 +453,7 @@ def searchProviders(show, season, episodes, manualSearch=False):
|
||||||
for curEp in searchResults:
|
for curEp in searchResults:
|
||||||
# skip non-tv crap
|
# skip non-tv crap
|
||||||
searchResults[curEp] = filter(
|
searchResults[curEp] = filter(
|
||||||
lambda x: show_name_helpers.filterBadReleases(x.name) and show_name_helpers.isGoodResult(x.name,
|
lambda x: show_name_helpers.filterBadReleases(x.name) and x.show == show, searchResults[curEp])
|
||||||
show,
|
|
||||||
season=season),
|
|
||||||
searchResults[curEp])
|
|
||||||
|
|
||||||
if curEp in foundResults:
|
if curEp in foundResults:
|
||||||
foundResults[provider.name][curEp] += searchResults[curEp]
|
foundResults[provider.name][curEp] += searchResults[curEp]
|
||||||
|
@ -547,10 +542,7 @@ def searchProviders(show, season, episodes, manualSearch=False):
|
||||||
individualResults = nzbSplitter.splitResult(bestSeasonNZB)
|
individualResults = nzbSplitter.splitResult(bestSeasonNZB)
|
||||||
|
|
||||||
individualResults = filter(
|
individualResults = filter(
|
||||||
lambda x: show_name_helpers.filterBadReleases(x.name) and show_name_helpers.isGoodResult(x.name,
|
lambda x: show_name_helpers.filterBadReleases(x.name) and x.show == show, individualResults)
|
||||||
show,
|
|
||||||
season=season),
|
|
||||||
individualResults)
|
|
||||||
|
|
||||||
for curResult in individualResults:
|
for curResult in individualResults:
|
||||||
if len(curResult.episodes) == 1:
|
if len(curResult.episodes) == 1:
|
||||||
|
|
|
@ -28,7 +28,7 @@ from sickbeard.scene_exceptions import get_scene_exceptions
|
||||||
from sickbeard import logger
|
from sickbeard import logger
|
||||||
from sickbeard import db
|
from sickbeard import db
|
||||||
from sickbeard import encodingKludge as ek
|
from sickbeard import encodingKludge as ek
|
||||||
from name_parser.parser import NameParser, InvalidNameException
|
from name_parser.parser import NameParser, InvalidNameException, InvalidShowException
|
||||||
from lib.unidecode import unidecode
|
from lib.unidecode import unidecode
|
||||||
from sickbeard.blackandwhitelist import BlackAndWhiteList
|
from sickbeard.blackandwhitelist import BlackAndWhiteList
|
||||||
|
|
||||||
|
@ -52,6 +52,9 @@ def filterBadReleases(name):
|
||||||
except InvalidNameException:
|
except InvalidNameException:
|
||||||
logger.log(u"Unable to parse the filename " + name + " into a valid episode", logger.WARNING)
|
logger.log(u"Unable to parse the filename " + name + " into a valid episode", logger.WARNING)
|
||||||
return False
|
return False
|
||||||
|
except InvalidShowException:
|
||||||
|
logger.log(u"Unable to parse the filename " + name + " into a valid show", logger.WARNING)
|
||||||
|
return False
|
||||||
|
|
||||||
# if any of the bad strings are in the name then say no
|
# if any of the bad strings are in the name then say no
|
||||||
if sickbeard.IGNORE_WORDS:
|
if sickbeard.IGNORE_WORDS:
|
||||||
|
|
|
@ -29,7 +29,7 @@ import sickbeard
|
||||||
|
|
||||||
import xml.etree.cElementTree as etree
|
import xml.etree.cElementTree as etree
|
||||||
|
|
||||||
from name_parser.parser import NameParser, InvalidNameException
|
from name_parser.parser import NameParser, InvalidNameException, InvalidShowException
|
||||||
|
|
||||||
from lib import subliminal
|
from lib import subliminal
|
||||||
|
|
||||||
|
@ -436,7 +436,7 @@ class TVShow(object):
|
||||||
parse_result = None
|
parse_result = None
|
||||||
np = NameParser(False)
|
np = NameParser(False)
|
||||||
parse_result = np.parse(ep_file_name)
|
parse_result = np.parse(ep_file_name)
|
||||||
except InvalidNameException:
|
except (InvalidNameException, InvalidShowException):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if not ' ' in ep_file_name and parse_result and parse_result.release_group:
|
if not ' ' in ep_file_name and parse_result and parse_result.release_group:
|
||||||
|
@ -2072,7 +2072,7 @@ class TVEpisode(object):
|
||||||
try:
|
try:
|
||||||
np = NameParser(name, naming_pattern=True)
|
np = NameParser(name, naming_pattern=True)
|
||||||
parse_result = np.parse(name)
|
parse_result = np.parse(name)
|
||||||
except InvalidNameException, e:
|
except (InvalidNameException, InvalidShowException), e:
|
||||||
logger.log(u"Unable to get parse release_group: " + ex(e), logger.DEBUG)
|
logger.log(u"Unable to get parse release_group: " + ex(e), logger.DEBUG)
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ from sickbeard.common import Quality
|
||||||
from sickbeard import helpers, show_name_helpers
|
from sickbeard import helpers, show_name_helpers
|
||||||
from sickbeard.exceptions import MultipleShowObjectsException
|
from sickbeard.exceptions import MultipleShowObjectsException
|
||||||
from sickbeard.exceptions import AuthException
|
from sickbeard.exceptions import AuthException
|
||||||
from name_parser.parser import NameParser, InvalidNameException
|
from name_parser.parser import NameParser, InvalidNameException, InvalidShowException
|
||||||
from sickbeard.rssfeeds import RSSFeeds
|
from sickbeard.rssfeeds import RSSFeeds
|
||||||
|
|
||||||
cache_lock = threading.Lock()
|
cache_lock = threading.Lock()
|
||||||
|
@ -246,12 +246,11 @@ class TVCache():
|
||||||
except InvalidNameException:
|
except InvalidNameException:
|
||||||
logger.log(u"Unable to parse the filename " + name + " into a valid episode", logger.DEBUG)
|
logger.log(u"Unable to parse the filename " + name + " into a valid episode", logger.DEBUG)
|
||||||
return None
|
return None
|
||||||
|
except InvalidShowException:
|
||||||
if not parse_result or not parse_result.series_name:
|
logger.log(u"Unable to parse the filename " + name + " into a valid show", logger.WARNING)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
if not parse_result.show:
|
if not parse_result or not parse_result.series_name:
|
||||||
logger.log(u"No match for show: [" + parse_result.series_name + "], not caching ...", logger.DEBUG)
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
season = episodes = None
|
season = episodes = None
|
||||||
|
@ -359,6 +358,7 @@ class TVCache():
|
||||||
logger.log(u"Found result " + title + " at " + url)
|
logger.log(u"Found result " + title + " at " + url)
|
||||||
|
|
||||||
result = self.provider.getResult([epObj])
|
result = self.provider.getResult([epObj])
|
||||||
|
result.show = showObj
|
||||||
result.url = url
|
result.url = url
|
||||||
result.name = title
|
result.name = title
|
||||||
result.quality = curQuality
|
result.quality = curQuality
|
||||||
|
|
|
@ -72,7 +72,7 @@ class SRWebServer(threading.Thread):
|
||||||
|
|
||||||
# Load the app
|
# Load the app
|
||||||
self.app = Application([],
|
self.app = Application([],
|
||||||
debug=False,
|
debug=True,
|
||||||
gzip=True,
|
gzip=True,
|
||||||
xheaders=sickbeard.HANDLE_REVERSE_PROXY,
|
xheaders=sickbeard.HANDLE_REVERSE_PROXY,
|
||||||
cookie_secret='61oETzKXQAGaYdkL5gEmGeJJFuYh7EQnp2XdTP1o/Vo='
|
cookie_secret='61oETzKXQAGaYdkL5gEmGeJJFuYh7EQnp2XdTP1o/Vo='
|
||||||
|
|
Loading…
Reference in a new issue