fix 正在下载显示剩余下载时间
This commit is contained in:
parent
26cd2c6cfe
commit
070481cab0
@ -165,6 +165,8 @@ class QbittorrentModule(_ModuleBase):
|
|||||||
state="paused" if torrent.get('state') == "paused" else "downloading",
|
state="paused" if torrent.get('state') == "paused" else "downloading",
|
||||||
dlspeed=StringUtils.str_filesize(torrent.get('dlspeed')),
|
dlspeed=StringUtils.str_filesize(torrent.get('dlspeed')),
|
||||||
upspeed=StringUtils.str_filesize(torrent.get('upspeed')),
|
upspeed=StringUtils.str_filesize(torrent.get('upspeed')),
|
||||||
|
left_time=StringUtils.str_secends(
|
||||||
|
(torrent.get('total_size') - torrent.get('completed')) / torrent.get('dlspeed'))
|
||||||
))
|
))
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
@ -151,6 +151,7 @@ class TransmissionModule(_ModuleBase):
|
|||||||
state="paused" if torrent.status == "stopped" else "downloading",
|
state="paused" if torrent.status == "stopped" else "downloading",
|
||||||
dlspeed=StringUtils.str_filesize(dlspeed),
|
dlspeed=StringUtils.str_filesize(dlspeed),
|
||||||
upspeed=StringUtils.str_filesize(upspeed),
|
upspeed=StringUtils.str_filesize(upspeed),
|
||||||
|
left_time=StringUtils.str_secends(torrent.left_until_done / dlspeed)
|
||||||
))
|
))
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
@ -289,7 +289,7 @@ class MediaSyncDel(_PluginBase):
|
|||||||
{
|
{
|
||||||
'component': 'VAlert',
|
'component': 'VAlert',
|
||||||
'props': {
|
'props': {
|
||||||
'text': '关于路径映射:'
|
'text': '关于路径映射(转移后文件):'
|
||||||
'emby:/data/series/A.mp4,'
|
'emby:/data/series/A.mp4,'
|
||||||
'moviepilot:/mnt/link/series/A.mp4。'
|
'moviepilot:/mnt/link/series/A.mp4。'
|
||||||
'路径映射填/data:/mnt/link。'
|
'路径映射填/data:/mnt/link。'
|
||||||
|
@ -31,6 +31,7 @@ class DownloadingTorrent(BaseModel):
|
|||||||
dlspeed: Optional[str] = None
|
dlspeed: Optional[str] = None
|
||||||
media: Optional[dict] = {}
|
media: Optional[dict] = {}
|
||||||
userid: Optional[str] = None
|
userid: Optional[str] = None
|
||||||
|
left_time: Optional[str] = None
|
||||||
|
|
||||||
|
|
||||||
class TransferInfo(BaseModel):
|
class TransferInfo(BaseModel):
|
||||||
|
@ -63,6 +63,23 @@ class StringUtils:
|
|||||||
b, u = d[index]
|
b, u = d[index]
|
||||||
return str(round(time_sec / (b + 1))) + u
|
return str(round(time_sec / (b + 1))) + u
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def str_secends(time_sec: Union[str, int, float]) -> str:
|
||||||
|
"""
|
||||||
|
将秒转为时分秒字符串
|
||||||
|
"""
|
||||||
|
hours = time_sec // 3600
|
||||||
|
remainder_seconds = time_sec % 3600
|
||||||
|
minutes = remainder_seconds // 60
|
||||||
|
seconds = remainder_seconds % 60
|
||||||
|
|
||||||
|
time: str = str(int(seconds)) + '秒'
|
||||||
|
if minutes:
|
||||||
|
time = str(int(minutes)) + '分' + time
|
||||||
|
if hours:
|
||||||
|
time = str(int(hours)) + '时' + time
|
||||||
|
return time
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def is_chinese(word: Union[str, list]) -> bool:
|
def is_chinese(word: Union[str, list]) -> bool:
|
||||||
"""
|
"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user