All pastes #895625 Raw Edit

Something

public text v1 · immutable
·published 2008-02-07 23:18 UTC
rendered paste body
Index: libtorrent/bindings/python/src/torrent_handle.cpp
===================================================================
--- libtorrent/bindings/python/src/torrent_handle.cpp   (revision 2518)
+++ libtorrent/bindings/python/src/torrent_handle.cpp   (working copy)
@@ -64,6 +64,16 @@
     return result;
 }

+list piece_priorities(torrent_handle const& handle)
+{
+       list result;
+       std::vector<int> pcs = handle.piece_priorities();
+       for (std::vector<int>::iterator i = pcs.begin(); i != pcs.end(); ++i)
+       {
+               result.append(*i);
+       }
+       return result;
+}

 void prioritize_files(torrent_handle& info, object o)
 {
@@ -179,6 +189,7 @@
         .def("filter_piece", _(&torrent_handle::filter_piece))
         .def("piece_priority", _(piece_priority0))
         .def("piece_priority", _(piece_priority1))
+        .def("piece_priorities", piece_priorities)
         .def("is_piece_filtered", _(&torrent_handle::is_piece_filtered))
         .def("has_metadata", _(&torrent_handle::has_metadata))
         .def("save_path", _(&torrent_handle::save_path))