add downloader info

This commit is contained in:
jxxghp
2023-07-10 18:38:56 +08:00
parent 15bb043fe8
commit 28b429a5d7
7 changed files with 88 additions and 4 deletions

View File

@ -1,6 +1,7 @@
from pathlib import Path
from typing import Set, Tuple, Optional, Union, List
from app import schemas
from app.core.config import settings
from app.core.metainfo import MetaInfo
from app.log import logger
@ -168,3 +169,15 @@ class TransmissionModule(_ModuleBase):
:return: bool
"""
return self.transmission.start_torrents(ids=hashs)
def downloader_info(self) -> schemas.DownloaderInfo:
"""
下载器信息
"""
info = self.transmission.transfer_info()
return schemas.DownloaderInfo(
download_speed=info.download_speed,
upload_speed=info.upload_speed,
download_size=info.current_stats.downloaded_bytes,
upload_size=info.current_stats.uploaded_bytes
)