added missing functions to python binding related to torrent creation

This commit is contained in:
Arvid Norberg 2009-08-28 03:46:19 +00:00
parent d5490221c8
commit 4c199b1876
2 changed files with 18 additions and 1 deletions

View File

@ -70,7 +70,9 @@
* improved support for sparse files on windows * improved support for sparse files on windows
* added ability to give seeding torrents preference to active slots * added ability to give seeding torrents preference to active slots
* added missing functions to python binding related to torrent creation
* fixed to add filename on web seed urls that lack it * fixed to add filename on web seed urls that lack it
* fixed BOOST_ASIO_HASH_MAP_BUCKETS define for boost 1.39
release 0.14.5 release 0.14.5

View File

@ -10,6 +10,14 @@
using namespace boost::python; using namespace boost::python;
using namespace libtorrent; using namespace libtorrent;
namespace
{
void set_hash(create_torrent& c, int p, char const* hash)
{
c.set_hash(p, sha1_hash(hash));
}
}
void bind_create_torrent() void bind_create_torrent()
{ {
void (file_storage::*add_file0)(file_entry const&) = &file_storage::add_file; void (file_storage::*add_file0)(file_entry const&) = &file_storage::add_file;
@ -21,6 +29,9 @@ void bind_create_torrent()
void (file_storage::*set_name0)(std::string const&) = &file_storage::set_name; void (file_storage::*set_name0)(std::string const&) = &file_storage::set_name;
void (file_storage::*set_name1)(std::wstring const&) = &file_storage::set_name; void (file_storage::*set_name1)(std::wstring const&) = &file_storage::set_name;
void (*set_piece_hashes0)(create_torrent&, boost::filesystem::path const&) = &set_piece_hashes;
void (*add_files0)(file_storage&, boost::filesystem::path const&) = add_files;
class_<file_storage>("file_storage") class_<file_storage>("file_storage")
.def("is_valid", &file_storage::is_valid) .def("is_valid", &file_storage::is_valid)
.def("add_file", add_file0) .def("add_file", add_file0)
@ -50,7 +61,7 @@ void bind_create_torrent()
.def("files", &create_torrent::files, return_internal_reference<>()) .def("files", &create_torrent::files, return_internal_reference<>())
.def("set_comment", &create_torrent::set_comment) .def("set_comment", &create_torrent::set_comment)
.def("set_creator", &create_torrent::set_creator) .def("set_creator", &create_torrent::set_creator)
.def("set_hash", &create_torrent::set_hash) .def("set_hash", &set_hash)
.def("add_url_seed", &create_torrent::add_url_seed) .def("add_url_seed", &create_torrent::add_url_seed)
.def("add_node", &create_torrent::add_node) .def("add_node", &create_torrent::add_node)
.def("add_tracker", &create_torrent::add_tracker) .def("add_tracker", &create_torrent::add_tracker)
@ -60,4 +71,8 @@ void bind_create_torrent()
.def("piece_size", &create_torrent::piece_size) .def("piece_size", &create_torrent::piece_size)
.def("priv", &create_torrent::priv) .def("priv", &create_torrent::priv)
; ;
def("add_files", add_files0);
def("set_piece_hashes", set_piece_hashes0);
} }