1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-11-16 06:15:09 -05:00

This is a first attempt of getting the season pack downloading to work.

Unfortunately some of the old code I modified is still not 100% clear to me.. so I can't really oversee if this will work. That's why I suggest, this should be extensively tested, before merging into master!

I broke backlog searching.. Should be working again.

Tested, and seems to be working fine!
This commit is contained in:
KontiSR 2014-09-24 13:04:56 +02:00
parent 3c9f1d754d
commit 0d415fcc20
2 changed files with 25 additions and 13 deletions

View File

@ -334,11 +334,19 @@ class GenericProvider:
addCacheEntry = False addCacheEntry = False
if not (showObj.air_by_date or showObj.sports): if not (showObj.air_by_date or showObj.sports):
if search_mode == 'sponly' and len(parse_result.episode_numbers): if search_mode == 'sponly':
logger.log( if len(parse_result.episode_numbers):
u"This is supposed to be a season pack search but the result " + title + " is not a valid season pack, skipping it", logger.log(
logger.DEBUG) u"This is supposed to be a season pack search but the result " + title + " is not a valid season pack, skipping it",
addCacheEntry = True logger.DEBUG)
addCacheEntry = True
if len(parse_result.episode_numbers) and (
parse_result.season_number not in set([ep.season for ep in episodes]) or not [ep for ep in episodes if
ep.scene_episode in parse_result.episode_numbers]):
logger.log(
u"The result " + title + " doesn't seem to be a valid episode that we are trying to snatch, ignoring",
logger.DEBUG)
addCacheEntry = True
else: else:
if not len(parse_result.episode_numbers) and parse_result.season_number and not [ep for ep in if not len(parse_result.episode_numbers) and parse_result.season_number and not [ep for ep in
episodes if episodes if

View File

@ -533,7 +533,8 @@ def searchProviders(show, episodes, manualSearch=False):
# see if every episode is wanted # see if every episode is wanted
if bestSeasonResult: if bestSeasonResult:
searchedSeasons = []
searchedSeasons = [str(x.season) for x in episodes]
# get the quality of the season nzb # get the quality of the season nzb
seasonQual = bestSeasonResult.quality seasonQual = bestSeasonResult.quality
logger.log( logger.log(
@ -541,18 +542,21 @@ def searchProviders(show, episodes, manualSearch=False):
seasonQual], logger.DEBUG) seasonQual], logger.DEBUG)
myDB = db.DBConnection() myDB = db.DBConnection()
allEps = [int(x["episode"]) for x in allEps = [int(x["episode"])
myDB.select("SELECT episode FROM tv_episodes WHERE showid = ? AND season = ?", for x in myDB.select("SELECT episode FROM tv_episodes WHERE showid = ? AND ( season IN ( " + ','.join(searchedSeasons) + " ) )",
[show.indexerid, season])] [show.indexerid])]
logger.log(u"Executed query: [SELECT episode FROM tv_episodes WHERE showid = %s AND season in %s]" % (show.indexerid, ','.join(searchedSeasons)))
logger.log(u"Episode list: " + str(allEps), logger.DEBUG) logger.log(u"Episode list: " + str(allEps), logger.DEBUG)
allWanted = True allWanted = True
anyWanted = False anyWanted = False
for curEpNum in allEps: for curEpNum in allEps:
if not show.wantEpisode(season, curEpNum, seasonQual): for season in set([x.season for x in episodes]):
allWanted = False if not show.wantEpisode(season, curEpNum, seasonQual):
else: allWanted = False
anyWanted = True else:
anyWanted = True
# if we need every ep in the season and there's nothing better then just download this and be done with it (unless single episodes are preferred) # if we need every ep in the season and there's nothing better then just download this and be done with it (unless single episodes are preferred)
if allWanted and bestSeasonResult.quality == highest_quality_overall: if allWanted and bestSeasonResult.quality == highest_quality_overall: