1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-12-13 11:32:20 -05:00

Fixed global name season error during searches

This commit is contained in:
echel0n 2014-09-06 22:25:01 -07:00
parent 2fbae22f2f
commit 20c0b4ea72

View File

@ -37,6 +37,7 @@ from sickbeard import clients
from hachoir_parser import createParser from hachoir_parser import createParser
class GenericProvider: class GenericProvider:
NZB = "nzb" NZB = "nzb"
TORRENT = "torrent" TORRENT = "torrent"
@ -63,7 +64,7 @@ class GenericProvider:
self.session = requests.session() self.session = requests.session()
self.headers = { self.headers = {
#Using USER_AGENT instead of Mozilla to keep same user agent along authentication and download phases, # Using USER_AGENT instead of Mozilla to keep same user agent along authentication and download phases,
#otherwise session might be broken and download fail, asking again for authentication #otherwise session might be broken and download fail, asking again for authentication
#'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36'} #'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36'}
'User-Agent': USER_AGENT} 'User-Agent': USER_AGENT}
@ -335,16 +336,15 @@ class GenericProvider:
logger.DEBUG) logger.DEBUG)
addCacheEntry = True addCacheEntry = True
else: else:
if not len(parse_result.episode_numbers) and ( if not len(parse_result.episode_numbers) and parse_result.season_number and not [ep for ep in
parse_result.season_number and parse_result.season_number != season) or ( episodes if
not parse_result.season_number and season != 1): ep.season == parse_result.season_number and ep.episode in parse_result.episode_numbers]:
logger.log( logger.log(
u"The result " + title + " doesn't seem to be a valid season that we are trying to snatch, ignoring", u"The result " + title + " doesn't seem to be a valid season that we are trying to snatch, ignoring",
logger.DEBUG) logger.DEBUG)
addCacheEntry = True addCacheEntry = True
elif len(parse_result.episode_numbers) and ( elif len(parse_result.episode_numbers) and not [ep for ep in episodes if
parse_result.season_number != season or not [ep for ep in episodes if ep.season == parse_result.season_number and ep.episode in parse_result.episode_numbers]:
ep.scene_episode in parse_result.episode_numbers]):
logger.log( logger.log(
u"The result " + title + " doesn't seem to be a valid episode that we are trying to snatch, ignoring", u"The result " + title + " doesn't seem to be a valid episode that we are trying to snatch, ignoring",
logger.DEBUG) logger.DEBUG)
@ -352,7 +352,7 @@ class GenericProvider:
if not addCacheEntry: if not addCacheEntry:
# we just use the existing info for normal searches # we just use the existing info for normal searches
actual_season = season actual_season = parse_result.season_number
actual_episodes = parse_result.episode_numbers actual_episodes = parse_result.episode_numbers
else: else:
if not (parse_result.is_air_by_date): if not (parse_result.is_air_by_date):