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:
parent
3c9f1d754d
commit
0d415fcc20
@ -334,11 +334,19 @@ class GenericProvider:
|
||||
|
||||
addCacheEntry = False
|
||||
if not (showObj.air_by_date or showObj.sports):
|
||||
if search_mode == 'sponly' and len(parse_result.episode_numbers):
|
||||
logger.log(
|
||||
u"This is supposed to be a season pack search but the result " + title + " is not a valid season pack, skipping it",
|
||||
logger.DEBUG)
|
||||
addCacheEntry = True
|
||||
if search_mode == 'sponly':
|
||||
if len(parse_result.episode_numbers):
|
||||
logger.log(
|
||||
u"This is supposed to be a season pack search but the result " + title + " is not a valid season pack, skipping it",
|
||||
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:
|
||||
if not len(parse_result.episode_numbers) and parse_result.season_number and not [ep for ep in
|
||||
episodes if
|
||||
|
@ -533,7 +533,8 @@ def searchProviders(show, episodes, manualSearch=False):
|
||||
|
||||
# see if every episode is wanted
|
||||
if bestSeasonResult:
|
||||
|
||||
searchedSeasons = []
|
||||
searchedSeasons = [str(x.season) for x in episodes]
|
||||
# get the quality of the season nzb
|
||||
seasonQual = bestSeasonResult.quality
|
||||
logger.log(
|
||||
@ -541,18 +542,21 @@ def searchProviders(show, episodes, manualSearch=False):
|
||||
seasonQual], logger.DEBUG)
|
||||
|
||||
myDB = db.DBConnection()
|
||||
allEps = [int(x["episode"]) for x in
|
||||
myDB.select("SELECT episode FROM tv_episodes WHERE showid = ? AND season = ?",
|
||||
[show.indexerid, season])]
|
||||
allEps = [int(x["episode"])
|
||||
for x in myDB.select("SELECT episode FROM tv_episodes WHERE showid = ? AND ( season IN ( " + ','.join(searchedSeasons) + " ) )",
|
||||
[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)
|
||||
|
||||
allWanted = True
|
||||
anyWanted = False
|
||||
for curEpNum in allEps:
|
||||
if not show.wantEpisode(season, curEpNum, seasonQual):
|
||||
allWanted = False
|
||||
else:
|
||||
anyWanted = True
|
||||
for season in set([x.season for x in episodes]):
|
||||
if not show.wantEpisode(season, curEpNum, seasonQual):
|
||||
allWanted = False
|
||||
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 allWanted and bestSeasonResult.quality == highest_quality_overall:
|
||||
|
Loading…
Reference in New Issue
Block a user