summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Resch <andrewresch@gmail.com>2009-01-24 05:31:45 +0000
committerAndrew Resch <andrewresch@gmail.com>2009-01-24 05:31:45 +0000
commit7bc8c9fa36167a90522e4511522d117e1065d75d (patch)
tree8040e5a6d6463f5d410d94a9dbe59e2ae014e9e4
parentd268ed49559fd9f8de568d698bb4c40b5a6b2d83 (diff)
downloaddeluge-7bc8c9fa36167a90522e4511522d117e1065d75d.tar.gz
deluge-7bc8c9fa36167a90522e4511522d117e1065d75d.tar.bz2
deluge-7bc8c9fa36167a90522e4511522d117e1065d75d.zip
Update python bindings from libtorrent svn
-rwxr-xr-xlibtorrent/bindings/python/src/module.cpp2
-rwxr-xr-xlibtorrent/bindings/python/src/session.cpp1
-rwxr-xr-xlibtorrent/bindings/python/src/torrent_handle.cpp2
-rwxr-xr-xlibtorrent/bindings/python/src/torrent_info.cpp21
4 files changed, 25 insertions, 1 deletions
diff --git a/libtorrent/bindings/python/src/module.cpp b/libtorrent/bindings/python/src/module.cpp
index 3d0925f47..c512e346a 100755
--- a/libtorrent/bindings/python/src/module.cpp
+++ b/libtorrent/bindings/python/src/module.cpp
@@ -44,7 +44,9 @@ BOOST_PYTHON_MODULE(libtorrent)
bind_alert();
bind_datetime();
bind_extensions();
+#ifndef TORRENT_NO_PYTHON_PLUGINS
bind_peer_plugin();
+#endif
bind_torrent();
bind_peer_info();
bind_ip_filter();
diff --git a/libtorrent/bindings/python/src/session.cpp b/libtorrent/bindings/python/src/session.cpp
index 5d9e9fddf..bcb96eb9a 100755
--- a/libtorrent/bindings/python/src/session.cpp
+++ b/libtorrent/bindings/python/src/session.cpp
@@ -389,6 +389,7 @@ void bind_session()
.def("pause", allow_threads(&session::pause))
.def("resume", allow_threads(&session::resume))
.def("is_paused", allow_threads(&session::is_paused))
+ .def("id", allow_threads(&session::id))
;
register_ptr_to_python<std::auto_ptr<alert> >();
diff --git a/libtorrent/bindings/python/src/torrent_handle.cpp b/libtorrent/bindings/python/src/torrent_handle.cpp
index 588173cee..639fcf86d 100755
--- a/libtorrent/bindings/python/src/torrent_handle.cpp
+++ b/libtorrent/bindings/python/src/torrent_handle.cpp
@@ -304,7 +304,7 @@ void bind_torrent_handle()
.def("piece_priority", _(piece_priority0))
.def("piece_priority", _(piece_priority1))
.def("prioritize_pieces", prioritize_pieces)
- .def("piece_prioritize", piece_priorities)
+ .def("piece_priorities", piece_priorities)
.def("prioritize_files", prioritize_files)
.def("file_priorities", file_priorities)
.def("use_interface", &torrent_handle::use_interface)
diff --git a/libtorrent/bindings/python/src/torrent_info.cpp b/libtorrent/bindings/python/src/torrent_info.cpp
index a373b091c..bbe64fcd9 100755
--- a/libtorrent/bindings/python/src/torrent_info.cpp
+++ b/libtorrent/bindings/python/src/torrent_info.cpp
@@ -71,12 +71,30 @@ namespace
torrent_info construct0(std::string path) {
return torrent_info(fs::path(path));
}
+
+ list map_block(torrent_info& ti, int piece, size_type offset, int size)
+ {
+ std::vector<file_slice> p = ti.map_block(piece, offset, size);
+ list result;
+
+ for (std::vector<file_slice>::iterator i(p.begin()), e(p.end()); i != e; ++i)
+ result.append(*i);
+
+ return result;
+ }
+
} // namespace unnamed
void bind_torrent_info()
{
return_value_policy<copy_const_reference> copy;
+ class_<file_slice>("file_slice")
+ .def_readwrite("file_index", &file_slice::file_index)
+ .def_readwrite("offset", &file_slice::offset)
+ .def_readwrite("size", &file_slice::size)
+ ;
+
class_<torrent_info, boost::intrusive_ptr<torrent_info> >("torrent_info", no_init)
#ifndef TORRENT_NO_DEPRECATE
.def(init<entry const&>())
@@ -102,6 +120,7 @@ void bind_torrent_info()
.def("num_files", &torrent_info::num_files, (arg("storage")=false))
.def("file_at", &torrent_info::file_at, return_internal_reference<>())
+ .def("file_at_offset", &torrent_info::file_at_offset)
.def("files", &files, (arg("storage")=false))
.def("priv", &torrent_info::priv)
@@ -113,6 +132,8 @@ void bind_torrent_info()
.def("nodes", &nodes)
.def("metadata", &metadata)
.def("metadata_size", &torrent_info::metadata_size)
+ .def("map_block", map_block)
+ .def("map_file", &torrent_info::map_file)
;
class_<file_entry>("file_entry")