fix python bindings for peer_info

This commit is contained in:
arvidn 2019-03-15 22:59:25 +01:00 committed by Arvid Norberg
parent e1dec52b35
commit 55d549d582
3 changed files with 24 additions and 2 deletions

View File

@ -1,3 +1,4 @@
* fix python bindings for peer_info
* support creating symlinks, for torrents with symlinks in them
* fix error in seed_mode flag
* support magnet link parameters with number siffixes

View File

@ -53,8 +53,8 @@ void bind_peer_info()
scope pi = class_<peer_info>("peer_info")
.add_property("flags", make_getter(&peer_info::flags, by_value()))
.add_property("source", make_getter(&peer_info::source, by_value()))
.def_readonly("read_state", &peer_info::read_state)
.def_readonly("write_state", &peer_info::write_state)
.add_property("read_state", make_getter(&peer_info::read_state, by_value()))
.add_property("write_state", make_getter(&peer_info::write_state, by_value()))
.add_property("ip", get_ip)
.def_readonly("up_speed", &peer_info::up_speed)
.def_readonly("down_speed", &peer_info::down_speed)

View File

@ -712,6 +712,27 @@ class test_error_code(unittest.TestCase):
self.assertEqual(lt.system_category().name(), 'system')
class test_peer_info(unittest.TestCase):
def test_peer_info_members(self):
p = lt.peer_info()
print(p.client)
print(p.pieces)
print(p.pieces)
print(p.last_request)
print(p.last_active)
print(p.flags)
print(p.source)
print(p.pid)
print(p.downloading_piece_index)
print(p.ip)
print(p.local_endpoint)
print(p.read_state)
print(p.write_state)
if __name__ == '__main__':
print(lt.__version__)
shutil.copy(os.path.join('..', '..', 'test', 'test_torrents',