fix:修复tr下载显示速率问题

This commit is contained in:
olly 2023-08-27 18:22:34 +08:00
parent 9e31c53fa5
commit aa8cb889f8

View File

@ -122,6 +122,8 @@ class TransmissionModule(_ModuleBase):
torrents = self.transmission.get_downloading_torrents(tags=settings.TORRENT_TAG)
for torrent in torrents or []:
meta = MetaInfo(torrent.name)
dlspeed = torrent.rate_download if hasattr(torrent, "rate_download") else torrent.rateDownload
upspeed = torrent.rate_upload if hasattr(torrent, "rate_upload") else torrent.rateUpload
ret_torrents.append(DownloadingTorrent(
hash=torrent.hashString,
title=torrent.name,
@ -131,8 +133,8 @@ class TransmissionModule(_ModuleBase):
progress=torrent.progress,
size=torrent.total_size,
state="paused" if torrent.status == "stopped" else "downloading",
dlspeed=StringUtils.str_filesize(torrent.download_speed),
ulspeed=StringUtils.str_filesize(torrent.upload_speed),
dlspeed=StringUtils.str_filesize(dlspeed),
upspeed=StringUtils.str_filesize(upspeed),
))
else:
return None