mirror of
https://github.com/moparisthebest/SickRage
synced 2024-11-11 03:45:01 -05:00
commit
ace2d3d2cb
@ -142,18 +142,15 @@ class GenericClient(object):
|
|||||||
|
|
||||||
def _get_torrent_hash(self, result):
|
def _get_torrent_hash(self, result):
|
||||||
|
|
||||||
result.hash = None
|
|
||||||
if result.url.startswith('magnet'):
|
if result.url.startswith('magnet'):
|
||||||
result.hash = re.findall('urn:btih:([\w]{32,40})', result.url)[0]
|
torrent_hash = re.findall('urn:btih:([\w]{32,40})', result.url)[0]
|
||||||
if len(result.hash) == 32:
|
if len(torrent_hash) == 32:
|
||||||
result.hash = b16encode(b32decode(result.hash)).lower()
|
torrent_hash = b16encode(b32decode(torrent_hash)).lower()
|
||||||
else:
|
else:
|
||||||
result.content = result.provider.getURL(result.url)
|
info = bdecode(result.content)["info"]
|
||||||
if result.content:
|
torrent_hash = sha1(bencode(info)).hexdigest()
|
||||||
info = bdecode(result.content)["info"]
|
|
||||||
result.hash = sha1(bencode(info)).hexdigest()
|
|
||||||
|
|
||||||
return result
|
return torrent_hash
|
||||||
|
|
||||||
def sendTORRENT(self, result):
|
def sendTORRENT(self, result):
|
||||||
|
|
||||||
|
@ -406,15 +406,6 @@ class GenericProvider:
|
|||||||
epNum = SEASON_RESULT
|
epNum = SEASON_RESULT
|
||||||
logger.log(u"Separating full season result to check for later", logger.DEBUG)
|
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:
|
if epNum not in results:
|
||||||
results[epNum] = [result]
|
results[epNum] = [result]
|
||||||
else:
|
else:
|
||||||
|
@ -40,7 +40,7 @@ from sickbeard.helpers import sanitizeSceneName
|
|||||||
|
|
||||||
class SpeedCDProvider(generic.TorrentProvider):
|
class SpeedCDProvider(generic.TorrentProvider):
|
||||||
urls = {'base_url': 'http://speed.cd/',
|
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',
|
'detail': 'http://speed.cd/t/%s',
|
||||||
'search': 'http://speed.cd/V3/API/API.php',
|
'search': 'http://speed.cd/V3/API/API.php',
|
||||||
'download': 'http://speed.cd/download.php?torrent=%s',
|
'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
|
# 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:
|
||||||
@ -376,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:
|
||||||
@ -638,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):
|
||||||
|
@ -361,15 +361,6 @@ class TVCache():
|
|||||||
result.version = curVersion
|
result.version = curVersion
|
||||||
result.content = None
|
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
|
# add it to the list
|
||||||
if epObj not in neededEps:
|
if epObj not in neededEps:
|
||||||
neededEps[epObj] = [result]
|
neededEps[epObj] = [result]
|
||||||
|
Loading…
Reference in New Issue
Block a user