diff --git a/deluge_peerbanhelperadapter/core.py b/deluge_peerbanhelperadapter/core.py index 2ad00df..0d79d7f 100644 --- a/deluge_peerbanhelperadapter/core.py +++ b/deluge_peerbanhelperadapter/core.py @@ -133,12 +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.size = deluge_torrent.status.total_wanted 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.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 = [] @@ -208,10 +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.size = deluge_torrent.status.total_wanted + # LT torrent_info torrent_info = deluge_torrent.handle.torrent_file() + 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 03feec1..3e71080 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