From a2a608ed856cc42fa0e380463bf6276f27c9ef36 Mon Sep 17 00:00:00 2001 From: echel0n Date: Sat, 3 May 2014 16:56:01 -0700 Subject: [PATCH] Fix for issues downloading season packs and episodes and multiples of the same episode. --- sickbeard/providers/generic.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/sickbeard/providers/generic.py b/sickbeard/providers/generic.py index f7455dba..dd521cc5 100644 --- a/sickbeard/providers/generic.py +++ b/sickbeard/providers/generic.py @@ -256,6 +256,9 @@ class GenericProvider: results = {} for epObj in episodes: + scene_season = epObj.scene_season + scene_episode = epObj.scene_episode + cacheResult = self.cache.searchCache(epObj, manualSearch) if len(cacheResult): return cacheResult @@ -279,9 +282,14 @@ class GenericProvider: continue if not (self.show.air_by_date or self.show.sports): - if (parse_result.season_number != season or epObj.episode not in parse_result.episode_numbers): - logger.log(u"Episode " + title + " isn't " + str(season) + "x" + str( - epObj.episode) + ", skipping it", logger.DEBUG) + if not parse_result.episode_numbers and (parse_result.season_number != None and parse_result.season_number != season) or ( + parse_result.season_number == None and season != 1): + logger.log(u"The result " + title + " doesn't seem to be a valid season for season " + str( + season) + ", ignoring", logger.DEBUG) + continue + elif len(parse_result.episode_numbers) and (parse_result.season_number != scene_season or scene_episode not in parse_result.episode_numbers): + logger.log(u"Episode " + title + " isn't " + str(scene_season) + "x" + str( + scene_episode) + ", skipping it", logger.DEBUG) continue else: @@ -317,7 +325,7 @@ class GenericProvider: result.content = None if len(epObjs) == 1: - epNum = epObjs[0].episode + epNum = epObj.episode logger.log(u"Single episode result.", logger.DEBUG) elif len(epObjs) > 1: epNum = MULTI_EP_RESULT @@ -333,6 +341,9 @@ class GenericProvider: else: results[epNum] = [result] + # remove duplicate results + results[epNum] = list(set(results[epNum])) + # found the result we wanted break