mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-06-08 01:01:26 +08:00
refactor(helper): 将DirectoryHelper、RuleHelper和TorrentHelper方法改为静态方法
- 移除不必要的实例化操作,直接使用类方法
This commit is contained in:
@@ -533,7 +533,7 @@ class FileManagerModule(_ModuleBase):
|
||||
handler = TransHandler()
|
||||
ret_fileitems = []
|
||||
# 检查本地媒体库
|
||||
dest_dirs = DirectoryHelper().get_library_dirs()
|
||||
dest_dirs = DirectoryHelper.get_library_dirs()
|
||||
# 检查每一个媒体库目录
|
||||
for dest_dir in dest_dirs:
|
||||
# 存储
|
||||
|
||||
@@ -338,10 +338,9 @@ class LocalStorage(StorageBase):
|
||||
"""
|
||||
存储使用情况
|
||||
"""
|
||||
directory_helper = DirectoryHelper()
|
||||
total_storage, free_storage = SystemUtils.space_usage(
|
||||
[Path(d.download_path) for d in directory_helper.get_local_download_dirs() if d.download_path] +
|
||||
[Path(d.library_path) for d in directory_helper.get_local_library_dirs() if d.library_path]
|
||||
[Path(d.download_path) for d in DirectoryHelper.get_local_download_dirs() if d.download_path] +
|
||||
[Path(d.library_path) for d in DirectoryHelper.get_local_library_dirs() if d.library_path]
|
||||
)
|
||||
return schemas.StorageUsage(
|
||||
total=total_storage,
|
||||
|
||||
@@ -141,10 +141,6 @@ class FilterModule(_ModuleBase):
|
||||
},
|
||||
}
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.rulehelper = RuleHelper()
|
||||
|
||||
def init_module(self) -> None:
|
||||
self.parser = RuleParser()
|
||||
self.__init_custom_rules()
|
||||
@@ -153,7 +149,7 @@ class FilterModule(_ModuleBase):
|
||||
"""
|
||||
加载用户自定义规则,如跟内置规则冲突,以用户自定义规则为准
|
||||
"""
|
||||
custom_rules = self.rulehelper.get_custom_rules()
|
||||
custom_rules = RuleHelper.get_custom_rules()
|
||||
for rule in custom_rules:
|
||||
logger.info(f"加载自定义规则 {rule.id} - {rule.name}")
|
||||
self.rule_set[rule.id] = rule.model_dump()
|
||||
|
||||
@@ -145,7 +145,7 @@ class SubtitleModule(_ModuleBase):
|
||||
# 字幕下载目录
|
||||
logger.info("开始从站点下载字幕:%s" % torrent.page_url)
|
||||
# 获取种子信息
|
||||
folder_name, _ = TorrentHelper().get_fileinfo_from_torrent_content(torrent_content)
|
||||
folder_name, _ = TorrentHelper.get_fileinfo_from_torrent_content(torrent_content)
|
||||
# 文件保存目录,如果是单文件种子,则folder_name是空,此时文件保存目录就是下载目录
|
||||
storageChain = StorageChain()
|
||||
# 等待目录存在
|
||||
|
||||
Reference in New Issue
Block a user