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

Filter out possible torrent links that would return a 404 http error

This commit is contained in:
echel0n 2014-08-17 22:21:37 -07:00
parent f3073174ed
commit 11150efab0

View File

@ -130,12 +130,6 @@ def snatchEpisode(result, endStatus=SNATCHED):
dlResult = _downloadResult(result) dlResult = _downloadResult(result)
else: else:
# Snatches torrent with client # Snatches torrent with client
result.content = None
if not result.url.startswith('magnet'):
result.content = result.provider.getURL(result.url)
if not result.content:
return False
client = clients.getClientIstance(sickbeard.TORRENT_METHOD)() client = clients.getClientIstance(sickbeard.TORRENT_METHOD)()
dlResult = client.sendTORRENT(result) dlResult = client.sendTORRENT(result)
else: else:
@ -206,6 +200,7 @@ def pickBestResult(results, show, quality_list=None):
# find the best result for the current episode # find the best result for the current episode
bestResult = None bestResult = None
for cur_result in results: for cur_result in results:
logger.log("Quality of " + cur_result.name + " is " + Quality.qualityStrings[cur_result.quality]) logger.log("Quality of " + cur_result.name + " is " + Quality.qualityStrings[cur_result.quality])
if bwl: if bwl:
@ -382,6 +377,14 @@ def searchForNeededEpisodes(show, episodes):
if curEp in foundResults and bestResult.quality <= foundResults[curEp].quality: if curEp in foundResults and bestResult.quality <= foundResults[curEp].quality:
continue continue
# filter out possible bad torrents from providers such as ezrss
if bestResult.resultType == "torrent" and sickbeard.TORRENT_METHOD != "blackhole":
bestResult.content = None
if not bestResult.url.startswith('magnet'):
bestResult.content = bestResult.provider.getURL(bestResult.url)
if not bestResult.content:
continue
foundResults[curEp] = bestResult foundResults[curEp] = bestResult
if not didSearch: if not didSearch:
@ -644,6 +647,14 @@ def searchProviders(show, season, episodes, manualSearch=False):
if not bestResult: if not bestResult:
continue continue
# filter out possible bad torrents from providers such as ezrss
if bestResult.resultType == "torrent" and sickbeard.TORRENT_METHOD != "blackhole":
bestResult.content = None
if not bestResult.url.startswith('magnet'):
bestResult.content = bestResult.provider.getURL(bestResult.url)
if not bestResult.content:
continue
# add result if its not a duplicate and # add result if its not a duplicate and
found = False found = False
for i, result in enumerate(finalResults): for i, result in enumerate(finalResults):