Private GIT

Skip to content
Snippets Groups Projects
Commit 27abe806 authored by miigotu's avatar miigotu
Browse files

Merge pull request #2167 from SiCKRAGETV/multi-result

Multi-Ep results were not checked for qualities, ignored/required wor…
parents 98f7efc8 17eb849c
Branches
Tags
No related merge requests found
...@@ -593,11 +593,10 @@ def searchProviders(show, episodes, manualSearch=False, downCurQuality=False): ...@@ -593,11 +593,10 @@ def searchProviders(show, episodes, manualSearch=False, downCurQuality=False):
epObjs.append(show.getEpisode(season, curEpNum)) epObjs.append(show.getEpisode(season, curEpNum))
bestSeasonResult.episodes = epObjs bestSeasonResult.episodes = epObjs
epNum = MULTI_EP_RESULT if MULTI_EP_RESULT in foundResults[curProvider.name]:
if epNum in foundResults[curProvider.name]: foundResults[curProvider.name][MULTI_EP_RESULT].append(bestSeasonResult)
foundResults[curProvider.name][epNum].append(bestSeasonResult)
else: else:
foundResults[curProvider.name][epNum] = [bestSeasonResult] foundResults[curProvider.name][MULTI_EP_RESULT] = [bestSeasonResult]
# go through multi-ep results and see if we really want them or not, get rid of the rest # go through multi-ep results and see if we really want them or not, get rid of the rest
multiResults = {} multiResults = {}
...@@ -606,27 +605,25 @@ def searchProviders(show, episodes, manualSearch=False, downCurQuality=False): ...@@ -606,27 +605,25 @@ def searchProviders(show, episodes, manualSearch=False, downCurQuality=False):
logger.log(u"Seeing if we want to bother with multi-episode result " + multiResult.name, logger.DEBUG) logger.log(u"Seeing if we want to bother with multi-episode result " + multiResult.name, logger.DEBUG)
if sickbeard.USE_FAILED_DOWNLOADS and failed_history.hasFailed(multiResult.name, multiResult.size, multiResult = pickBestResult([multiResult], show)
multiResult.provider.name): if not multiResult:
logger.log(multiResult.name + u" has previously failed, rejecting this multi-ep result")
continue continue
# see how many of the eps that this result covers aren't covered by single results # see how many of the eps that this result covers aren't covered by single results
neededEps = [] neededEps = []
notNeededEps = [] notNeededEps = []
for epObj in multiResult.episodes: for epObj in multiResult.episodes:
epNum = epObj.episode
# if we have results for the episode # if we have results for the episode
if epNum in foundResults[curProvider.name] and len(foundResults[curProvider.name][epNum]) > 0: if epObj.episode in foundResults[curProvider.name] and len(foundResults[curProvider.name][epObj.episode]) > 0:
neededEps.append(epNum) notNeededEps.append(epObj.episode)
else: else:
notNeededEps.append(epNum) neededEps.append(epObj.episode)
logger.log( logger.log(
u"Single-ep check result is neededEps: " + str(neededEps) + ", notNeededEps: " + str(notNeededEps), u"Single-ep check result is neededEps: " + str(neededEps) + ", notNeededEps: " + str(notNeededEps),
logger.DEBUG) logger.DEBUG)
if not notNeededEps: if not neededEps:
logger.log(u"All of these episodes were covered by single episode results, ignoring this multi-episode result", logger.DEBUG) logger.log(u"All of these episodes were covered by single episode results, ignoring this multi-episode result", logger.DEBUG)
continue continue
...@@ -634,11 +631,10 @@ def searchProviders(show, episodes, manualSearch=False, downCurQuality=False): ...@@ -634,11 +631,10 @@ def searchProviders(show, episodes, manualSearch=False, downCurQuality=False):
multiNeededEps = [] multiNeededEps = []
multiNotNeededEps = [] multiNotNeededEps = []
for epObj in multiResult.episodes: for epObj in multiResult.episodes:
epNum = epObj.episode if epObj.episode in multiResults:
if epNum in multiResults: multiNotNeededEps.append(epObj.episode)
multiNotNeededEps.append(epNum)
else: else:
multiNeededEps.append(epNum) multiNeededEps.append(epObj.episode)
logger.log( logger.log(
u"Multi-ep check result is multiNeededEps: " + str(multiNeededEps) + ", multiNotNeededEps: " + str( u"Multi-ep check result is multiNeededEps: " + str(multiNeededEps) + ", multiNotNeededEps: " + str(
...@@ -650,21 +646,14 @@ def searchProviders(show, episodes, manualSearch=False, downCurQuality=False): ...@@ -650,21 +646,14 @@ def searchProviders(show, episodes, manualSearch=False, downCurQuality=False):
logger.DEBUG) logger.DEBUG)
continue continue
# if we're keeping this multi-result then remember it
for epObj in multiResult.episodes:
if not multiResult.url.startswith('magnet'):
multiResult.content = multiResult.provider.getURL(cur_result.url)
multiResults[epObj.episode] = multiResult
# don't bother with the single result if we're going to get it with a multi result # don't bother with the single result if we're going to get it with a multi result
for epObj in multiResult.episodes: for epObj in multiResult.episodes:
epNum = epObj.episode multiResults[epObj.episode] = multiResult
if epNum in foundResults[curProvider.name]: if epObj.episode in foundResults[curProvider.name]:
logger.log( logger.log(
u"A needed multi-episode result overlaps with a single-episode result for ep #" + str( u"A needed multi-episode result overlaps with a single-episode result for ep #" + str(
epNum) + ", removing the single-episode results from the list", logger.DEBUG) epObj.episode) + ", removing the single-episode results from the list", logger.DEBUG)
del foundResults[curProvider.name][epNum] del foundResults[curProvider.name][epObj.episode]
# of all the single ep results narrow it down to the best one for each episode # of all the single ep results narrow it down to the best one for each episode
finalResults += set(multiResults.values()) finalResults += set(multiResults.values())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment