From fb22b316c118ce5f7fc9ecfb46f56b08931d472f Mon Sep 17 00:00:00 2001 From: Marcos Pinto Date: Fri, 8 Jun 2007 06:59:40 +0000 Subject: [PATCH] fix payload oops --- src/common.py | 2 +- src/core.py | 4 ++-- src/deluge_core.cpp | 5 +++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/common.py b/src/common.py index 330d6aea9..71a5ddc9d 100644 --- a/src/common.py +++ b/src/common.py @@ -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") diff --git a/src/core.py b/src/core.py index c7c4e8a23..1d5644c70 100644 --- a/src/core.py +++ b/src/core.py @@ -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) diff --git a/src/deluge_core.cpp b/src/deluge_core.cpp index ed6758bde..e4ecfef2c 100644 --- a/src/deluge_core.cpp +++ b/src/deluge_core.cpp @@ -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),