diff --git a/ChangeLog b/ChangeLog index 1216931d4..5c7198ca8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -20,6 +20,7 @@ * fix uTP edge case where udp socket buffer fills up * fix nagle implementation in uTP + * add missing functions to python binding (flush_cache() and remap_files()) * improve handling of filenames that are invalid on windows * support 'implied_port' in DHT announce_peer * don't use pool allocator for disk blocks (cache may now return pages to the kernel) diff --git a/bindings/python/src/torrent_handle.cpp b/bindings/python/src/torrent_handle.cpp index 5e4c0f9bf..d6a04ae14 100644 --- a/bindings/python/src/torrent_handle.cpp +++ b/bindings/python/src/torrent_handle.cpp @@ -392,6 +392,7 @@ void bind_torrent_handle() .def("name", _(&torrent_handle::name)) .def("set_upload_mode", _(&torrent_handle::set_upload_mode)) .def("set_share_mode", _(&torrent_handle::set_share_mode)) + .def("flush_cache", &torrent_handle::flush_cache) .def("set_upload_limit", _(&torrent_handle::set_upload_limit)) .def("upload_limit", _(&torrent_handle::upload_limit)) .def("set_download_limit", _(&torrent_handle::set_download_limit)) diff --git a/bindings/python/src/torrent_info.cpp b/bindings/python/src/torrent_info.cpp index 8ea063e3e..b51c1a7c0 100644 --- a/bindings/python/src/torrent_info.cpp +++ b/bindings/python/src/torrent_info.cpp @@ -52,7 +52,14 @@ namespace return i.end_files(); } - //list files(torrent_info const& ti, bool storage) { + void remap_files(torrent_info& ti, list files) { + file_storage st; + for (int i = 0, e = len(files); i < e; ++i) + st.add_file(extract(files[i])); + + ti.remap_files(st); + } + list files(torrent_info const& ti, bool storage) { list result; @@ -138,6 +145,7 @@ void bind_torrent_info() .def(init((arg("file"), arg("flags") = 0))) #endif + .def("remap_files", &remap_files) .def("add_tracker", &torrent_info::add_tracker, arg("url")) .def("add_url_seed", &torrent_info::add_url_seed)