From 0953f043930c1043ad7b4883f53eb12fe81bb66c Mon Sep 17 00:00:00 2001 From: paulzzh <28055560+paulzzh@users.noreply.github.com> Date: Sun, 17 Nov 2024 02:54:38 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=20size=20=E4=B8=BA?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=A4=A7=E5=B0=8F=EF=BC=8C=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=B7=B2=E4=B8=8B=E8=BD=BD=E5=A4=A7=E5=B0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deluge_peerbanhelperadapter/core.py | 6 ++++-- deluge_peerbanhelperadapter/model/torrent.py | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/deluge_peerbanhelperadapter/core.py b/deluge_peerbanhelperadapter/core.py index 2ad00df..750d808 100644 --- a/deluge_peerbanhelperadapter/core.py +++ b/deluge_peerbanhelperadapter/core.py @@ -133,12 +133,13 @@ def get_active_torrents_info(self): torrent.name = deluge_torrent.get_name() torrent.info_hash = torrent_id torrent.progress = deluge_torrent.get_progress() - torrent.size = deluge_torrent.status.total_wanted + torrent.completed_size = deluge_torrent.status.total_wanted_done torrent.upload_payload_rate = deluge_torrent.status.upload_payload_rate torrent.download_payload_rate = deluge_torrent.status.download_payload_rate # LT torrent_info torrent_info = deluge_torrent.handle.torrent_file() torrent.priv = torrent_info.priv() + torrent.size = torrent_info.total_size() # LT peer_info lt_peers = deluge_torrent.handle.get_peer_info() peers = [] @@ -208,10 +209,11 @@ def get_torrents_info(self): torrent.name = deluge_torrent.get_name() torrent.info_hash = torrent_id torrent.progress = deluge_torrent.get_progress() - torrent.size = deluge_torrent.status.total_wanted + torrent.completed_size = deluge_torrent.status.total_wanted_done # LT torrent_info torrent_info = deluge_torrent.handle.torrent_file() torrent.priv = torrent_info.priv() + torrent.size = torrent_info.total_size() torrents.append(torrent.dist()) diff --git a/deluge_peerbanhelperadapter/model/torrent.py b/deluge_peerbanhelperadapter/model/torrent.py index 03feec1..6342daf 100644 --- a/deluge_peerbanhelperadapter/model/torrent.py +++ b/deluge_peerbanhelperadapter/model/torrent.py @@ -80,6 +80,9 @@ class Torrent(BaseModel): # 种子大小 size: int = 0 + # 已下载的大小 + completed_size: int = 0 + # 是否为私有种子 priv: bool = False From 1bf50367399648dea3748f43a39e6c0c6d08afe2 Mon Sep 17 00:00:00 2001 From: paulzzh <28055560+paulzzh@users.noreply.github.com> Date: Sun, 17 Nov 2024 19:39:00 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=97=A2=E7=84=B6=E8=83=BD=E6=8F=90?= =?UTF-8?q?=E4=BE=9B=EF=BC=8C=E9=82=A3=E5=B0=B1=E6=94=B9=E7=94=A8=20total?= =?UTF-8?q?=5Fdone?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deluge_peerbanhelperadapter/core.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deluge_peerbanhelperadapter/core.py b/deluge_peerbanhelperadapter/core.py index 750d808..d34afc8 100644 --- a/deluge_peerbanhelperadapter/core.py +++ b/deluge_peerbanhelperadapter/core.py @@ -133,7 +133,7 @@ def get_active_torrents_info(self): torrent.name = deluge_torrent.get_name() torrent.info_hash = torrent_id torrent.progress = deluge_torrent.get_progress() - torrent.completed_size = deluge_torrent.status.total_wanted_done + torrent.completed_size = deluge_torrent.status.total_done torrent.upload_payload_rate = deluge_torrent.status.upload_payload_rate torrent.download_payload_rate = deluge_torrent.status.download_payload_rate # LT torrent_info @@ -209,7 +209,7 @@ def get_torrents_info(self): torrent.name = deluge_torrent.get_name() torrent.info_hash = torrent_id torrent.progress = deluge_torrent.get_progress() - torrent.completed_size = deluge_torrent.status.total_wanted_done + torrent.completed_size = deluge_torrent.status.total_done # LT torrent_info torrent_info = deluge_torrent.handle.torrent_file() torrent.priv = torrent_info.priv() From 79722d830a85d6104d20b0667aa710f7dc62248e Mon Sep 17 00:00:00 2001 From: paulzzh <28055560+paulzzh@users.noreply.github.com> Date: Mon, 18 Nov 2024 02:08:26 +0800 Subject: [PATCH 3/4] =?UTF-8?q?Revert=20"=E6=97=A2=E7=84=B6=E8=83=BD?= =?UTF-8?q?=E6=8F=90=E4=BE=9B=EF=BC=8C=E9=82=A3=E5=B0=B1=E6=94=B9=E7=94=A8?= =?UTF-8?q?=20total=5Fdone"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 1bf50367399648dea3748f43a39e6c0c6d08afe2. --- deluge_peerbanhelperadapter/core.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deluge_peerbanhelperadapter/core.py b/deluge_peerbanhelperadapter/core.py index d34afc8..750d808 100644 --- a/deluge_peerbanhelperadapter/core.py +++ b/deluge_peerbanhelperadapter/core.py @@ -133,7 +133,7 @@ def get_active_torrents_info(self): torrent.name = deluge_torrent.get_name() torrent.info_hash = torrent_id torrent.progress = deluge_torrent.get_progress() - torrent.completed_size = deluge_torrent.status.total_done + torrent.completed_size = deluge_torrent.status.total_wanted_done torrent.upload_payload_rate = deluge_torrent.status.upload_payload_rate torrent.download_payload_rate = deluge_torrent.status.download_payload_rate # LT torrent_info @@ -209,7 +209,7 @@ def get_torrents_info(self): torrent.name = deluge_torrent.get_name() torrent.info_hash = torrent_id torrent.progress = deluge_torrent.get_progress() - torrent.completed_size = deluge_torrent.status.total_done + torrent.completed_size = deluge_torrent.status.total_wanted_done # LT torrent_info torrent_info = deluge_torrent.handle.torrent_file() torrent.priv = torrent_info.priv() From ee4e253f4a9fb77e6d14e2ec99f42c2d6944cc12 Mon Sep 17 00:00:00 2001 From: azicen Date: Mon, 18 Nov 2024 03:51:51 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E9=80=9A=E8=BF=87=20`=E5=9D=97=E6=95=B0?= =?UTF-8?q?=E9=87=8F*=E5=9D=97=E5=A4=A7=E5=B0=8F`=20=E8=AE=A1=E7=AE=97=20`?= =?UTF-8?q?=E5=AE=9E=E9=99=85=E5=81=9A=E7=A7=8D=E5=A4=A7=E5=B0=8F`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deluge_peerbanhelperadapter/core.py | 19 +++++++++++++++---- deluge_peerbanhelperadapter/model/torrent.py | 2 +- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/deluge_peerbanhelperadapter/core.py b/deluge_peerbanhelperadapter/core.py index 750d808..0d79d7f 100644 --- a/deluge_peerbanhelperadapter/core.py +++ b/deluge_peerbanhelperadapter/core.py @@ -133,13 +133,19 @@ def get_active_torrents_info(self): torrent.name = deluge_torrent.get_name() torrent.info_hash = torrent_id torrent.progress = deluge_torrent.get_progress() - torrent.completed_size = deluge_torrent.status.total_wanted_done torrent.upload_payload_rate = deluge_torrent.status.upload_payload_rate torrent.download_payload_rate = deluge_torrent.status.download_payload_rate + # LT torrent_info torrent_info = deluge_torrent.handle.torrent_file() - torrent.priv = torrent_info.priv() torrent.size = torrent_info.total_size() + torrent.priv = torrent_info.priv() + piece_length = torrent_info.piece_length() + + # LT torrent_status + torrent_status = deluge_torrent.handle.status() + torrent.completed_size = torrent_status.num_pieces * piece_length + # LT peer_info lt_peers = deluge_torrent.handle.get_peer_info() peers = [] @@ -209,11 +215,16 @@ def get_torrents_info(self): torrent.name = deluge_torrent.get_name() torrent.info_hash = torrent_id torrent.progress = deluge_torrent.get_progress() - torrent.completed_size = deluge_torrent.status.total_wanted_done + # LT torrent_info torrent_info = deluge_torrent.handle.torrent_file() - torrent.priv = torrent_info.priv() torrent.size = torrent_info.total_size() + torrent.priv = torrent_info.priv() + piece_length = torrent_info.piece_length() + + # LT torrent_status + torrent_status = deluge_torrent.handle.status() + torrent.completed_size = torrent_status.num_pieces * piece_length torrents.append(torrent.dist()) diff --git a/deluge_peerbanhelperadapter/model/torrent.py b/deluge_peerbanhelperadapter/model/torrent.py index 6342daf..3e71080 100644 --- a/deluge_peerbanhelperadapter/model/torrent.py +++ b/deluge_peerbanhelperadapter/model/torrent.py @@ -80,7 +80,7 @@ class Torrent(BaseModel): # 种子大小 size: int = 0 - # 已下载的大小 + # 种子实际做种大小 completed_size: int = 0 # 是否为私有种子