~ubuntu-branches/ubuntu/maverick/libtorrent-rasterbar/maverick

« back to all changes in this revision

Viewing changes to bindings/python/src/create_torrent.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Cristian Greco
  • Date: 2009-05-13 12:08:59 UTC
  • mfrom: (3.2.2 sid)
  • Revision ID: james.westby@ubuntu.com-20090513120859-b5qqlwi43aai3pq3
Tags: 0.14.3-1
* New Upstream Version
  - new package libtorrent-rasterbar3 (bump up library soname).
* debian/control:
  - add Vcs-* stuff (switch to git-buildpackage) and bump up
    Standards-Version to 3.8.1 (no changes required);
  - build-depends on debhelper (>= 7.0.50) and use override_dh_command;
  - move -dbg package to the new 'debug' section;
  - build-depends on autotools-dev and overwrite config.{sub,guess} with a
    recent version in debian/rules.
  - build-depends on quilt and python-docutils:
    + debian/patches/fix_html_docs.patch: fix html documentation for offline
      browsing and add another missing doc file;
    + rebuild docs at build time in debian/rules;
* debian/example.makefile: install a simple makefile for example programs
  included in -doc package.
* debian/rules, debian/python-libtorrent.install: don't rely on hardcoded
  python version, use --install-layout=deb when building python bindings,
  and install to '*-packages' instead of 'site-packages' (this should
  prepare for python2.6 and minimize Ubuntu diff).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright Daniel Wallin & Arvid Norberg 2009. Use, modification and distribution is
 
2
// subject to the Boost Software License, Version 1.0. (See accompanying
 
3
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
4
 
 
5
#include <boost/python.hpp>
 
6
#include <libtorrent/create_torrent.hpp>
 
7
#include <libtorrent/file_storage.hpp>
 
8
#include "libtorrent/intrusive_ptr_base.hpp"
 
9
 
 
10
using namespace boost::python;
 
11
using namespace libtorrent;
 
12
 
 
13
void bind_create_torrent()
 
14
{
 
15
    void (file_storage::*add_file0)(file_entry const&) = &file_storage::add_file;
 
16
    void (file_storage::*add_file1)(fs::path const&, size_type) = &file_storage::add_file;
 
17
 
 
18
    class_<file_storage>("file_storage")
 
19
        .def("is_valid", &file_storage::is_valid)
 
20
        .def("add_file", add_file0)
 
21
        .def("add_file", add_file1)
 
22
        .def("num_files", &file_storage::num_files)
 
23
        .def("at", &file_storage::at, return_internal_reference<>())
 
24
        .def("total_size", &file_storage::total_size)
 
25
        .def("set_num_pieces", &file_storage::set_num_pieces)
 
26
        .def("num_pieces", &file_storage::num_pieces)
 
27
        .def("set_piece_length", &file_storage::set_piece_length)
 
28
        .def("piece_length", &file_storage::piece_length)
 
29
        .def("piece_size", &file_storage::piece_size)
 
30
        .def("set_name", &file_storage::set_name)
 
31
        .def("name", &file_storage::name, return_internal_reference<>())
 
32
        ;
 
33
 
 
34
    class_<create_torrent>("create_torrent", no_init)
 
35
        .def(init<file_storage&>())
 
36
        .def(init<file_storage&, int>())
 
37
 
 
38
        .def("generate", &create_torrent::generate)
 
39
 
 
40
        .def("files", &create_torrent::files, return_internal_reference<>())
 
41
        .def("set_comment", &create_torrent::set_comment)
 
42
        .def("set_creator", &create_torrent::set_creator)
 
43
        .def("set_hash", &create_torrent::set_hash)
 
44
        .def("add_url_seed", &create_torrent::add_url_seed)
 
45
        .def("add_node", &create_torrent::add_node)
 
46
        .def("add_tracker", &create_torrent::add_tracker)
 
47
        .def("set_priv", &create_torrent::set_priv)
 
48
        .def("num_pieces", &create_torrent::num_pieces)
 
49
        .def("piece_length", &create_torrent::piece_length)
 
50
        .def("piece_size", &create_torrent::piece_size)
 
51
        .def("priv", &create_torrent::priv)
 
52
        ;
 
53
}