mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-01 00:43:37 +00:00
Possible fix for failed to send torrent errors
This commit is contained in:
parent
e2d1178515
commit
4752e07733
1 changed files with 2 additions and 4 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue