Updated rtorrent-python library

- Fixed bencode encoding bug with long types
This commit is contained in:
Dean Gardiner
2014-02-07 01:40:11 +13:00
parent e4e7ae3621
commit 461e469f28
2 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -267,7 +267,7 @@ def _encode_dict(data):
def encode(data):
if isinstance(data, bool):
return False
elif isinstance(data, int):
elif isinstance(data, (int, long)):
return _encode_int(data)
elif isinstance(data, bytes):
return _encode_string(data)
+3 -3
View File
@@ -90,10 +90,10 @@ class TorrentParser():
def _calc_info_hash(self):
self.info_hash = None
if "info" in self._torrent_decoded.keys():
info_encoded = bencode.encode(self._torrent_decoded["info"])
info_encoded = bencode.encode(self._torrent_decoded["info"])
if info_encoded:
self.info_hash = hashlib.sha1(info_encoded).hexdigest().upper()
if info_encoded:
self.info_hash = hashlib.sha1(info_encoded).hexdigest().upper()
return(self.info_hash)