mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-04-03 10:48:35 +08:00
get_dir增加入参
- `include_unsorted`用于表示可否`包含`整理方式`为`不整理`的目录配置
This commit is contained in:
@@ -256,7 +256,7 @@ class DownloadChain(ChainBase):
|
||||
download_dir = Path(save_path)
|
||||
else:
|
||||
# 根据媒体信息查询下载目录配置
|
||||
dir_info = self.directoryhelper.get_dir(_media, storage="local")
|
||||
dir_info = self.directoryhelper.get_dir(_media, storage="local", include_unsorted=True)
|
||||
# 拼装子目录
|
||||
if dir_info:
|
||||
# 一级目录
|
||||
|
||||
@@ -49,13 +49,14 @@ class DirectoryHelper:
|
||||
"""
|
||||
return [d for d in self.get_library_dirs() if d.library_storage == "local"]
|
||||
|
||||
def get_dir(self, media: MediaInfo,
|
||||
def get_dir(self, media: MediaInfo, include_unsorted: bool = False,
|
||||
storage: str = None, src_path: Path = None,
|
||||
target_storage: str = None, dest_path: Path = None
|
||||
) -> Optional[schemas.TransferDirectoryConf]:
|
||||
"""
|
||||
根据媒体信息获取下载目录、媒体库目录配置
|
||||
:param media: 媒体信息
|
||||
:param include_unsorted: 包含不整理目录
|
||||
:param storage: 源存储类型
|
||||
:param target_storage: 目标存储类型
|
||||
:param fileitem: 文件项,使用文件路径匹配
|
||||
@@ -68,14 +69,12 @@ class DirectoryHelper:
|
||||
# 电影/电视剧
|
||||
media_type = media.type.value
|
||||
dirs = self.get_dirs()
|
||||
# 是否下载器匹配
|
||||
not_downloader: bool = src_path or dest_path or target_storage
|
||||
# 已匹配的目录
|
||||
matched_dirs: List[schemas.TransferDirectoryConf] = []
|
||||
# 按照配置顺序查找
|
||||
for d in dirs:
|
||||
# 没有启用整理的目录
|
||||
if not d.monitor_type and not_downloader:
|
||||
if not d.monitor_type and not include_unsorted:
|
||||
continue
|
||||
# 源存储类型不匹配
|
||||
if storage and d.storage != storage:
|
||||
|
||||
Reference in New Issue
Block a user