diff --git a/ChangeLog b/ChangeLog index ed0f00e2c..d1cd4fc4a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -80,6 +80,7 @@ release 0.14.7 * added wait_for_alert to python binding * improved invalid filename character replacement * improved forward compatibility in DHT + * added set_piece_hashes that takes a callback to the python binding release 0.14.6 diff --git a/bindings/python/src/create_torrent.cpp b/bindings/python/src/create_torrent.cpp index 116762e47..5ed95614a 100644 --- a/bindings/python/src/create_torrent.cpp +++ b/bindings/python/src/create_torrent.cpp @@ -16,6 +16,17 @@ namespace { 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() @@ -74,5 +85,6 @@ void bind_create_torrent() def("add_files", add_files0); def("set_piece_hashes", set_piece_hashes0); + def("set_piece_hashes", set_piece_hashes_callback); }