mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-03 18:03:37 +00:00
Possible fix for failed to send torrent errors
This commit is contained in:
parent
4752e07733
commit
54afca0472
1 changed files with 5 additions and 6 deletions
|
@ -143,15 +143,14 @@ class GenericClient(object):
|
||||||
def _get_torrent_hash(self, result):
|
def _get_torrent_hash(self, result):
|
||||||
|
|
||||||
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"]
|
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):
|
def sendTORRENT(self, result):
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue