added set_piece_hashes that takes a callback to the python binding

This commit is contained in:
Arvid Norberg 2009-10-02 01:26:31 +00:00
parent ea1761838a
commit 0e1183f45e
2 changed files with 13 additions and 0 deletions

View File

@ -80,6 +80,7 @@ release 0.14.7
* added wait_for_alert to python binding * added wait_for_alert to python binding
* improved invalid filename character replacement * improved invalid filename character replacement
* improved forward compatibility in DHT * improved forward compatibility in DHT
* added set_piece_hashes that takes a callback to the python binding
release 0.14.6 release 0.14.6

View File

@ -16,6 +16,17 @@ namespace
{ {
c.set_hash(p, sha1_hash(hash)); c.set_hash(p, sha1_hash(hash));
} }
void call_python_object(boost::python::object const& obj, int i)
{
obj(i);
}
void set_piece_hashes_callback(create_torrent& c, boost::filesystem::path const& p
, boost::python::object cb)
{
set_piece_hashes(c, p, boost::bind(call_python_object, cb, _1));
}
} }
void bind_create_torrent() void bind_create_torrent()
@ -74,5 +85,6 @@ void bind_create_torrent()
def("add_files", add_files0); def("add_files", add_files0);
def("set_piece_hashes", set_piece_hashes0); def("set_piece_hashes", set_piece_hashes0);
def("set_piece_hashes", set_piece_hashes_callback);
} }