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
This commit is contained in:
Adam 2015-05-24 21:08:20 +08:00
parent 3dc43aa8ae
commit 9d08b8ef8f
3 changed files with 10 additions and 9 deletions

View file

@ -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)

View file

@ -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'):

View file

@ -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)