From 4752e07733b7969b3a3563d68ab1e2c82b980d6d Mon Sep 17 00:00:00 2001 From: echel0n Date: Sun, 17 Aug 2014 19:14:07 -0700 Subject: [PATCH 1/8] Possible fix for failed to send torrent errors --- sickbeard/clients/generic.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sickbeard/clients/generic.py b/sickbeard/clients/generic.py index aae58623..a3465719 100644 --- a/sickbeard/clients/generic.py +++ b/sickbeard/clients/generic.py @@ -142,16 +142,14 @@ 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() 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"] + result.hash = sha1(bencode(info)).hexdigest() return result From 54afca04725be05a73b4ab009e60cb5b146768cb Mon Sep 17 00:00:00 2001 From: echel0n Date: Sun, 17 Aug 2014 21:38:45 -0700 Subject: [PATCH 2/8] Possible fix for failed to send torrent errors --- sickbeard/clients/generic.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/sickbeard/clients/generic.py b/sickbeard/clients/generic.py index a3465719..d9c6fd20 100644 --- a/sickbeard/clients/generic.py +++ b/sickbeard/clients/generic.py @@ -143,15 +143,14 @@ class GenericClient(object): def _get_torrent_hash(self, result): 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) info = bdecode(result.content)["info"] - result.hash = sha1(bencode(info)).hexdigest() + torrent_hash = sha1(bencode(info)).hexdigest() - return result + return torrent_hash def sendTORRENT(self, result): From 88d68cfe11e8f5ef80c87a8935121901d4460bc7 Mon Sep 17 00:00:00 2001 From: echel0n Date: Sun, 17 Aug 2014 21:40:18 -0700 Subject: [PATCH 3/8] Possible fix for failed to send torrent errors --- sickbeard/search.py | 1 + 1 file changed, 1 insertion(+) diff --git a/sickbeard/search.py b/sickbeard/search.py index ab119f22..942e7f58 100644 --- a/sickbeard/search.py +++ b/sickbeard/search.py @@ -130,6 +130,7 @@ def snatchEpisode(result, endStatus=SNATCHED): dlResult = _downloadResult(result) else: # Snatches torrent with client + result.content = result.provider.getURL(result.url) if not result.url.startswith('magnet') else None client = clients.getClientIstance(sickbeard.TORRENT_METHOD)() dlResult = client.sendTORRENT(result) else: From f3073174eda66863daf7d467ef4621a3728ffb81 Mon Sep 17 00:00:00 2001 From: echel0n Date: Sun, 17 Aug 2014 22:02:29 -0700 Subject: [PATCH 4/8] Possible fix for failed to send torrent errors --- sickbeard/search.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sickbeard/search.py b/sickbeard/search.py index 942e7f58..08af2dd2 100644 --- a/sickbeard/search.py +++ b/sickbeard/search.py @@ -130,7 +130,12 @@ def snatchEpisode(result, endStatus=SNATCHED): dlResult = _downloadResult(result) else: # Snatches torrent with client - result.content = result.provider.getURL(result.url) if not result.url.startswith('magnet') else None + 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)() dlResult = client.sendTORRENT(result) else: From 11150efab05db66348cc40333599591ea68ae17c Mon Sep 17 00:00:00 2001 From: echel0n Date: Sun, 17 Aug 2014 22:21:37 -0700 Subject: [PATCH 5/8] Filter out possible torrent links that would return a 404 http error --- sickbeard/search.py | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/sickbeard/search.py b/sickbeard/search.py index 08af2dd2..3a6adc13 100644 --- a/sickbeard/search.py +++ b/sickbeard/search.py @@ -130,12 +130,6 @@ def snatchEpisode(result, endStatus=SNATCHED): dlResult = _downloadResult(result) else: # 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)() dlResult = client.sendTORRENT(result) else: @@ -206,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: @@ -382,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: @@ -644,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): From 8415b32fc6f3f2679989485dd19ea929ce2fffe3 Mon Sep 17 00:00:00 2001 From: echel0n Date: Sun, 17 Aug 2014 22:51:45 -0700 Subject: [PATCH 6/8] Possible fix for failed to send torrent errors --- sickbeard/providers/generic.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/sickbeard/providers/generic.py b/sickbeard/providers/generic.py index 5b02adbe..311a1327 100644 --- a/sickbeard/providers/generic.py +++ b/sickbeard/providers/generic.py @@ -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: From 6c15943363fc6eec5593166af4550bbdd04e5ebf Mon Sep 17 00:00:00 2001 From: echel0n Date: Sun, 17 Aug 2014 22:52:19 -0700 Subject: [PATCH 7/8] Possible fix for failed to send torrent errors --- sickbeard/tvcache.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/sickbeard/tvcache.py b/sickbeard/tvcache.py index 10874a92..96b79499 100644 --- a/sickbeard/tvcache.py +++ b/sickbeard/tvcache.py @@ -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] From 3bf102d160dce15bc5bf0cb7deb86f8f6e2be1e7 Mon Sep 17 00:00:00 2001 From: adam Date: Mon, 18 Aug 2014 16:49:14 +0800 Subject: [PATCH 8/8] Fixes speedcd provider issues --- sickbeard/providers/speedcd.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sickbeard/providers/speedcd.py b/sickbeard/providers/speedcd.py index a8ad5dd5..a2ee3bb9 100644 --- a/sickbeard/providers/speedcd.py +++ b/sickbeard/providers/speedcd.py @@ -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',