From 9d08b8ef8f2dad8799e9296ef1ba08cbfa49ebe4 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 24 May 2015 21:08:20 +0800 Subject: [PATCH] Fix erroneous multiple downloads of torrent files which causes snatches to fail under certain conditions Namely this fixes snatching with the IPtorrents provider. This issue is masked in develop as the requests library has been updated and fixes the error that is generated --- CHANGES.md | 5 +++++ sickbeard/clients/generic.py | 2 -- sickbeard/search.py | 12 +++++------- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index df0b3ac..a945708 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,8 @@ +### 0.9.1 (2015-05-25 03:03:00 UTC) + +* Fix erroneous multiple downloads of torrent files which causes snatches to fail under certain conditions + + ### 0.9.0 (2015-05-18 14:33:00 UTC) * Update Tornado webserver to 4.2.dev1 (609dbb9) diff --git a/sickbeard/clients/generic.py b/sickbeard/clients/generic.py index d31bed1..4ad0785 100644 --- a/sickbeard/clients/generic.py +++ b/sickbeard/clients/generic.py @@ -151,7 +151,6 @@ class GenericClient(object): if len(result.hash) == 32: result.hash = b16encode(b32decode(result.hash)).lower() else: - result.content = result.provider.getURL(result.url) info = bdecode(result.content)['info'] result.hash = sha1(bencode(info)).hexdigest() @@ -171,7 +170,6 @@ class GenericClient(object): # Sets per provider seed ratio result.ratio = result.provider.seedRatio() - # lazy fix for now, I'm sure we already do this somewhere else too result = self._get_torrent_hash(result) if result.url.startswith('magnet'): diff --git a/sickbeard/search.py b/sickbeard/search.py index ab27b23..74ccdca 100644 --- a/sickbeard/search.py +++ b/sickbeard/search.py @@ -133,13 +133,11 @@ def snatchEpisode(result, endStatus=SNATCHED): dlResult = _downloadResult(result) else: # make sure we have the torrent file content - if not result.content: - if not result.url.startswith('magnet'): - result.content = result.provider.getURL(result.url) - if not result.content: - logger.log( - u"Torrent content failed to download from " + result.url, logger.ERROR - ) + if not result.content and not result.url.startswith('magnet'): + result.content = result.provider.getURL(result.url) + if not result.content: + logger.log(u'Torrent content failed to download from ' + result.url, logger.ERROR) + return False # Snatches torrent with client client = clients.getClientIstance(sickbeard.TORRENT_METHOD)() dlResult = client.sendTORRENT(result)