Browse Source

Updated rtorrent-python library

pull/2270/head
Dean Gardiner 12 years ago
parent
commit
48db4c8b8e
  1. 6
      libs/rtorrent/__init__.py
  2. 7
      libs/rtorrent/lib/torrentparser.py

6
libs/rtorrent/__init__.py

@ -71,12 +71,10 @@ class RTorrent:
def _verify_conn(self):
# check for rpc methods that should be available
assert {"system.client_version",
"system.library_version"}.issubset(set(self._get_rpc_methods())),\
"Required RPC methods not available."
assert "system.client_version" in self._get_rpc_methods(), "Required RPC method not available."
assert "system.library_version" in self._get_rpc_methods(), "Required RPC method not available."
# minimum rTorrent version check
assert self._meets_version_requirement() is True,\
"Error: Minimum rTorrent version required is {0}".format(
MIN_RTORRENT_VERSION_STR)

7
libs/rtorrent/lib/torrentparser.py

@ -90,9 +90,10 @@ class TorrentParser():
def _calc_info_hash(self):
self.info_hash = None
if "info" in self._torrent_decoded.keys():
info_dict = self._torrent_decoded["info"]
self.info_hash = hashlib.sha1(bencode.encode(
info_dict)).hexdigest().upper()
info_encoded = bencode.encode(self._torrent_decoded["info"])
if info_encoded:
self.info_hash = hashlib.sha1(info_encoded).hexdigest().upper()
return(self.info_hash)

Loading…
Cancel
Save