fix conversions of resume_data field of save_resume_data_alert. make write_resume_data_buf return a byte-array. use write_resume_data_buf() in client.py instead of, the deprecated, resume_data
This commit is contained in:
parent
ec18742f8e
commit
07ff024e30
|
@ -355,7 +355,7 @@ def main():
|
||||||
for a in alerts:
|
for a in alerts:
|
||||||
if type(a) == lt.save_resume_data_alert:
|
if type(a) == lt.save_resume_data_alert:
|
||||||
print(a)
|
print(a)
|
||||||
data = lt.bencode(a.resume_data)
|
data = lt.write_resume_data_buf(a.params)
|
||||||
h = a.handle
|
h = a.handle
|
||||||
if h in torrents:
|
if h in torrents:
|
||||||
open(os.path.join(options.save_path, torrents[h].name + '.fastresume'), 'wb').write(data)
|
open(os.path.join(options.save_path, torrents[h].name + '.fastresume'), 'wb').write(data)
|
||||||
|
|
|
@ -135,6 +135,13 @@ dict session_stats_values(session_stats_alert const& alert)
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef TORRENT_NO_DEPRECATE
|
||||||
|
entry const& get_resume_data_entry(save_resume_data_alert const& self)
|
||||||
|
{
|
||||||
|
return *self.resume_data;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace boost
|
namespace boost
|
||||||
{
|
{
|
||||||
// some older compilers (like msvc-12.0) end up using
|
// some older compilers (like msvc-12.0) end up using
|
||||||
|
@ -676,7 +683,7 @@ void bind_alert()
|
||||||
"save_resume_data_alert", no_init)
|
"save_resume_data_alert", no_init)
|
||||||
.def_readonly("params", &save_resume_data_alert::params)
|
.def_readonly("params", &save_resume_data_alert::params)
|
||||||
#ifndef TORRENT_NO_DEPRECATE
|
#ifndef TORRENT_NO_DEPRECATE
|
||||||
.def_readonly("resume_data", &save_resume_data_alert::resume_data)
|
.add_property("resume_data", make_function(get_resume_data_entry, by_value()))
|
||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
|
@ -634,6 +634,15 @@ namespace
|
||||||
return lt::find_metric_idx(name);
|
return lt::find_metric_idx(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bytes write_resume_data_buf_(add_torrent_params const& atp)
|
||||||
|
{
|
||||||
|
bytes ret;
|
||||||
|
auto buf = write_resume_data_buf(atp);
|
||||||
|
ret.arr.resize(buf.size());
|
||||||
|
std::copy(buf.begin(), buf.end(), ret.arr.begin());
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
|
|
||||||
struct dummy1 {};
|
struct dummy1 {};
|
||||||
|
@ -1100,7 +1109,7 @@ void bind_session()
|
||||||
def("default_settings", default_settings_wrapper);
|
def("default_settings", default_settings_wrapper);
|
||||||
def("read_resume_data", read_resume_data_wrapper);
|
def("read_resume_data", read_resume_data_wrapper);
|
||||||
def("write_resume_data", write_resume_data);
|
def("write_resume_data", write_resume_data);
|
||||||
def("write_resume_data_buf", write_resume_data_buf);
|
def("write_resume_data_buf", write_resume_data_buf_);
|
||||||
|
|
||||||
class_<stats_metric>("stats_metric")
|
class_<stats_metric>("stats_metric")
|
||||||
.def_readonly("name", &stats_metric::name)
|
.def_readonly("name", &stats_metric::name)
|
||||||
|
|
Loading…
Reference in New Issue