mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-05 23:47:41 +08:00
fix size
This commit is contained in:
@@ -310,6 +310,17 @@ class JobManager:
|
|||||||
return 0
|
return 0
|
||||||
return len([task for task in self._job_view[__mediaid__].tasks if task.state == "completed"])
|
return len([task for task in self._job_view[__mediaid__].tasks if task.state == "completed"])
|
||||||
|
|
||||||
|
def size(self, media: MediaInfo, season: int = None) -> int:
|
||||||
|
"""
|
||||||
|
获取某项任务总大小
|
||||||
|
"""
|
||||||
|
__mediaid__ = self.__get_media_id(media=media, season=season)
|
||||||
|
with job_lock:
|
||||||
|
# 计算状态为完成的任务数
|
||||||
|
if __mediaid__ not in self._job_view:
|
||||||
|
return 0
|
||||||
|
return sum([task.fileitem.size for task in self._job_view[__mediaid__].tasks if task.state == "completed"])
|
||||||
|
|
||||||
def total(self) -> int:
|
def total(self) -> int:
|
||||||
"""
|
"""
|
||||||
获取所有task任务总数
|
获取所有task任务总数
|
||||||
@@ -455,6 +466,8 @@ class TransferChain(ChainBase, metaclass=Singleton):
|
|||||||
se_str = f"{task.meta.season}"
|
se_str = f"{task.meta.season}"
|
||||||
# 更新文件数量
|
# 更新文件数量
|
||||||
transferinfo.file_count = self.jobview.count(task.mediainfo, task.meta.begin_season) or 1
|
transferinfo.file_count = self.jobview.count(task.mediainfo, task.meta.begin_season) or 1
|
||||||
|
# 更新文件大小
|
||||||
|
transferinfo.file_size = self.jobview.size(task.mediainfo, task.meta.begin_season) or task.fileitem.size
|
||||||
self.send_transfer_message(meta=task.meta,
|
self.send_transfer_message(meta=task.meta,
|
||||||
mediainfo=task.mediainfo,
|
mediainfo=task.mediainfo,
|
||||||
transferinfo=transferinfo,
|
transferinfo=transferinfo,
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import traceback
|
import traceback
|
||||||
from dataclasses import dataclass, asdict
|
from dataclasses import dataclass
|
||||||
from typing import Union, Optional, List, Self
|
from typing import Union, Optional, List, Self
|
||||||
|
|
||||||
import cn2an
|
import cn2an
|
||||||
import regex as re
|
import regex as re
|
||||||
|
|
||||||
from app.log import logger
|
from app.log import logger
|
||||||
from app.utils.string import StringUtils
|
|
||||||
from app.schemas.types import MediaType
|
from app.schemas.types import MediaType
|
||||||
|
from app.utils.string import StringUtils
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
|||||||
@@ -10,14 +10,10 @@ from watchdog.events import FileSystemEventHandler, FileSystemMovedEvent, FileSy
|
|||||||
from watchdog.observers.polling import PollingObserver
|
from watchdog.observers.polling import PollingObserver
|
||||||
|
|
||||||
from app.chain import ChainBase
|
from app.chain import ChainBase
|
||||||
from app.chain.media import MediaChain
|
|
||||||
from app.chain.storage import StorageChain
|
from app.chain.storage import StorageChain
|
||||||
from app.chain.tmdb import TmdbChain
|
|
||||||
from app.chain.transfer import TransferChain
|
from app.chain.transfer import TransferChain
|
||||||
from app.core.config import settings
|
from app.core.config import settings
|
||||||
from app.db.downloadhistory_oper import DownloadHistoryOper
|
|
||||||
from app.db.systemconfig_oper import SystemConfigOper
|
from app.db.systemconfig_oper import SystemConfigOper
|
||||||
from app.db.transferhistory_oper import TransferHistoryOper
|
|
||||||
from app.helper.directory import DirectoryHelper
|
from app.helper.directory import DirectoryHelper
|
||||||
from app.helper.message import MessageHelper
|
from app.helper.message import MessageHelper
|
||||||
from app.log import logger
|
from app.log import logger
|
||||||
@@ -73,12 +69,7 @@ class Monitor(metaclass=Singleton):
|
|||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.chain = MonitorChain()
|
|
||||||
self.transferhis = TransferHistoryOper()
|
|
||||||
self.transferchain = TransferChain()
|
self.transferchain = TransferChain()
|
||||||
self.downloadhis = DownloadHistoryOper()
|
|
||||||
self.mediaChain = MediaChain()
|
|
||||||
self.tmdbchain = TmdbChain()
|
|
||||||
self.storagechain = StorageChain()
|
self.storagechain = StorageChain()
|
||||||
self.directoryhelper = DirectoryHelper()
|
self.directoryhelper = DirectoryHelper()
|
||||||
self.systemmessage = MessageHelper()
|
self.systemmessage = MessageHelper()
|
||||||
|
|||||||
Reference in New Issue
Block a user