hopefully a non-problematic fix to the num-seeds and num-peers values
This commit is contained in:
parent
b1320232cc
commit
5e70f78df0
|
@ -611,16 +611,7 @@ static PyObject *torrent_get_torrent_state(PyObject *self, PyObject *args)
|
||||||
std::vector<peer_info> peers;
|
std::vector<peer_info> peers;
|
||||||
t.handle.get_peer_info(peers);
|
t.handle.get_peer_info(peers);
|
||||||
|
|
||||||
long total_seeds = 0;
|
return Py_BuildValue("{s:s,s:l,s:l,s:l,s:l,s:f,s:f,s:d,s:f,s:l,s:l,s:s,s:s,s:f,s:d,s:l,s:l,s:l,s:d,s:l,s:l,s:l,s:l,s:l,s:l,s:d,s:d}",
|
||||||
long total_peers = 0;
|
|
||||||
|
|
||||||
for (unsigned long i = 0; i < peers.size(); i++)
|
|
||||||
if (peers[i].seed)
|
|
||||||
total_seeds++;
|
|
||||||
else
|
|
||||||
total_peers++;
|
|
||||||
|
|
||||||
return Py_BuildValue("{s:s,s:l,s:l,s:l,s:l,s:f,s:f,s:d,s:f,s:l,s:l,s:s,s:s,s:f,s:d,s:l,s:l,s:l,s:d,s:l,s:l,s:l,s:l,s:l,s:l,s:d,s:d,s:l,s:l}",
|
|
||||||
"name", t.handle.get_torrent_info().name().c_str(),
|
"name", t.handle.get_torrent_info().name().c_str(),
|
||||||
"num_files", t.handle.get_torrent_info().num_files(),
|
"num_files", t.handle.get_torrent_info().num_files(),
|
||||||
"state", s.state,
|
"state", s.state,
|
||||||
|
@ -642,14 +633,12 @@ static PyObject *torrent_get_torrent_state(PyObject *self, PyObject *args)
|
||||||
"total_size", double(i.total_size()),
|
"total_size", double(i.total_size()),
|
||||||
"piece_length", long(i.piece_length()),
|
"piece_length", long(i.piece_length()),
|
||||||
"num_pieces", long(i.num_pieces()),
|
"num_pieces", long(i.num_pieces()),
|
||||||
"total_seeds", total_seeds,
|
"total_peers", long(s.num_incomplete != -1? s.num_incomplete : s.num_peers),
|
||||||
"total_peers", total_peers,
|
"total_seeds", long(s.num_complete != -1? s.num_complete : s.num_seeds),
|
||||||
"is_paused", long(t.handle.is_paused()),
|
"is_paused", long(t.handle.is_paused()),
|
||||||
"is_seed", long(t.handle.is_seed()),
|
"is_seed", long(t.handle.is_seed()),
|
||||||
"total_wanted", double(s.total_wanted),
|
"total_wanted", double(s.total_wanted),
|
||||||
"total_wanted_done", double(s.total_wanted_done),
|
"total_wanted_done", double(s.total_wanted_done));
|
||||||
"num_complete", long(s.num_complete),
|
|
||||||
"num_incomplete", long(s.num_incomplete));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static PyObject *torrent_pop_event(PyObject *self, PyObject *args)
|
static PyObject *torrent_pop_event(PyObject *self, PyObject *args)
|
||||||
|
|
Loading…
Reference in New Issue