1
0
Fork 0
mirror of https://github.com/evilhero/mylar synced 2024-12-26 09:36:53 +00:00

FIX: bencode problem for deluge users when snatching torrent

This commit is contained in:
evilhero 2017-03-09 14:47:17 -05:00
parent 1f7f8e9add
commit 8891088b4d

View file

@ -158,13 +158,13 @@ class TorrentClient(object):
def get_the_hash(self, filepath):
import hashlib, StringIO
from mylar import bencode
import bencode
# Open torrent file
torrent_file = open(filepath, "rb")
metainfo = bencode.bdecode(torrent_file.read())
metainfo = bencode.decode(torrent_file.read())
info = metainfo['info']
thehash = hashlib.sha1(bencode.bencode(info)).hexdigest().upper()
thehash = hashlib.sha1(bencode.encode(info)).hexdigest().upper()
logger.debug('Hash: ' + thehash)
return thehash