mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-06-08 01:01:26 +08:00
fix bug
This commit is contained in:
@@ -99,6 +99,9 @@ class StorageBase(metaclass=ABCMeta):
|
||||
def download(self, fileitem: schemas.FileItem, path: Path = None) -> Path:
|
||||
"""
|
||||
下载文件,保存到本地,返回本地临时文件地址
|
||||
:param fileitem: 文件项
|
||||
:param path: 文件保存路径
|
||||
|
||||
"""
|
||||
pass
|
||||
|
||||
@@ -106,6 +109,8 @@ class StorageBase(metaclass=ABCMeta):
|
||||
def upload(self, fileitem: schemas.FileItem, path: Path) -> Optional[schemas.FileItem]:
|
||||
"""
|
||||
上传文件
|
||||
:param fileitem: 上传目录项
|
||||
:param path: 本地文件路径
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
@@ -256,7 +256,7 @@ class AliPan(StorageBase):
|
||||
else:
|
||||
items = self.aligo.get_file_list(parent_file_id=fileitem.fileid, drive_id=fileitem.drive_id)
|
||||
if items:
|
||||
return [self.__get_fileitem(item) for item in items]
|
||||
return [self.__get_fileitem(item, parent=fileitem.path) for item in items]
|
||||
return []
|
||||
|
||||
def create_folder(self, fileitem: schemas.FileItem, name: str) -> Optional[schemas.FileItem]:
|
||||
@@ -341,10 +341,14 @@ class AliPan(StorageBase):
|
||||
"""
|
||||
if not self.aligo:
|
||||
return None
|
||||
item = self.aligo.upload_file(file_path=str(path.parent), parent_file_id=fileitem.fileid,
|
||||
drive_id=fileitem.drive_id, name=path.name)
|
||||
if item:
|
||||
return self.__get_fileitem(item)
|
||||
# 上传文件
|
||||
result = self.aligo.upload_file(file_path=str(path), parent_file_id=fileitem.fileid,
|
||||
drive_id=fileitem.drive_id, name=path.name,
|
||||
check_name_mode="refuse")
|
||||
if result:
|
||||
item = self.aligo.get_file(file_id=result.file_id, drive_id=result.drive_id)
|
||||
if item:
|
||||
return self.__get_fileitem(item)
|
||||
return None
|
||||
|
||||
def move(self, fileitem: schemas.FileItem, target: schemas.FileItem) -> bool:
|
||||
|
||||
@@ -187,12 +187,13 @@ class LocalStorage(StorageBase):
|
||||
"""
|
||||
上传文件
|
||||
"""
|
||||
file_path = Path(fileitem.path)
|
||||
code, message = SystemUtils.move(path, file_path)
|
||||
dir_path = Path(fileitem.path)
|
||||
target_path = dir_path / path.name
|
||||
code, message = SystemUtils.move(path, target_path)
|
||||
if code != 0:
|
||||
logger.error(f"移动文件失败:{message}")
|
||||
return None
|
||||
return self.__get_diritem(file_path)
|
||||
return self.__get_diritem(target_path)
|
||||
|
||||
def copy(self, fileitem: schemas.FileItem, target_file: Path) -> bool:
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user