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