mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-03-31 17:32:30 +08:00
get_dir去除fileitem参数
- 和`src_path & storage`重复, 需要的话直接传入这两项
This commit is contained in:
@@ -50,8 +50,8 @@ class DirectoryHelper:
|
||||
return [d for d in self.get_library_dirs() if d.library_storage == "local"]
|
||||
|
||||
def get_dir(self, media: MediaInfo,
|
||||
storage: str = "local", fileitem: schemas.FileItem = None, src_path: Path = None,
|
||||
target_storage: str = "local", dest_path: Path = None
|
||||
storage: str = None, src_path: Path = None,
|
||||
target_storage: str = None, dest_path: Path = None
|
||||
) -> Optional[schemas.TransferDirectoryConf]:
|
||||
"""
|
||||
根据媒体信息获取下载目录、媒体库目录配置
|
||||
@@ -69,7 +69,7 @@ class DirectoryHelper:
|
||||
media_type = media.type.value
|
||||
dirs = self.get_dirs()
|
||||
# 已匹配的目录
|
||||
matched_dirs = []
|
||||
matched_dirs: List[schemas.TransferDirectoryConf] = []
|
||||
# 按照配置顺序查找
|
||||
for d in dirs:
|
||||
# 没有启用整理的目录
|
||||
@@ -81,17 +81,11 @@ class DirectoryHelper:
|
||||
# 目标存储类型不匹配
|
||||
if target_storage and d.library_storage != target_storage:
|
||||
continue
|
||||
# 有文件项时,源存储不匹配
|
||||
if fileitem and fileitem.storage != d.storage:
|
||||
continue
|
||||
# 有文件项时,文件项不匹配下载目录
|
||||
if fileitem and not Path(fileitem.path).is_relative_to(d.download_path):
|
||||
continue
|
||||
# 有源目录时,源目录不匹配下载目录
|
||||
if src_path and not src_path.is_relative_to(d.download_path):
|
||||
continue
|
||||
# 有目标目录时,目标目录不匹配媒体库目录
|
||||
if dest_path and not dest_path.is_relative_to(d.library_path):
|
||||
if dest_path and dest_path != Path(d.library_path):
|
||||
continue
|
||||
# 目录类型为全部的,符合条件
|
||||
if not d.media_type:
|
||||
|
||||
Reference in New Issue
Block a user