fix payload oops

This commit is contained in:
Marcos Pinto 2007-06-08 06:59:40 +00:00
parent d9d482b4df
commit fb22b316c1
3 changed files with 6 additions and 5 deletions

View File

@ -39,7 +39,7 @@ PLUGIN_DIR = os.path.join(INSTALL_PREFIX, 'share', 'deluge', 'plugins')
def estimate_eta(state):
try:
return ftime(get_eta(state["total_size"], state["total_done"], state["download_rate"]))
return ftime(get_eta(state["total_size"], state["total_payload_download"], state["download_rate"]))
except ZeroDivisionError:
return _("Infinity")

View File

@ -717,8 +717,8 @@ class Manager:
# Calculations
def calc_ratio(self, unique_ID, torrent_state):
up = float(torrent_state['total_upload'] + self.unique_IDs[unique_ID].uploaded_memory)
down = float(torrent_state["total_done"])
up = float(torrent_state['total_payload_upload'])
down = float(torrent_state["total_payload_download"])
try:
ret = float(up/down)

View File

@ -620,7 +620,7 @@ static PyObject *torrent_get_torrent_state(PyObject *self, PyObject *args)
long connected_peers = s.num_peers - connected_seeds;
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}",
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:i,s:i,s:l,s:l,s:l,s:d,s:l,s:l,s:l,s:l,s:l,s:l,s:d,s:d}",
"name", t.handle.get_torrent_info().name().c_str(),
"num_files", t.handle.get_torrent_info().num_files(),
"state", s.state,
@ -635,7 +635,8 @@ static PyObject *torrent_get_torrent_state(PyObject *self, PyObject *args)
"next_announce", boost::posix_time::to_simple_string(s.next_announce).c_str(),
"tracker", s.current_tracker.c_str(),
"progress", float(s.progress),
"total_done", double(s.total_done),
"total_payload_download", int(s.total_payload_download),
"total_payload_upload", int(s.total_payload_upload),
"pieces", long(s.pieces),
"pieces_done", long(s.num_pieces),
"block_size", long(s.block_size),