From a453831deb8a7955e55e6e8d0bba5d359cd964cf Mon Sep 17 00:00:00 2001 From: Attente <19653207+wikrin@users.noreply.github.com> Date: Tue, 26 Nov 2024 03:11:25 +0800 Subject: [PATCH] =?UTF-8?q?`get=5Fdir`=E5=A2=9E=E5=8A=A0=E5=85=A5=E5=8F=82?= =?UTF-8?q?=20-=20`include=5Funsorted`=E7=94=A8=E4=BA=8E=E8=A1=A8=E7=A4=BA?= =?UTF-8?q?=E5=8F=AF=E5=90=A6`=E5=8C=85=E5=90=AB`=E6=95=B4=E7=90=86?= =?UTF-8?q?=E6=96=B9=E5=BC=8F`=E4=B8=BA`=E4=B8=8D=E6=95=B4=E7=90=86`?= =?UTF-8?q?=E7=9A=84=E7=9B=AE=E5=BD=95=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/chain/download.py | 2 +- app/helper/directory.py | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/app/chain/download.py b/app/chain/download.py index 20913b4e..5a6484e6 100644 --- a/app/chain/download.py +++ b/app/chain/download.py @@ -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: # 一级目录 diff --git a/app/helper/directory.py b/app/helper/directory.py index f3ecb9ae..04946c5e 100644 --- a/app/helper/directory.py +++ b/app/helper/directory.py @@ -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: