fix(subtitle): create missing download root before saving subtitles

This commit is contained in:
ilvsx
2026-04-14 12:24:18 +08:00
committed by jxxghp
parent ae5207f0e4
commit 1688063450
2 changed files with 7 additions and 1 deletions
+6
View File
@@ -61,6 +61,12 @@ class StorageChain(ChainBase):
""" """
return self.run_module("create_folder", fileitem=fileitem, name=name) 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]: def download_file(self, fileitem: schemas.FileItem, path: Path = None) -> Optional[Path]:
""" """
下载文件 下载文件
+1 -1
View File
@@ -162,7 +162,7 @@ class SubtitleModule(_ModuleBase):
time.sleep(1) time.sleep(1)
# 目录仍然不存在,且有文件夹名,则创建目录 # 目录仍然不存在,且有文件夹名,则创建目录
if not working_dir_item and folder_name: 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: if parent_dir_item:
working_dir_item = storageChain.create_folder( working_dir_item = storageChain.create_folder(
parent_dir_item, parent_dir_item,