diff --git a/libtorrent/bindings/python/src/alert.cpp b/libtorrent/bindings/python/src/alert.cpp index d87071bd3..1772bf8be 100755 --- a/libtorrent/bindings/python/src/alert.cpp +++ b/libtorrent/bindings/python/src/alert.cpp @@ -278,6 +278,7 @@ void bind_alert() class_, noncopyable>( "file_renamed_alert", no_init ) + .def_readonly("index", &file_renamed_alert::index) .def_readonly("name", &file_renamed_alert::name) ; @@ -285,6 +286,7 @@ void bind_alert() "file_rename_failed_alert", no_init ) .def_readonly("index", &file_rename_failed_alert::index) + .def_readonly("msg", &file_rename_failed_alert::msg) ; class_, noncopyable>( diff --git a/libtorrent/bindings/python/src/torrent_handle.cpp b/libtorrent/bindings/python/src/torrent_handle.cpp index de9ba014c..622ab06a0 100755 --- a/libtorrent/bindings/python/src/torrent_handle.cpp +++ b/libtorrent/bindings/python/src/torrent_handle.cpp @@ -317,6 +317,7 @@ void bind_torrent_handle() .def("move_storage", _(&torrent_handle::move_storage)) .def("info_hash", _(&torrent_handle::info_hash)) .def("force_recheck", _(&torrent_handle::force_recheck)) + .def("rename_file", _(&torrent_handle::rename_file)) ; } diff --git a/libtorrent/bindings/python/src/torrent_info.cpp b/libtorrent/bindings/python/src/torrent_info.cpp index 55e7fd6b9..2a1892290 100755 --- a/libtorrent/bindings/python/src/torrent_info.cpp +++ b/libtorrent/bindings/python/src/torrent_info.cpp @@ -12,58 +12,61 @@ using namespace libtorrent; namespace { - std::vector::const_iterator begin_trackers(torrent_info& i) - { - return i.trackers().begin(); - } + std::vector::const_iterator begin_trackers(torrent_info& i) + { + return i.trackers().begin(); + } - std::vector::const_iterator end_trackers(torrent_info& i) - { - return i.trackers().end(); - } + std::vector::const_iterator end_trackers(torrent_info& i) + { + return i.trackers().end(); + } - void add_node(torrent_info& ti, char const* hostname, int port) - { - ti.add_node(std::make_pair(hostname, port)); - } + void add_node(torrent_info& ti, char const* hostname, int port) + { + ti.add_node(std::make_pair(hostname, port)); + } - list nodes(torrent_info const& ti) - { - list result; + list nodes(torrent_info const& ti) + { + list result; - typedef std::vector > list_type; + typedef std::vector > list_type; - for (list_type::const_iterator i = ti.nodes().begin(); i != ti.nodes().end(); ++i) - { - result.append(make_tuple(i->first, i->second)); - } + for (list_type::const_iterator i = ti.nodes().begin(); i != ti.nodes().end(); ++i) + { + result.append(make_tuple(i->first, i->second)); + } - return result; - } + return result; + } - file_storage::iterator begin_files(torrent_info& i) - { - return i.begin_files(); - } + file_storage::iterator begin_files(torrent_info& i) + { + return i.begin_files(); + } - file_storage::iterator end_files(torrent_info& i) - { - return i.end_files(); - } + file_storage::iterator end_files(torrent_info& i) + { + return i.end_files(); + } - //list files(torrent_info const& ti, bool storage) { - list files(torrent_info const& ti, bool storage) { - list result; + //list files(torrent_info const& ti, bool storage) { + list files(torrent_info const& ti, bool storage) { + list result; - typedef std::vector list_type; + typedef std::vector list_type; - for (list_type::const_iterator i = ti.begin_files(); i != ti.end_files(); ++i) - result.append(*i); - - return result; - } + for (list_type::const_iterator i = ti.begin_files(); i != ti.end_files(); ++i) + result.append(*i); + return result; + } + std::string metadata(torrent_info const& ti) { + std::string result(ti.metadata().get(), ti.metadata_size()); + return result; + } } // namespace unnamed void bind_torrent_info() @@ -101,6 +104,8 @@ void bind_torrent_info() .def("add_node", &add_node) .def("nodes", &nodes) + .def("metadata", &metadata) + .def("metadata_size", &torrent_info::metadata_size) ; class_("file_entry")