Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修正 size 为文件大小,添加已下载大小 #1

Merged
merged 4 commits into from
Nov 17, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions deluge_peerbanhelperadapter/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down Expand Up @@ -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())

Expand Down
3 changes: 3 additions & 0 deletions deluge_peerbanhelperadapter/model/torrent.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ class Torrent(BaseModel):
# 种子大小
size: int = 0

# 已下载的大小
completed_size: int = 0

# 是否为私有种子
priv: bool = False

Expand Down