report correct num seeds&peers, at long last
This commit is contained in:
parent
a75e2d40b8
commit
798efb7183
Binary file not shown.
|
@ -588,15 +588,6 @@ 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;
|
|
||||||
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}",
|
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(),
|
||||||
|
@ -620,8 +611,8 @@ 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_seeds", s.num_complete,
|
||||||
"total_peers", total_peers,
|
"total_peers", s.num_incomplete,
|
||||||
"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),
|
||||||
|
@ -773,11 +764,12 @@ static PyObject *torrent_pop_event(PyObject *self, PyObject *args)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (handle_exists(handle))
|
if (handle_exists(handle))
|
||||||
return Py_BuildValue("{s:i,s:i,s:s,s:s}",
|
return Py_BuildValue("{s:i,s:i,s:s,s:i,s:s}",
|
||||||
"event_type", EVENT_TRACKER,
|
"event_type", EVENT_TRACKER,
|
||||||
"unique_ID",
|
"unique_ID",
|
||||||
M_torrents->at(index).unique_ID,
|
M_torrents->at(index).unique_ID,
|
||||||
"tracker_status", "Announce succeeded",
|
"tracker_status", "Announce succeeded",
|
||||||
|
"num_peers", long(dynamic_cast<tracker_reply_alert*>(popped_alert)->num_peers),
|
||||||
"message", a->msg().c_str() );
|
"message", a->msg().c_str() );
|
||||||
else
|
else
|
||||||
{ Py_INCREF(Py_None); return Py_None; }
|
{ Py_INCREF(Py_None); return Py_None; }
|
||||||
|
|
|
@ -609,6 +609,9 @@ class DelugeGTK:
|
||||||
|
|
||||||
## Call via a timer to update the interface
|
## Call via a timer to update the interface
|
||||||
def update(self):
|
def update(self):
|
||||||
|
# Tell the core to handle messages (now, so we show their output on this tick)
|
||||||
|
self.manager.handle_events()
|
||||||
|
|
||||||
# Make sure that the interface still exists
|
# Make sure that the interface still exists
|
||||||
try:
|
try:
|
||||||
tab = self.wtree.get_widget("torrent_info").get_current_page()
|
tab = self.wtree.get_widget("torrent_info").get_current_page()
|
||||||
|
|
Loading…
Reference in New Issue