mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-01 00:43:37 +00:00
Merge pull request #744 from sammy2142/patch-1
Should fix some utorrent, rtorrent and deluge
This commit is contained in:
commit
0cea9877ed
1 changed files with 6 additions and 5 deletions
|
@ -143,14 +143,15 @@ class GenericClient(object):
|
|||
def _get_torrent_hash(self, result):
|
||||
|
||||
if result.url.startswith('magnet'):
|
||||
torrent_hash = re.findall('urn:btih:([\w]{32,40})', result.url)[0]
|
||||
if len(torrent_hash) == 32:
|
||||
torrent_hash = b16encode(b32decode(torrent_hash)).lower()
|
||||
result.hash = re.findall('urn:btih:([\w]{32,40})', result.url)[0]
|
||||
if len(result.hash) == 32:
|
||||
result.hash = b16encode(b32decode(torrent_hash)).lower()
|
||||
else:
|
||||
result.content = result.provider.getURL(result.url)
|
||||
info = bdecode(result.content)["info"]
|
||||
torrent_hash = sha1(bencode(info)).hexdigest()
|
||||
result.hash = sha1(bencode(info)).hexdigest()
|
||||
|
||||
return torrent_hash
|
||||
return result
|
||||
|
||||
def sendTORRENT(self, result):
|
||||
|
||||
|
|
Loading…
Reference in a new issue