mirror of
https://github.com/codex-storage/deluge.git
synced 2025-01-24 10:18:51 +00:00
Update python bindings from libtorrent svn
This commit is contained in:
parent
d9ab0ec0ca
commit
082dea9b80
@ -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();
|
||||
|
@ -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> >();
|
||||
|
@ -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)
|
||||
|
@ -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")
|
||||
|
Loading…
x
Reference in New Issue
Block a user