mirror of
https://github.com/moparisthebest/SickRage
synced 2024-11-05 17:05:03 -05:00
commit
ace2d3d2cb
@ -142,18 +142,15 @@ class GenericClient(object):
|
||||
|
||||
def _get_torrent_hash(self, result):
|
||||
|
||||
result.hash = None
|
||||
if result.url.startswith('magnet'):
|
||||
result.hash = re.findall('urn:btih:([\w]{32,40})', result.url)[0]
|
||||
if len(result.hash) == 32:
|
||||
result.hash = b16encode(b32decode(result.hash)).lower()
|
||||
torrent_hash = re.findall('urn:btih:([\w]{32,40})', result.url)[0]
|
||||
if len(torrent_hash) == 32:
|
||||
torrent_hash = b16encode(b32decode(torrent_hash)).lower()
|
||||
else:
|
||||
result.content = result.provider.getURL(result.url)
|
||||
if result.content:
|
||||
info = bdecode(result.content)["info"]
|
||||
result.hash = sha1(bencode(info)).hexdigest()
|
||||
info = bdecode(result.content)["info"]
|
||||
torrent_hash = sha1(bencode(info)).hexdigest()
|
||||
|
||||
return result
|
||||
return torrent_hash
|
||||
|
||||
def sendTORRENT(self, result):
|
||||
|
||||
|
@ -406,15 +406,6 @@ class GenericProvider:
|
||||
epNum = SEASON_RESULT
|
||||
logger.log(u"Separating full season result to check for later", logger.DEBUG)
|
||||
|
||||
# validate torrent file if not magnet link to avoid invalid torrent links
|
||||
if self.providerType == self.TORRENT:
|
||||
if sickbeard.TORRENT_METHOD != "blackhole":
|
||||
client = clients.getClientIstance(sickbeard.TORRENT_METHOD)()
|
||||
result = client._get_torrent_hash(result)
|
||||
if not result.hash:
|
||||
logger.log(u'Unable to get torrent hash for ' + title + ', skipping it', logger.DEBUG)
|
||||
continue
|
||||
|
||||
if epNum not in results:
|
||||
results[epNum] = [result]
|
||||
else:
|
||||
|
@ -40,7 +40,7 @@ from sickbeard.helpers import sanitizeSceneName
|
||||
|
||||
class SpeedCDProvider(generic.TorrentProvider):
|
||||
urls = {'base_url': 'http://speed.cd/',
|
||||
'login': 'http://speed.cd/takelogin.php',
|
||||
'login': 'http://speed.cd/take_login.php',
|
||||
'detail': 'http://speed.cd/t/%s',
|
||||
'search': 'http://speed.cd/V3/API/API.php',
|
||||
'download': 'http://speed.cd/download.php?torrent=%s',
|
||||
|
@ -200,6 +200,7 @@ def pickBestResult(results, show, quality_list=None):
|
||||
# find the best result for the current episode
|
||||
bestResult = None
|
||||
for cur_result in results:
|
||||
|
||||
logger.log("Quality of " + cur_result.name + " is " + Quality.qualityStrings[cur_result.quality])
|
||||
|
||||
if bwl:
|
||||
@ -376,6 +377,14 @@ def searchForNeededEpisodes(show, episodes):
|
||||
if curEp in foundResults and bestResult.quality <= foundResults[curEp].quality:
|
||||
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
|
||||
|
||||
if not didSearch:
|
||||
@ -638,6 +647,14 @@ def searchProviders(show, season, episodes, manualSearch=False):
|
||||
if not bestResult:
|
||||
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
|
||||
found = False
|
||||
for i, result in enumerate(finalResults):
|
||||
|
@ -361,15 +361,6 @@ class TVCache():
|
||||
result.version = curVersion
|
||||
result.content = None
|
||||
|
||||
# validate torrent file if not magnet link to avoid invalid torrent links
|
||||
if self.provider.providerType == sickbeard.providers.generic.GenericProvider.TORRENT:
|
||||
if sickbeard.TORRENT_METHOD != "blackhole":
|
||||
client = clients.getClientIstance(sickbeard.TORRENT_METHOD)()
|
||||
result = client._get_torrent_hash(result)
|
||||
if not result.hash:
|
||||
logger.log(u'Unable to get torrent hash for ' + title + ', skipping it', logger.DEBUG)
|
||||
continue
|
||||
|
||||
# add it to the list
|
||||
if epObj not in neededEps:
|
||||
neededEps[epObj] = [result]
|
||||
|
Loading…
Reference in New Issue
Block a user