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

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Christophe Sauthier
  • Date: 2010-08-10 12:59:37 UTC
  • mfrom: (1.3.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20100810125937-jbcmmf17y8yo9hgz
Tags: 0.15.0-0ubuntu1
* New upstream version.
* debian/patches/100_fix_html_docs.patch: refreshed.
* debian/control: bump up standards-version to 3.9.1 (no changes).

Show diffs side-by-side

added added

removed removed

Lines of Context:
83
83
       return result;
84
84
    }
85
85
 
 
86
    bool get_verified(announce_entry const& ae)
 
87
    { return ae.verified; }
 
88
    bool get_updating(announce_entry const& ae)
 
89
    { return ae.updating; }
 
90
    bool get_start_sent(announce_entry const& ae)
 
91
    { return ae.start_sent; }
 
92
    bool get_complete_sent(announce_entry const& ae)
 
93
    { return ae.complete_sent; }
 
94
    bool get_send_stats(announce_entry const& ae)
 
95
    { return ae.send_stats; }
 
96
 
86
97
} // namespace unnamed
87
98
 
88
99
void bind_torrent_info()
89
100
{
90
101
    return_value_policy<copy_const_reference> copy;
91
102
 
 
103
    void (torrent_info::*rename_file0)(int, std::string const&) = &torrent_info::rename_file;
 
104
#ifndef BOOST_FILESYSTEM_NARROW_ONLY
 
105
    void (torrent_info::*rename_file1)(int, std::wstring const&) = &torrent_info::rename_file;
 
106
#endif
 
107
 
92
108
    class_<file_slice>("file_slice")
93
109
        .def_readwrite("file_index", &file_slice::file_index)
94
110
        .def_readwrite("offset", &file_slice::offset)
102
118
        .def(init<sha1_hash const&>())
103
119
        .def(init<char const*, int>())
104
120
        .def(init<boost::filesystem::path>())
 
121
        .def(init<boost::filesystem::wpath>())
105
122
 
106
123
        .def("add_tracker", &torrent_info::add_tracker, (arg("url"), arg("tier")=0))
107
124
        .def("add_url_seed", &torrent_info::add_url_seed)
122
139
        .def("file_at", &torrent_info::file_at, return_internal_reference<>())
123
140
        .def("file_at_offset", &torrent_info::file_at_offset)
124
141
        .def("files", &files, (arg("storage")=false))
125
 
        .def("rename_file", &torrent_info::rename_file)
 
142
        .def("rename_file", rename_file0)
 
143
#ifndef BOOST_FILESYSTEM_NARROW_ONLY
 
144
        .def("rename_file", rename_file1)
 
145
#endif
126
146
 
127
147
        .def("priv", &torrent_info::priv)
128
148
        .def("trackers", range(begin_trackers, end_trackers))
152
172
    class_<announce_entry>("announce_entry", init<std::string const&>())
153
173
        .def_readwrite("url", &announce_entry::url)
154
174
        .def_readwrite("tier", &announce_entry::tier)
 
175
        .add_property("fail_limit", &announce_entry::fail_limit)
 
176
        .add_property("fails", &announce_entry::fails)
 
177
        .add_property("source", &announce_entry::source)
 
178
        .add_property("verified", &get_verified)
 
179
        .add_property("updating", &get_updating)
 
180
        .add_property("start_sent", &get_start_sent)
 
181
        .add_property("complete_sent", &get_complete_sent)
 
182
        .add_property("send_stats", &get_send_stats)
 
183
 
 
184
        .def("reset", &announce_entry::reset)
 
185
        .def("failed", &announce_entry::failed, arg("retry_interval") = 0)
 
186
        .def("can_announce", &announce_entry::can_announce)
 
187
        .def("is_working", &announce_entry::is_working)
 
188
        .def("trim", &announce_entry::trim)
155
189
        ;
156
190
}