diff --git a/app/chain/storage.py b/app/chain/storage.py index f6fa877d..73b12519 100644 --- a/app/chain/storage.py +++ b/app/chain/storage.py @@ -61,6 +61,12 @@ class StorageChain(ChainBase): """ return self.run_module("create_folder", fileitem=fileitem, name=name) + def get_folder(self, storage: str, path: Path) -> Optional[schemas.FileItem]: + """ + 获取目录,不存在则递归创建 + """ + return self.run_module("get_folder", storage=storage, path=path) + def download_file(self, fileitem: schemas.FileItem, path: Path = None) -> Optional[Path]: """ 下载文件 diff --git a/app/modules/subtitle/__init__.py b/app/modules/subtitle/__init__.py index 3d50ef55..10e05f9c 100644 --- a/app/modules/subtitle/__init__.py +++ b/app/modules/subtitle/__init__.py @@ -162,7 +162,7 @@ class SubtitleModule(_ModuleBase): time.sleep(1) # 目录仍然不存在,且有文件夹名,则创建目录 if not working_dir_item and folder_name: - parent_dir_item = storageChain.get_file_item(storage, download_dir) + parent_dir_item = storageChain.get_folder(storage, download_dir) if parent_dir_item: working_dir_item = storageChain.create_folder( parent_dir_item,